enb_config.c 142 KB
Newer Older
1
/*******************************************************************************
nikaeinn's avatar
nikaeinn committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom

    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is
18 19
    included in this distribution in the file called "COPYING". If not,
    see <http://www.gnu.org/licenses/>.
nikaeinn's avatar
nikaeinn committed
20 21 22 23 24 25

  Contact Information
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
  OpenAirInterface Dev  : openair4g-devel@eurecom.fr

ghaddab's avatar
ghaddab committed
26
  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
nikaeinn's avatar
nikaeinn committed
27

28
 *******************************************************************************/
nikaeinn's avatar
nikaeinn committed
29

gauthier's avatar
gauthier committed
30 31 32
/*
                                enb_config.c
                             -------------------
33
  AUTHOR  : Lionel GAUTHIER, navid nikaein, Laurent Winckel
gauthier's avatar
gauthier committed
34
  COMPANY : EURECOM
35
  EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
36
 */
37 38 39

#include <string.h>
#include <libconfig.h>
40
#include <inttypes.h>
41

42
#include "log.h"
43
#include "log_extern.h"
44 45
#include "assertions.h"
#include "enb_config.h"
46 47
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
winckel's avatar
winckel committed
48 49 50 51
#if defined(OAI_EMU)
# include "OCG.h"
# include "OCG_extern.h"
#endif
52 53 54 55 56 57 58 59 60
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
# if defined(ENABLE_USE_MME)
#   include "s1ap_eNB.h"
#   include "sctp_eNB_task.h"
# endif
#endif
#include "LAYER2/MAC/extern.h"

61 62 63 64 65 66 67 68 69 70 71
#define ENB_CONFIG_STRING_ACTIVE_ENBS                   "Active_eNBs"

#define ENB_CONFIG_STRING_ENB_LIST                      "eNBs"
#define ENB_CONFIG_STRING_ENB_ID                        "eNB_ID"
#define ENB_CONFIG_STRING_CELL_TYPE                     "cell_type"
#define ENB_CONFIG_STRING_ENB_NAME                      "eNB_name"

#define ENB_CONFIG_STRING_TRACKING_AREA_CODE            "tracking_area_code"
#define ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE           "mobile_country_code"
#define ENB_CONFIG_STRING_MOBILE_NETWORK_CODE           "mobile_network_code"

72
#define ENB_CONFIG_STRING_COMPONENT_CARRIERS                            "component_carriers"
73

74 75 76 77 78 79 80
#define ENB_CONFIG_STRING_FRAME_TYPE                                    "frame_type"
#define ENB_CONFIG_STRING_TDD_CONFIG                                    "tdd_config"
#define ENB_CONFIG_STRING_TDD_CONFIG_S                                  "tdd_config_s"
#define ENB_CONFIG_STRING_PREFIX_TYPE                                   "prefix_type"
#define ENB_CONFIG_STRING_EUTRA_BAND                                    "eutra_band"
#define ENB_CONFIG_STRING_DOWNLINK_FREQUENCY                            "downlink_frequency"
#define ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET                       "uplink_frequency_offset"
81

82 83 84 85 86
#define ENB_CONFIG_STRING_NID_CELL                                      "Nid_cell"
#define ENB_CONFIG_STRING_N_RB_DL                                       "N_RB_DL"
#define ENB_CONFIG_STRING_CELL_MBSFN	                                "Nid_cell_mbsfn" 
#define ENB_CONFIG_STRING_NB_ANT_TX	                                "nb_antennas_tx"   
#define ENB_CONFIG_STRING_NB_ANT_RX	                                "nb_antennas_rx"   
knopp's avatar
knopp committed
87 88
#define ENB_CONFIG_STRING_TX_GAIN                                       "tx_gain"   
#define ENB_CONFIG_STRING_RX_GAIN                                       "rx_gain"   
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
#define ENB_CONFIG_STRING_PRACH_ROOT	                                "prach_root"   
#define ENB_CONFIG_STRING_PRACH_CONFIG_INDEX	                        "prach_config_index" 
#define ENB_CONFIG_STRING_PRACH_HIGH_SPEED	                        "prach_high_speed" 
#define ENB_CONFIG_STRING_PRACH_ZERO_CORRELATION	                "prach_zero_correlation" 
#define ENB_CONFIG_STRING_PRACH_FREQ_OFFSET	                        "prach_freq_offset" 
#define ENB_CONFIG_STRING_PUCCH_DELTA_SHIFT	                        "pucch_delta_shift" 
#define ENB_CONFIG_STRING_PUCCH_NRB_CQI	                                "pucch_nRB_CQI" 
#define ENB_CONFIG_STRING_PUCCH_NCS_AN	                                "pucch_nCS_AN"
#ifndef Rel10 
#define ENB_CONFIG_STRING_PUCCH_N1_AN	                                "pucch_n1_AN" 
#endif
#define ENB_CONFIG_STRING_PDSCH_RS_EPRE	                                "pdsch_referenceSignalPower" 
#define ENB_CONFIG_STRING_PDSCH_PB	                                "pdsch_p_b" 
#define ENB_CONFIG_STRING_PUSCH_N_SB	                                "pusch_n_SB" 
#define ENB_CONFIG_STRING_PUSCH_HOPPINGMODE                             "pusch_hoppingMode"
#define ENB_CONFIG_STRING_PUSCH_HOPPINGOFFSET                           "pusch_hoppingOffset"
#define ENB_CONFIG_STRING_PUSCH_ENABLE64QAM	                        "pusch_enable64QAM" 
#define ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN	                "pusch_groupHoppingEnabled" 
#define ENB_CONFIG_STRING_PUSCH_GROUP_ASSIGNMENT	                "pusch_groupAssignment" 
#define ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN	                "pusch_sequenceHoppingEnabled" 
#define ENB_CONFIG_STRING_PUSCH_NDMRS1	                                "pusch_nDMRS1" 
#define ENB_CONFIG_STRING_PHICH_DURATION	                        "phich_duration" 
#define ENB_CONFIG_STRING_PHICH_RESOURCE	                        "phich_resource" 
#define ENB_CONFIG_STRING_SRS_ENABLE	                                "srs_enable" 
#define ENB_CONFIG_STRING_SRS_BANDWIDTH_CONFIG	                        "srs_BandwidthConfig" 
#define ENB_CONFIG_STRING_SRS_SUBFRAME_CONFIG	                        "srs_SubframeConfig" 
#define ENB_CONFIG_STRING_SRS_ACKNACKST_CONFIG	                        "srs_ackNackST" 
#define ENB_CONFIG_STRING_SRS_MAXUPPTS	                                "srs_MaxUpPts" 
#define ENB_CONFIG_STRING_PUSCH_PO_NOMINAL	                        "pusch_p0_Nominal" 
#define ENB_CONFIG_STRING_PUSCH_ALPHA	                                "pusch_alpha" 
#define ENB_CONFIG_STRING_PUCCH_PO_NOMINAL	                        "pucch_p0_Nominal" 
#define ENB_CONFIG_STRING_MSG3_DELTA_PREAMBLE	                        "msg3_delta_Preamble" 
#define ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT1	                        "pucch_deltaF_Format1" 
#define ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT1b	                        "pucch_deltaF_Format1b" 
#define ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2	                        "pucch_deltaF_Format2" 
#define ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2A	                        "pucch_deltaF_Format2a" 
#define ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2B	                        "pucch_deltaF_Format2b" 
#define ENB_CONFIG_STRING_RACH_NUM_RA_PREAMBLES	                        "rach_numberOfRA_Preambles" 
#define ENB_CONFIG_STRING_RACH_PREAMBLESGROUPACONFIG	                "rach_preamblesGroupAConfig" 
#define ENB_CONFIG_STRING_RACH_SIZEOFRA_PREAMBLESGROUPA                 "rach_sizeOfRA_PreamblesGroupA"
#define ENB_CONFIG_STRING_RACH_MESSAGESIZEGROUPA                        "rach_messageSizeGroupA" 
#define ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB                 "rach_messagePowerOffsetGroupB"
#define ENB_CONFIG_STRING_RACH_POWERRAMPINGSTEP	                        "rach_powerRampingStep" 
#define ENB_CONFIG_STRING_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER	"rach_preambleInitialReceivedTargetPower" 
#define ENB_CONFIG_STRING_RACH_PREAMBLETRANSMAX	                        "rach_preambleTransMax" 
#define ENB_CONFIG_STRING_RACH_RARESPONSEWINDOWSIZE	                "rach_raResponseWindowSize" 
#define ENB_CONFIG_STRING_RACH_MACCONTENTIONRESOLUTIONTIMER	        "rach_macContentionResolutionTimer"
#define ENB_CONFIG_STRING_RACH_MAXHARQMSG3TX	                        "rach_maxHARQ_Msg3Tx"
#define ENB_CONFIG_STRING_PCCH_DEFAULT_PAGING_CYCLE                     "pcch_default_PagingCycle"
#define ENB_CONFIG_STRING_PCCH_NB                                       "pcch_nB"
#define ENB_CONFIG_STRING_BCCH_MODIFICATIONPERIODCOEFF                  "bcch_modificationPeriodCoeff"
#define ENB_CONFIG_STRING_UETIMERS_T300                                 "ue_TimersAndConstants_t300"
#define ENB_CONFIG_STRING_UETIMERS_T301                                 "ue_TimersAndConstants_t301"
#define ENB_CONFIG_STRING_UETIMERS_T310                                 "ue_TimersAndConstants_t310"
#define ENB_CONFIG_STRING_UETIMERS_T311                                 "ue_TimersAndConstants_t311"
#define ENB_CONFIG_STRING_UETIMERS_N310                                 "ue_TimersAndConstants_n310"
#define ENB_CONFIG_STRING_UETIMERS_N311                                 "ue_TimersAndConstants_n311"
146

147 148 149 150 151 152 153 154 155 156 157
#define ENB_CONFIG_STRING_MME_IP_ADDRESS                "mme_ip_address"
#define ENB_CONFIG_STRING_MME_IPV4_ADDRESS              "ipv4"
#define ENB_CONFIG_STRING_MME_IPV6_ADDRESS              "ipv6"
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE         "active"
#define ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE     "preference"

#define ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG     "NETWORK_INTERFACES"
#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1_MME "ENB_INTERFACE_NAME_FOR_S1_MME"
#define ENB_CONFIG_STRING_ENB_IPV4_ADDRESS_FOR_S1_MME   "ENB_IPV4_ADDRESS_FOR_S1_MME"
#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1U    "ENB_INTERFACE_NAME_FOR_S1U"
#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U         "ENB_IPV4_ADDRESS_FOR_S1U"
158
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U              "ENB_PORT_FOR_S1U"
159

gauthier's avatar
gauthier committed
160 161 162 163 164 165

#define ENB_CONFIG_STRING_ASN1_VERBOSITY                      "Asn1_verbosity"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE                 "none"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING             "annoying"
#define ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO                 "info"

166 167 168 169 170
// OTG config per ENB-UE DL 
#define ENB_CONF_STRING_OTG_CONFIG                          "otg_config"
#define ENB_CONF_STRING_OTG_UE_ID                           "ue_id"
#define ENB_CONF_STRING_OTG_APP_TYPE                        "app_type"
#define ENB_CONF_STRING_OTG_BG_TRAFFIC                      "bg_traffic"
gauthier's avatar
gauthier committed
171

172 173 174
// per eNB configuration 
#define ENB_CONFIG_STRING_LOG_CONFIG                       "log_config"
#define ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL                 "global_log_level"
175 176 177
#define ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY             "global_log_verbosity"
#define ENB_CONFIG_STRING_HW_LOG_LEVEL                     "hw_log_level"
#define ENB_CONFIG_STRING_HW_LOG_VERBOSITY                 "hw_log_verbosity"
178 179 180 181 182 183 184 185 186 187
#define ENB_CONFIG_STRING_PHY_LOG_LEVEL                    "phy_log_level"
#define ENB_CONFIG_STRING_PHY_LOG_VERBOSITY                "phy_log_verbosity"
#define ENB_CONFIG_STRING_MAC_LOG_LEVEL                    "mac_log_level"
#define ENB_CONFIG_STRING_MAC_LOG_VERBOSITY                "mac_log_verbosity"
#define ENB_CONFIG_STRING_RLC_LOG_LEVEL                    "rlc_log_level"
#define ENB_CONFIG_STRING_RLC_LOG_VERBOSITY                "rlc_log_verbosity"
#define ENB_CONFIG_STRING_PDCP_LOG_LEVEL                   "pdcp_log_level"
#define ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY               "pdcp_log_verbosity"
#define ENB_CONFIG_STRING_RRC_LOG_LEVEL                    "rrc_log_level"
#define ENB_CONFIG_STRING_RRC_LOG_VERBOSITY                "rrc_log_verbosity"
188 189 190 191
#define ENB_CONFIG_STRING_GTPU_LOG_LEVEL                   "gtpu_log_level"
#define ENB_CONFIG_STRING_GTPU_LOG_VERBOSITY               "gtpu_log_verbosity"
#define ENB_CONFIG_STRING_UDP_LOG_LEVEL                    "udp_log_level"
#define ENB_CONFIG_STRING_UDP_LOG_VERBOSITY                "udp_log_verbosity"
192 193
#define ENB_CONFIG_STRING_OSA_LOG_LEVEL                    "osa_log_level"
#define ENB_CONFIG_STRING_OSA_LOG_VERBOSITY                "osa_log_verbosity"
194 195


196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
#define KHz (1000UL)
#define MHz (1000 * KHz)

typedef struct eutra_band_s
{
    int16_t             band;
    uint32_t            ul_min;
    uint32_t            ul_max;
    uint32_t            dl_min;
    uint32_t            dl_max;
    lte_frame_type_t    frame_type;
} eutra_band_t;

static const eutra_band_t eutra_bands[] =
{
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
        { 1, 1920    * MHz, 1980    * MHz, 2110    * MHz, 2170    * MHz, FDD},
        { 2, 1850    * MHz, 1910    * MHz, 1930    * MHz, 1990    * MHz, FDD},
        { 3, 1710    * MHz, 1785    * MHz, 1805    * MHz, 1880    * MHz, FDD},
        { 4, 1710    * MHz, 1755    * MHz, 2110    * MHz, 2155    * MHz, FDD},
        { 5,  824    * MHz,  849    * MHz,  869    * MHz,  894    * MHz, FDD},
        { 6,  830    * MHz,  840    * MHz,  875    * MHz,  885    * MHz, FDD},
        { 7, 2500    * MHz, 2570    * MHz, 2620    * MHz, 2690    * MHz, FDD},
        { 8,  880    * MHz,  915    * MHz,  925    * MHz,  960    * MHz, FDD},
        { 9, 1749900 * KHz, 1784900 * KHz, 1844900 * KHz, 1879900 * KHz, FDD},
        {10, 1710    * MHz, 1770    * MHz, 2110    * MHz, 2170    * MHz, FDD},
        {11, 1427900 * KHz, 1452900 * KHz, 1475900 * KHz, 1500900 * KHz, FDD},
        {12,  698    * MHz,  716    * MHz,  728    * MHz,  746    * MHz, FDD},
        {13,  777    * MHz,  787    * MHz,  746    * MHz,  756    * MHz, FDD},
        {14,  788    * MHz,  798    * MHz,  758    * MHz,  768    * MHz, FDD},

        {17,  704    * MHz,  716    * MHz,  734    * MHz,  746    * MHz, FDD},
227 228
	{20,  832    * MHz,  862    * MHz,  791    * MHz,  821    * MHz, FDD},
	{33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
229 230 231 232 233 234 235 236
        {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
        {34, 2010    * MHz, 2025    * MHz, 2010    * MHz, 2025    * MHz, TDD},
        {35, 1850    * MHz, 1910    * MHz, 1850    * MHz, 1910    * MHz, TDD},
        {36, 1930    * MHz, 1990    * MHz, 1930    * MHz, 1990    * MHz, TDD},
        {37, 1910    * MHz, 1930    * MHz, 1910    * MHz, 1930    * MHz, TDD},
        {38, 2570    * MHz, 2620    * MHz, 2570    * MHz, 2630    * MHz, TDD},
        {39, 1880    * MHz, 1920    * MHz, 1880    * MHz, 1920    * MHz, TDD},
        {40, 2300    * MHz, 2400    * MHz, 2300    * MHz, 2400    * MHz, TDD},
237 238 239 240
    {41, 2496    * MHz, 2690    * MHz, 2496    * MHz, 2690    * MHz, TDD},
    {42, 3400    * MHz, 3600    * MHz, 3400    * MHz, 3600    * MHz, TDD},
    {43, 3600    * MHz, 3800    * MHz, 3600    * MHz, 3800    * MHz, TDD},
    {44, 703    * MHz, 803    * MHz, 703    * MHz, 803    * MHz, TDD},
241 242
};

243
static Enb_properties_array_t enb_properties;
244

245
static void enb_config_display(void) {
246
    int i,j;
247 248 249 250 251

    printf( "\n----------------------------------------------------------------------\n");
    printf( " ENB CONFIG FILE CONTENT LOADED (TBC):\n");
    printf( "----------------------------------------------------------------------\n");
    for (i = 0; i < enb_properties.number; i++) {
252 253
        printf( "ENB CONFIG for instance %u:\n\n", i);
        printf( "\teNB name:           \t%s:\n",enb_properties.properties[i]->eNB_name);
254
        printf( "\teNB ID:             \t%"PRIu32":\n",enb_properties.properties[i]->eNB_id);
255
        printf( "\tCell type:          \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
256 257
        printf( "\tTAC:                \t%"PRIu16":\n",enb_properties.properties[i]->tac);
        printf( "\tMCC:                \t%"PRIu16":\n",enb_properties.properties[i]->mcc);
gauthier's avatar
gauthier committed
258
        if (enb_properties.properties[i]->mnc_digit_length == 3)
259
            printf( "\tMNC:                \t%03"PRIu16":\n",enb_properties.properties[i]->mnc);
gauthier's avatar
gauthier committed
260
        else
261
            printf( "\tMNC:                \t%02"PRIu16":\n",enb_properties.properties[i]->mnc);
262

263
        for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
264 265 266
            printf( "\teutra band for CC %d:         \t%"PRId16":\n",j,enb_properties.properties[i]->eutra_band[j]);
            printf( "\tdownlink freq for CC %d:      \t%"PRIu64":\n",j,enb_properties.properties[i]->downlink_frequency[j]);
            printf( "\tuplink freq offset for CC %d: \t%"PRId32":\n",j,enb_properties.properties[i]->uplink_frequency_offset[j]);
267

268 269
            printf( "\n\tCell ID for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->Nid_cell[j]);
            printf( "\tN_RB_DL for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->N_RB_DL[j]);
270 271
            printf( "\tnb_antennas_tx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_tx[j]);
            printf( "\tnb_antennas_rx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_rx[j]);
knopp's avatar
knopp committed
272 273

      // RACH-Config
274
            printf( "\trach_numberOfRA_Preambles for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_numberOfRA_Preambles[j]);
knopp's avatar
knopp committed
275 276
	    printf( "\trach_preamblesGroupAConfig for CC %d:\t%d:\n",j,enb_properties.properties[i]->rach_preamblesGroupAConfig[j]);
	    if (enb_properties.properties[i]->rach_preamblesGroupAConfig[j]) {
277 278
	      printf( "\trach_sizeOfRA_PreamblesGroupA for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_sizeOfRA_PreamblesGroupA[j]);
	      printf( "\trach_messageSizeGroupA for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_messageSizeGroupA[j]);
knopp's avatar
knopp committed
279 280
	      printf( "\trach_messagePowerOffsetGroupB for CC %d:\t%d:\n",j,enb_properties.properties[i]->rach_messagePowerOffsetGroupB[j]);
	    }
281 282 283 284 285 286
	    printf( "\trach_powerRampingStep for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_powerRampingStep[j]);
	    printf( "\trach_preambleInitialReceivedTargetPower for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_preambleInitialReceivedTargetPower[j]);
	    printf( "\trach_preambleTransMax for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_preambleTransMax[j]);
	    printf( "\trach_raResponseWindowSize for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_raResponseWindowSize[j]);
	    printf( "\trach_macContentionResolutionTimer for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_macContentionResolutionTimer[j]);
	    printf( "\trach_maxHARQ_Msg3Tx for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_maxHARQ_Msg3Tx[j]);
knopp's avatar
knopp committed
287 288
	    
	    // BCCH-Config
289
	    printf( "\tbcch_modificationPeriodCoeff for CC %d:\t%ld:\n",j,enb_properties.properties[i]->bcch_modificationPeriodCoeff[j]);
knopp's avatar
knopp committed
290 291
	    
	    // PCCH-Config
292 293
	    printf( "\tpcch_defaultPagingCycle for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pcch_defaultPagingCycle[j]);
	    printf( "\tpcch_nB for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pcch_nB[j]);
knopp's avatar
knopp committed
294 295
	    
	    // PRACH-Config
296 297
	    printf( "\tprach_root for CC %d:\t%ld:\n",j,enb_properties.properties[i]->prach_root[j]);
	    printf( "\tprach_config_index for CC %d:\t%ld:\n",j,enb_properties.properties[i]->prach_config_index[j]);
knopp's avatar
knopp committed
298
	    printf( "\tprach_high_speed for CC %d:\t%d:\n",j,enb_properties.properties[i]->prach_high_speed[j]);
299 300
	    printf( "\tprach_zero_correlation for CC %d:\t%ld:\n",j,enb_properties.properties[i]->prach_zero_correlation[j]);
	    printf( "\tprach_freq_offset for CC %d:\t%ld:\n",j,enb_properties.properties[i]->prach_freq_offset[j]);
knopp's avatar
knopp committed
301 302
	    
	    // PDSCH-Config
303 304
	    printf( "\tpdsch_referenceSignalPower for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pdsch_referenceSignalPower[j]);
	    printf( "\tpdsch_p_b for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pdsch_p_b[j]);
knopp's avatar
knopp committed
305 306
	    
	    // PUSCH-Config
307 308 309
	    printf( "\tpusch_n_SB for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_n_SB[j]);
	    printf( "\tpusch_hoppingMode for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_hoppingMode[j]);
	    printf( "\tpusch_hoppingOffset for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_hoppingOffset[j]);
knopp's avatar
knopp committed
310 311
	    printf( "\tpusch_enable64QAM for CC %d:\t%d:\n",j,enb_properties.properties[i]->pusch_enable64QAM[j]);
	    printf( "\tpusch_groupHoppingEnabled for CC %d:\t%d:\n",j,enb_properties.properties[i]->pusch_groupHoppingEnabled[j]);
312
	    printf( "\tpusch_groupAssignment for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_groupAssignment[j]);
knopp's avatar
knopp committed
313
	    printf( "\tpusch_sequenceHoppingEnabled for CC %d:\t%d:\n",j,enb_properties.properties[i]->pusch_sequenceHoppingEnabled[j]);
314
	    printf( "\tpusch_nDMRS1 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_nDMRS1[j]);
knopp's avatar
knopp committed
315 316 317
	    
	    // PUCCH-Config
	    
318 319 320
	    printf( "\tpucch_delta_shift for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_delta_shift[j]);
	    printf( "\tpucch_nRB_CQI for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_nRB_CQI[j]);
	    printf( "\tpucch_nCS_AN for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_nCS_AN[j]);
321
#ifndef Rel10
322
	    printf( "\tpucch_n1_AN for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_n1_AN[j]);
323
#endif
knopp's avatar
knopp committed
324 325 326 327
	    
	    // SRS Config
	    printf( "\tsrs_enable for CC %d:\t%d:\n",j,enb_properties.properties[i]->srs_enable[j]);
	    if (enb_properties.properties[i]->srs_enable[j]) {
328 329
	      printf( "\tsrs_BandwidthConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_BandwidthConfig[j]);
	      printf( "\tsrs_BandwidthConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_SubframeConfig[j]);
knopp's avatar
knopp committed
330 331 332 333 334 335
	      printf( "\tsrs_ackNackST for CC %d:\t%d:\n",j,enb_properties.properties[i]->srs_ackNackST[j]); 
	      printf( "\tsrs_MaxUpPts for CC %d:\t%d:\n",j,enb_properties.properties[i]->srs_MaxUpPts[j]);
	    }
    
	    // uplinkPowerControlCommon
	    
336 337 338
	    printf( "\tpusch_p0_Nominal for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_p0_Nominal[j]);
	    printf( "\tpucch_p0_Nominal for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_p0_Nominal[j]);
	    printf( "\tpusch_alpha for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_alpha[j]);
knopp's avatar
knopp committed
339 340 341 342 343
	    printf( "\tpucch_deltaF_Format1 for CC %d:\t%d:\n",j,enb_properties.properties[i]->pucch_deltaF_Format1[j]);
	    printf( "\tpucch_deltaF_Format1b for CC %d:\t%d:\n",j,enb_properties.properties[i]->pucch_deltaF_Format1b[j]);
	    printf( "\tpucch_deltaF_Format2 for CC %d:\t%d:\n",j,enb_properties.properties[i]->pucch_deltaF_Format2[j]);
	    printf( "\tpucch_deltaF_Format2a for CC %d:\t%d:\n",j,enb_properties.properties[i]->pucch_deltaF_Format2a[j]);    
	    printf( "\tpucch_deltaF_Format2b for CC %d:\t%d:\n",j,enb_properties.properties[i]->pucch_deltaF_Format2b[j]);
344 345
	    printf( "\tmsg3_delta_Preamble for CC %d:\t%ld:\n",j,enb_properties.properties[i]->msg3_delta_Preamble[j]);
	    printf( "\tul_CyclicPrefixLength for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ul_CyclicPrefixLength[j]);
knopp's avatar
knopp committed
346 347 348
	    
	    // UE Timers and Constants
	    
349 350 351 352 353 354
	    printf( "\tue_TimersAndConstants_t300 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t300[j]);
	    printf( "\tue_TimersAndConstants_t301 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t301[j]);
	    printf( "\tue_TimersAndConstants_t310 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t310[j]);
	    printf( "\tue_TimersAndConstants_n310 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_n310[j]);
	    printf( "\tue_TimersAndConstants_t311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t311[j]);
	    printf( "\tue_TimersAndConstants_n311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_n311[j]);
knopp's avatar
knopp committed
355
 
356
        }
357
	for (j=0; j < enb_properties.properties[i]->num_otg_elements; j++){
358 359
	  printf( "\n\tOTG Destination UE ID:  \t%"PRIu16, enb_properties.properties[i]->otg_ue_id[j]);
	  printf( "\n\tOTG App Type:  \t%"PRIu8, enb_properties.properties[i]->otg_app_type[j]);
360 361 362
	  printf( "\n\tOTG Background Traffic:  \t%s\n", (enb_properties.properties[i]->otg_bg_traffic[j]==1) ? "Enabled" : "Disabled");
	}
	
363 364 365 366 367 368 369
        printf( "\n\tGlobal log level:  \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->glog_level));
        printf( "\tHW log level:      \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->hw_log_level));
        printf( "\tPHY log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->phy_log_level));
        printf( "\tMAC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->mac_log_level));
        printf( "\tRLC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->rlc_log_level));
        printf( "\tPDCP log level:    \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->pdcp_log_level));
        printf( "\tRRC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->rrc_log_level));
370 371 372
	printf( "\tUDP log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->udp_log_level));
	printf( "\tGTP log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->gtpu_log_level));
	printf( "\tOSA log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->osa_log_level));
373 374

        printf( "\n--------------------------------------------------------\n");
375 376 377 378
    }
}


379
static int enb_check_band_frequencies(char* lib_config_file_name_pP,
380 381 382 383 384
        int enb_properties_index,
        int16_t band,
        uint32_t downlink_frequency,
        int32_t uplink_frequency_offset,
        lte_frame_type_t frame_type)
385
{
386
    int errors = 0;
387 388 389 390 391 392 393 394 395 396 397

    if (band > 0)
    {
        int band_index;

        for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++)
        {
            if (band == eutra_bands[band_index].band)
            {
                uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;

398
                AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
399 400
                        "Failed to parse eNB configuration file %s, enb %d downlink frequency %u too low (%u) for band %d!",
                        lib_config_file_name_pP, enb_properties_index, downlink_frequency, eutra_bands[band_index].dl_min, band);
401
                AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
402 403
                        "Failed to parse eNB configuration file %s, enb %d downlink frequency %u too high (%u) for band %d!",
                        lib_config_file_name_pP, enb_properties_index, downlink_frequency, eutra_bands[band_index].dl_max, band);
404 405

                AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
406 407
                        "Failed to parse eNB configuration file %s, enb %d uplink frequency %u too low (%u) for band %d!",
                        lib_config_file_name_pP, enb_properties_index, uplink_frequency, eutra_bands[band_index].ul_min, band);
408
                AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
409 410
                        "Failed to parse eNB configuration file %s, enb %d uplink frequency %u too high (%u) for band %d!",
                        lib_config_file_name_pP, enb_properties_index, uplink_frequency, eutra_bands[band_index].ul_max, band);
411 412

                AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
413 414
                        "Failed to parse eNB configuration file %s, enb %d invalid frame type (%d/%d) for band %d!",
                        lib_config_file_name_pP, enb_properties_index, eutra_bands[band_index].frame_type, frame_type, band);
415 416 417
            }
        }
    }
418
    return errors;
419 420
}

gauthier's avatar
gauthier committed
421 422 423 424 425
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
extern int asn_debug;
extern int asn1_xer_print;
#endif

426 427 428 429 430
#ifdef LIBCONFIG_LONG
#define libconfig_int long
#else
#define libconfig_int int
#endif
431
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
432 433 434 435 436 437 438 439
    config_t          cfg;
    config_setting_t *setting                       = NULL;
    config_setting_t *subsetting                    = NULL;
    config_setting_t *setting_component_carriers    = NULL;
    config_setting_t *component_carrier             = NULL;
    config_setting_t *setting_mme_addresses         = NULL;
    config_setting_t *setting_mme_address           = NULL;
    config_setting_t *setting_enb                   = NULL;
440 441
    config_setting_t *setting_otg                   = NULL;
    config_setting_t *subsetting_otg                   = NULL;
442 443 444 445
    int               num_enb_properties            = 0;
    int               enb_properties_index          = 0;
    int               num_enbs;
    int               num_mme_address;
446
    int               num_otg_elements              =0;
447 448 449 450 451 452 453 454 455 456 457 458 459
    int               num_component_carriers        =0;
    int               i;
    int               j;
    int               parse_errors                  = 0;
    libconfig_int     enb_id                        = 0;
    const char*       cell_type                     = NULL;
    const char*       tac                           = 0;
    const char*       enb_name                      = NULL;
    const char*       mcc                           = 0;
    const char*       mnc                           = 0;
    const char*       frame_type;
    libconfig_int          tdd_config;
    libconfig_int          tdd_config_s;
460
    const char*            prefix_type              = NULL;
461
    libconfig_int          eutra_band;
462
    long long int          downlink_frequency;
463 464 465 466
    libconfig_int          uplink_frequency_offset;
    libconfig_int          Nid_cell;
    libconfig_int          Nid_cell_mbsfn;
    libconfig_int          N_RB_DL;
knopp's avatar
knopp committed
467
    libconfig_int	   nb_antennas_tx;
468
    libconfig_int          nb_antennas_rx;
knopp's avatar
knopp committed
469 470
    libconfig_int          tx_gain;
    libconfig_int          rx_gain;
471 472
    libconfig_int          prach_root;
    libconfig_int          prach_config_index;
473
    const char*            prach_high_speed         = NULL;
474 475 476 477 478
    libconfig_int          prach_zero_correlation;
    libconfig_int          prach_freq_offset;
    libconfig_int          pucch_delta_shift;
    libconfig_int          pucch_nRB_CQI;
    libconfig_int          pucch_nCS_AN;
479
#ifndef Rel10 
480
    libconfig_int          pucch_n1_AN;
481
#endif
482 483 484
    libconfig_int          pdsch_referenceSignalPower;
    libconfig_int          pdsch_p_b;
    libconfig_int          pusch_n_SB;
485
    const char *      pusch_hoppingMode             = NULL;
486
    libconfig_int          pusch_hoppingOffset;
487 488
    const char*          pusch_enable64QAM          = NULL;
    const char*          pusch_groupHoppingEnabled  = NULL;
489
    libconfig_int          pusch_groupAssignment;
490
    const char*          pusch_sequenceHoppingEnabled = NULL;
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
    libconfig_int          pusch_nDMRS1;
    const char*       phich_duration;
    const char*          phich_resource;
    const char*          srs_enable;
    libconfig_int          srs_BandwidthConfig;
    libconfig_int          srs_SubframeConfig;
    const char*          srs_ackNackST;
    const char*          srs_MaxUpPts;
    libconfig_int          pusch_p0_Nominal;
    const char*          pusch_alpha;
    libconfig_int          pucch_p0_Nominal;
    libconfig_int          msg3_delta_Preamble;
    libconfig_int          ul_CyclicPrefixLength;
    const char*          pucch_deltaF_Format1;
    const char*          pucch_deltaF_Format1a;
    const char*          pucch_deltaF_Format1b;
    const char*          pucch_deltaF_Format2;
    const char*          pucch_deltaF_Format2a;
    const char*          pucch_deltaF_Format2b;
    libconfig_int        rach_numberOfRA_Preambles;
    const char*          rach_preamblesGroupAConfig;
    libconfig_int        rach_sizeOfRA_PreamblesGroupA;
    libconfig_int        rach_messageSizeGroupA;
    const char*          rach_messagePowerOffsetGroupB;
    libconfig_int              rach_powerRampingStep;
    libconfig_int              rach_preambleInitialReceivedTargetPower;
    libconfig_int              rach_preambleTransMax;
    libconfig_int              rach_raResponseWindowSize;
    libconfig_int              rach_macContentionResolutionTimer;
    libconfig_int              rach_maxHARQ_Msg3Tx;
    libconfig_int              pcch_defaultPagingCycle;
    const char*       pcch_nB;
    libconfig_int              bcch_modificationPeriodCoeff;
    libconfig_int              ue_TimersAndConstants_t300;
    libconfig_int              ue_TimersAndConstants_t301;
    libconfig_int              ue_TimersAndConstants_t310;
    libconfig_int              ue_TimersAndConstants_t311;
    libconfig_int              ue_TimersAndConstants_n310;
    libconfig_int              ue_TimersAndConstants_n311;



    char*             ipv4                          = NULL;
    char*             ipv6                          = NULL;
    char*             active                        = NULL;
    char*             preference                    = NULL;
    const char*       active_enb[MAX_ENB];
    char*             enb_interface_name_for_S1U    = NULL;
    char*             enb_ipv4_address_for_S1U      = NULL;
540
    libconfig_int     enb_port_for_S1U              = 0;
541 542 543 544 545
    char*             enb_interface_name_for_S1_MME = NULL;
    char*             enb_ipv4_address_for_S1_MME   = NULL;
    char             *address                       = NULL;
    char             *cidr                          = NULL;
    char             *astring                       = NULL;
546 547 548
    libconfig_int     otg_ue_id                     = 0;
    char*             otg_app_type                  = NULL;
    char*             otg_bg_traffic                = NULL;
549 550 551 552 553 554 555 556 557 558 559 560 561 562
    char*             glog_level                    = NULL;
    char*             glog_verbosity                = NULL;
    char*             hw_log_level                  = NULL;
    char*             hw_log_verbosity              = NULL;
    char*             phy_log_level                 = NULL;
    char*             phy_log_verbosity             = NULL;
    char*             mac_log_level                 = NULL;
    char*             mac_log_verbosity             = NULL;
    char*             rlc_log_level                 = NULL;
    char*             rlc_log_verbosity             = NULL;
    char*             pdcp_log_level                = NULL;
    char*             pdcp_log_verbosity            = NULL;
    char*             rrc_log_level                 = NULL;
    char*             rrc_log_verbosity             = NULL;
563 564 565 566
    char*             gtpu_log_level                = NULL;
    char*             gtpu_log_verbosity            = NULL;
    char*             udp_log_level                 = NULL;
    char*             udp_log_verbosity             = NULL;
567 568
    char*             osa_log_level                 = NULL;
    char*             osa_log_verbosity             = NULL;
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588

    memset((char*) (enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
    memset((char*)active_enb,     0 , MAX_ENB * sizeof(char*));

    config_init(&cfg);

    if(lib_config_file_name_pP != NULL)
    {
        /* Read the file. If there is an error, report it and exit. */
        if(! config_read_file(&cfg, lib_config_file_name_pP))
        {
            config_destroy(&cfg);
            AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
        }
    }
    else
    {
        config_destroy(&cfg);
        AssertFatal (0, "No eNB configuration file provided!\n");
    }
589

gauthier's avatar
gauthier committed
590
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
    if(  (config_lookup_string( &cfg, ENB_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
        if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
            asn_debug      = 0;
            asn1_xer_print = 0;
        } else if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) {
            asn_debug      = 1;
            asn1_xer_print = 1;
        } else if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) {
            asn_debug      = 1;
            asn1_xer_print = 2;
        } else {
            asn_debug      = 0;
            asn1_xer_print = 0;
        }
    }
gauthier's avatar
gauthier committed
606
#endif
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
    // Get list of active eNBs, (only these will be configured)
    setting = config_lookup(&cfg, ENB_CONFIG_STRING_ACTIVE_ENBS);
    if(setting != NULL)
    {
        num_enbs = config_setting_length(setting);
        for (i = 0; i < num_enbs; i++) {
            setting_enb   = config_setting_get_elem(setting, i);
            active_enb[i] = config_setting_get_string (setting_enb);
            AssertFatal (active_enb[i] != NULL,
                    "Failed to parse config file %s, %uth attribute %s \n",
                    lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
            active_enb[i] = strdup(active_enb[i]);
            num_enb_properties += 1;
        }
    }

    /* Output a list of all eNBs. */
    setting = config_lookup(&cfg, ENB_CONFIG_STRING_ENB_LIST);
    if(setting != NULL)
    {
        enb_properties_index = 0;
        parse_errors      = 0;
        num_enbs = config_setting_length(setting);
        for (i = 0; i < num_enbs; i++) {
            setting_enb = config_setting_get_elem(setting, i);

            if(! config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id)) {
                /* Calculate a default eNB ID */
635
# if defined(ENABLE_USE_MME)
636
                uint32_t hash;
637

638 639
                hash = s1ap_generate_eNB_id ();
                enb_id = i + (hash & 0xFFFF8);
640
# else
641
                enb_id = i;
642
# endif
643
            }
644

645 646 647 648 649
            if(  !(       config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE,           &cell_type)
                    && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_ENB_NAME,            &enb_name)
                    && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_TRACKING_AREA_CODE,  &tac)
                    && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE, &mcc)
                    && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_NETWORK_CODE, &mnc)
650

651 652

            )
653
            ) {
654 655 656
                AssertError (0, parse_errors ++,
                        "Failed to parse eNB configuration file %s, %u th enb\n",
                        lib_config_file_name_pP, i);
657
                continue; // FIXME this prevents segfaults below, not sure what happens after function exit
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
            }
            // search if in active list
            for (j=0; j < num_enb_properties; j++) {
                if (strcmp(active_enb[j], enb_name) == 0) {
                    enb_properties.properties[enb_properties_index] = calloc(1, sizeof(Enb_properties_t));

                    enb_properties.properties[enb_properties_index]->eNB_id   = enb_id;
                    if (strcmp(cell_type, "CELL_MACRO_ENB") == 0) {
                        enb_properties.properties[enb_properties_index]->cell_type = CELL_MACRO_ENB;
                    } else  if (strcmp(cell_type, "CELL_HOME_ENB") == 0) {
                        enb_properties.properties[enb_properties_index]->cell_type = CELL_HOME_ENB;
                    } else {
                        AssertError (0, parse_errors ++,
                                "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n",
                                lib_config_file_name_pP, i, cell_type);
                    }
                    enb_properties.properties[enb_properties_index]->eNB_name         = strdup(enb_name);
                    enb_properties.properties[enb_properties_index]->tac              = (uint16_t)atoi(tac);
                    enb_properties.properties[enb_properties_index]->mcc              = (uint16_t)atoi(mcc);
                    enb_properties.properties[enb_properties_index]->mnc              = (uint16_t)atoi(mnc);
                    enb_properties.properties[enb_properties_index]->mnc_digit_length = strlen(mnc);
                    AssertFatal((enb_properties.properties[enb_properties_index]->mnc_digit_length == 2) ||
                            (enb_properties.properties[enb_properties_index]->mnc_digit_length == 3),
                            "BAD MNC DIGIT LENGTH %d",
                            enb_properties.properties[i]->mnc_digit_length);


                    // Parse optional physical parameters


                    setting_component_carriers = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_COMPONENT_CARRIERS);
                    enb_properties.properties[enb_properties_index]->nb_cc = 0;
                    if(setting_component_carriers != NULL) {

                        num_component_carriers     = config_setting_length(setting_component_carriers);
                        printf("num component carrier %d \n", num_component_carriers);
                        //enb_properties.properties[enb_properties_index]->nb_cc = num_component_carriers;
                        for (j = 0; j < num_component_carriers /*&& j < MAX_NUM_CCs*/; j++) {
                            component_carrier = config_setting_get_elem(setting_component_carriers, j);

                            //printf("Component carrier %d\n",component_carrier);
                            if(!(config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_FRAME_TYPE, &frame_type)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_TDD_CONFIG, &tdd_config)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_TDD_CONFIG_S, &tdd_config_s)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PREFIX_TYPE, &prefix_type)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_EUTRA_BAND, &eutra_band)
                                    && config_setting_lookup_int64(component_carrier, ENB_CONFIG_STRING_DOWNLINK_FREQUENCY, &downlink_frequency)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, &uplink_frequency_offset)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NID_CELL, &Nid_cell)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_N_RB_DL, &N_RB_DL)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CELL_MBSFN, &Nid_cell_mbsfn)
709 710 711 712
				    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_TX, &nb_antennas_tx)
				    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_RX, &nb_antennas_rx)
				    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_TX_GAIN, &tx_gain)
				    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RX_GAIN, &rx_gain)
713 714 715 716 717 718 719 720
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PRACH_ROOT, &prach_root)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PRACH_CONFIG_INDEX, &prach_config_index)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PRACH_HIGH_SPEED, &prach_high_speed)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PRACH_ZERO_CORRELATION, &prach_zero_correlation)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PRACH_FREQ_OFFSET, &prach_freq_offset)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTA_SHIFT, &pucch_delta_shift)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_NRB_CQI, &pucch_nRB_CQI)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_NCS_AN, &pucch_nCS_AN)
721
#ifndef Rel10 
722
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_N1_AN, &pucch_n1_AN)
723
#endif
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PDSCH_RS_EPRE, &pdsch_referenceSignalPower)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PDSCH_PB, &pdsch_p_b)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUSCH_N_SB, &pusch_n_SB)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE, &pusch_hoppingMode)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUSCH_HOPPINGOFFSET, &pusch_hoppingOffset)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM, &pusch_enable64QAM)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN, &pusch_groupHoppingEnabled)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUSCH_GROUP_ASSIGNMENT, &pusch_groupAssignment)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN, &pusch_sequenceHoppingEnabled)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUSCH_NDMRS1, &pusch_nDMRS1)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PHICH_DURATION, &phich_duration)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PHICH_RESOURCE, &phich_resource)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_SRS_ENABLE, &srs_enable)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUSCH_PO_NOMINAL, &pusch_p0_Nominal)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUSCH_ALPHA, &pusch_alpha)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_PO_NOMINAL, &pucch_p0_Nominal)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_MSG3_DELTA_PREAMBLE, &msg3_delta_Preamble)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT1, &pucch_deltaF_Format1)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT1b, &pucch_deltaF_Format1b)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2, &pucch_deltaF_Format2)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2A, &pucch_deltaF_Format2a)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PUCCH_DELTAF_FORMAT2B, &pucch_deltaF_Format2b)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_NUM_RA_PREAMBLES, &rach_numberOfRA_Preambles)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_RACH_PREAMBLESGROUPACONFIG, &rach_preamblesGroupAConfig)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_POWERRAMPINGSTEP, &rach_powerRampingStep)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_PREAMBLEINITIALRECEIVEDTARGETPOWER, &rach_preambleInitialReceivedTargetPower)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_PREAMBLETRANSMAX, &rach_preambleTransMax)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_RARESPONSEWINDOWSIZE, &rach_raResponseWindowSize)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_MACCONTENTIONRESOLUTIONTIMER, &rach_macContentionResolutionTimer)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_MAXHARQMSG3TX, &rach_maxHARQ_Msg3Tx)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_MAXHARQMSG3TX, &bcch_modificationPeriodCoeff)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PCCH_DEFAULT_PAGING_CYCLE,  &pcch_defaultPagingCycle)
                                    && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_PCCH_NB,  &pcch_nB)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_BCCH_MODIFICATIONPERIODCOEFF,  &bcch_modificationPeriodCoeff)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T300,  &ue_TimersAndConstants_t300)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T301,  &ue_TimersAndConstants_t301)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T310,  &ue_TimersAndConstants_t310)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T311,  &ue_TimersAndConstants_t311)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N310,  &ue_TimersAndConstants_n310)
                                    && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N311,  &ue_TimersAndConstants_n311)

765 766 767
#ifdef Rel10 

#endif			   
768 769 770 771
                            )){
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, Component Carrier %d!\n",
                                        lib_config_file_name_pP, enb_properties.properties[enb_properties_index]->nb_cc++);
772
                                continue; // FIXME this prevents segfaults below, not sure what happens after function exit
773 774 775 776 777
                            }
                            enb_properties.properties[enb_properties_index]->nb_cc++;

                            enb_properties.properties[enb_properties_index]->tdd_config[j] = tdd_config;
                            AssertError (tdd_config <= TDD_Config__subframeAssignment_sa6, parse_errors ++,
thomasl's avatar
thomasl committed
778
                                    "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
779 780 781 782
                                    lib_config_file_name_pP, i, tdd_config, TDD_Config__subframeAssignment_sa6);

                            enb_properties.properties[enb_properties_index]->tdd_config_s[j] = tdd_config_s;
                            AssertError (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, parse_errors ++,
thomasl's avatar
thomasl committed
783
                                    "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823
                                    lib_config_file_name_pP, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);

                            if (strcmp(prefix_type, "NORMAL") == 0) {
                                enb_properties.properties[enb_properties_index]->prefix_type[j] = NORMAL;
                            } else  if (strcmp(prefix_type, "EXTENDED") == 0) {
                                enb_properties.properties[enb_properties_index]->prefix_type[j] = EXTENDED;
                            } else {
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n",
                                        lib_config_file_name_pP, i, prefix_type);
                            }
                            enb_properties.properties[enb_properties_index]->eutra_band[j] = eutra_band;
                            enb_properties.properties[enb_properties_index]->downlink_frequency[j] = (uint32_t) downlink_frequency;
                            enb_properties.properties[enb_properties_index]->uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset;
                            enb_properties.properties[enb_properties_index]->Nid_cell[j]= Nid_cell;
                            if (Nid_cell>503) {
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n",
                                        lib_config_file_name_pP, i, Nid_cell);
                            }
                            enb_properties.properties[enb_properties_index]->N_RB_DL[j]= N_RB_DL;
                            if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) {
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n",
                                        lib_config_file_name_pP, i, N_RB_DL);
                            }

                            if (strcmp(frame_type, "FDD") == 0) {
                                enb_properties.properties[enb_properties_index]->frame_type[j] = FDD;
                            } else  if (strcmp(frame_type, "TDD") == 0) {
                                enb_properties.properties[enb_properties_index]->frame_type[j] = TDD;
                            } else {
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n",
                                        lib_config_file_name_pP, i, frame_type);
                            }


                            enb_properties.properties[enb_properties_index]->tdd_config[j] = tdd_config;
                            AssertError (tdd_config <= TDD_Config__subframeAssignment_sa6, parse_errors ++,
thomasl's avatar
thomasl committed
824
                                    "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
825 826 827 828 829
                                    lib_config_file_name_pP, i, tdd_config, TDD_Config__subframeAssignment_sa6);


                            enb_properties.properties[enb_properties_index]->tdd_config_s[j] = tdd_config_s;
                            AssertError (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, parse_errors ++,
thomasl's avatar
thomasl committed
830
                                    "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
831 832 833 834
                                    lib_config_file_name_pP, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);



835 836 837 838 839
                            if (!prefix_type)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PREFIX_TYPE);
                            else if (strcmp(prefix_type, "NORMAL") == 0) {
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
                                enb_properties.properties[enb_properties_index]->prefix_type[j] = NORMAL;
                            } else  if (strcmp(prefix_type, "EXTENDED") == 0) {
                                enb_properties.properties[enb_properties_index]->prefix_type[j] = EXTENDED;
                            } else {
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n",
                                        lib_config_file_name_pP, i, prefix_type);
                            }



                            enb_properties.properties[enb_properties_index]->eutra_band[j] = eutra_band;
                            // printf( "\teutra band:\t%d\n",enb_properties.properties[enb_properties_index]->eutra_band);



                            enb_properties.properties[enb_properties_index]->downlink_frequency[j] = (uint32_t) downlink_frequency;
                            //printf( "\tdownlink freq:\t%u\n",enb_properties.properties[enb_properties_index]->downlink_frequency);


                            enb_properties.properties[enb_properties_index]->uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset;

                            parse_errors += enb_check_band_frequencies(lib_config_file_name_pP,
                                    enb_properties_index,
                                    enb_properties.properties[enb_properties_index]->eutra_band[j],
                                    enb_properties.properties[enb_properties_index]->downlink_frequency[j],
                                    enb_properties.properties[enb_properties_index]->uplink_frequency_offset[j],
                                    enb_properties.properties[enb_properties_index]->frame_type[j]);

                            enb_properties.properties[enb_properties_index]->nb_antennas_tx[j] = nb_antennas_tx;
                            if ((nb_antennas_tx <1) || (nb_antennas_tx > 4))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..4 !\n",
                                        lib_config_file_name_pP, i, nb_antennas_tx);

                            enb_properties.properties[enb_properties_index]->nb_antennas_rx[j] = nb_antennas_rx;
                            if ((nb_antennas_rx <1) || (nb_antennas_rx > 4))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_rx choice: 1..4 !\n",
                                        lib_config_file_name_pP, i, nb_antennas_rx);

knopp's avatar
knopp committed
881
                            enb_properties.properties[enb_properties_index]->tx_gain[j] = tx_gain;
nikaeinn's avatar
nikaeinn committed
882
                            if ((tx_gain <0) || (tx_gain > 127))
knopp's avatar
knopp committed
883 884 885 886 887 888 889
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for tx_gain choice: 0..127 !\n",
                                        lib_config_file_name_pP, i, tx_gain);

                            enb_properties.properties[enb_properties_index]->rx_gain[j] = rx_gain;
                            if ((rx_gain <0) || (rx_gain > 160))
                                AssertError (0, parse_errors ++,
Florian Kaltenberger's avatar
Florian Kaltenberger committed
890
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rx_gain choice: 0..160 !\n",
knopp's avatar
knopp committed
891 892
                                        lib_config_file_name_pP, i, rx_gain);

893 894 895 896 897 898 899 900 901 902 903 904
                            enb_properties.properties[enb_properties_index]->prach_root[j] =  prach_root;
                            if ((prach_root <0) || (prach_root > 1023))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n",
                                        lib_config_file_name_pP, i, prach_root);

                            enb_properties.properties[enb_properties_index]->prach_config_index[j] = prach_config_index;
                            if ((prach_config_index <0) || (prach_config_index > 63))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n",
                                        lib_config_file_name_pP, i, prach_config_index);

905 906 907 908 909
                            if (!prach_high_speed)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED);
                            else if (strcmp(prach_high_speed, "ENABLE") == 0)
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945
                                enb_properties.properties[enb_properties_index]->prach_high_speed[j] = TRUE;
                            else if (strcmp(prach_high_speed, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->prach_high_speed[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n",
                                        lib_config_file_name_pP, i, prach_high_speed);
                            enb_properties.properties[enb_properties_index]->prach_zero_correlation[j] =prach_zero_correlation;
                            if ((prach_zero_correlation <0) || (prach_zero_correlation > 63))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n",
                                        lib_config_file_name_pP, i, prach_zero_correlation);

                            enb_properties.properties[enb_properties_index]->prach_freq_offset[j] = prach_freq_offset;
                            if ((prach_freq_offset <0) || (prach_freq_offset > 94))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n",
                                        lib_config_file_name_pP, i, prach_freq_offset);


                            enb_properties.properties[enb_properties_index]->pucch_delta_shift[j] = pucch_delta_shift-1;
                            if ((pucch_delta_shift <1) || (pucch_delta_shift > 3))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n",
                                        lib_config_file_name_pP, i, pucch_delta_shift);

                            enb_properties.properties[enb_properties_index]->pucch_nRB_CQI[j] = pucch_nRB_CQI;
                            if ((pucch_nRB_CQI <0) || (pucch_nRB_CQI > 98))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n",
                                        lib_config_file_name_pP, i, pucch_nRB_CQI);
                            enb_properties.properties[enb_properties_index]->pucch_nCS_AN[j] = pucch_nCS_AN;
                            if ((pucch_nCS_AN <0) || (pucch_nCS_AN > 7))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n",
                                        lib_config_file_name_pP, i, pucch_nCS_AN);
946
#ifndef Rel10
947
                            enb_properties.properties[enb_properties_index]->pucch_n1_AN[j] = pucch_n1_AN;
948

949 950 951 952
                            if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n",
                                        lib_config_file_name_pP, i, pucch_n1_AN);
953
#endif
954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
                            enb_properties.properties[enb_properties_index]->pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower;
                            if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n",
                                        lib_config_file_name_pP, i, pdsch_referenceSignalPower);

                            enb_properties.properties[enb_properties_index]->pdsch_p_b[j] = pdsch_p_b;
                            if ((pdsch_p_b <0) || (pdsch_p_b > 3))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n",
                                        lib_config_file_name_pP, i, pdsch_p_b);

                            enb_properties.properties[enb_properties_index]->pusch_n_SB[j] = pusch_n_SB;
                            if ((pusch_n_SB <1) || (pusch_n_SB > 4))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n",
                                        lib_config_file_name_pP, i, pusch_n_SB);
971 972 973 974 975 976

                            if (!pusch_hoppingMode)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE);
                            else if (strcmp(pusch_hoppingMode,"interSubFrame")==0)
knopp's avatar
knopp committed
977
                                enb_properties.properties[enb_properties_index]->pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame;
978
                            else if (strcmp(pusch_hoppingMode,"intraAndInterSubFrame")==0)
knopp's avatar
knopp committed
979
                                enb_properties.properties[enb_properties_index]->pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame;
980 981 982 983 984 985 986 987
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n",
                                        lib_config_file_name_pP, i, pusch_hoppingMode);
                            enb_properties.properties[enb_properties_index]->pusch_hoppingOffset[j] = pusch_hoppingOffset;

                            if ((pusch_hoppingOffset<0) || (pusch_hoppingOffset>98))
                                AssertError (0, parse_errors ++,
thomasl's avatar
thomasl committed
988
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n",
989 990
                                        lib_config_file_name_pP, i, pusch_hoppingMode);

991 992 993 994 995
                            if (!pusch_enable64QAM)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM);
                            else if (strcmp(pusch_enable64QAM, "ENABLE") == 0)
996 997 998 999 1000 1001 1002 1003
                                enb_properties.properties[enb_properties_index]->pusch_enable64QAM[j] = TRUE;
                            else if (strcmp(pusch_enable64QAM, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->pusch_enable64QAM[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, pusch_enable64QAM);

1004 1005 1006 1007 1008
                            if (!pusch_groupHoppingEnabled)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN);
                            else if (strcmp(pusch_groupHoppingEnabled, "ENABLE") == 0)
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
                                enb_properties.properties[enb_properties_index]->pusch_groupHoppingEnabled[j] = TRUE;
                            else if (strcmp(pusch_groupHoppingEnabled, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->pusch_groupHoppingEnabled[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, pusch_groupHoppingEnabled);


                            enb_properties.properties[enb_properties_index]->pusch_groupAssignment[j] = pusch_groupAssignment;
                            if ((pusch_groupAssignment<0)||(pusch_groupAssignment>29))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n",
                                        lib_config_file_name_pP, i, pusch_groupAssignment);

1024 1025 1026 1027 1028
                            if (!pusch_sequenceHoppingEnabled)
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN);
                            else if (strcmp(pusch_sequenceHoppingEnabled, "ENABLE") == 0)
Florian Kaltenberger's avatar
Florian Kaltenberger committed
1029
                                enb_properties.properties[enb_properties_index]->pusch_sequenceHoppingEnabled[j] = TRUE;
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
                            else if (strcmp(pusch_sequenceHoppingEnabled, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->pusch_sequenceHoppingEnabled[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n",
                                        lib_config_file_name_pP, i, pusch_sequenceHoppingEnabled);

                            enb_properties.properties[enb_properties_index]->pusch_nDMRS1[j] = pusch_nDMRS1;  //cyclic_shift in RRC!
                            if ((pusch_nDMRS1 <0) || (pusch_nDMRS1>7))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n",
                                        lib_config_file_name_pP, i, pusch_nDMRS1);

                            if (strcmp(phich_duration,"NORMAL")==0)
                                enb_properties.properties[enb_properties_index]->phich_duration[j] = normal;
                            else if (strcmp(phich_duration,"EXTENDED")==0)
                                enb_properties.properties[enb_properties_index]->phich_duration[j] = extended;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n",
                                        lib_config_file_name_pP, i, phich_duration);

                            if (strcmp(phich_resource,"ONESIXTH")==0)
                                enb_properties.properties[enb_properties_index]->phich_resource[j] = oneSixth;
                            else if (strcmp(phich_duration,"HALF")==0)
                                enb_properties.properties[enb_properties_index]->phich_resource[j] = half;
                            else if (strcmp(phich_duration,"ONE")==0)
                                enb_properties.properties[enb_properties_index]->phich_resource[j] = one;
                            else if (strcmp(phich_duration,"TWO")==0)
                                enb_properties.properties[enb_properties_index]->phich_resource[j] = two;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n",
                                        lib_config_file_name_pP, i, phich_resource);

                            if (strcmp(srs_enable, "ENABLE") == 0)
                                enb_properties.properties[enb_properties_index]->srs_enable[j] = TRUE;
                            else if (strcmp(srs_enable, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->srs_enable[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n",
                                        lib_config_file_name_pP, i, srs_enable);
                            if (enb_properties.properties[enb_properties_index]->srs_enable[j] == TRUE) {
                                if (!(config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_SRS_BANDWIDTH_CONFIG, &srs_BandwidthConfig)
                                        && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_SRS_SUBFRAME_CONFIG, &srs_SubframeConfig)
                                        && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_SRS_ACKNACKST_CONFIG, &srs_ackNackST)
                                        && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_SRS_MAXUPPTS, &srs_MaxUpPts)
                                ))
                                    AssertError(0, parse_errors++,"Failed to parse eNB configuration file %s, enb %d unknown values for srs_BandwidthConfig, srs_SubframeConfig, srs_ackNackST, srs_MaxUpPts\n",
nikaeinn's avatar
nikaeinn committed
1080 1081
						//            lib_config_file_name_pP, i, srs_BandwidthConfig);
						lib_config_file_name_pP, i);
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118

                                enb_properties.properties[enb_properties_index]->srs_BandwidthConfig[j] = srs_BandwidthConfig;
                                if ((srs_BandwidthConfig < 0) || (srs_BandwidthConfig >7))
                                    AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value %d for srs_BandwidthConfig choice: 0...7\n",
                                            lib_config_file_name_pP, i, srs_BandwidthConfig);
                                enb_properties.properties[enb_properties_index]->srs_SubframeConfig[j] = srs_SubframeConfig;
                                if ((srs_SubframeConfig<0) || (srs_SubframeConfig>15))
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for srs_SubframeConfig choice: 0..15 !\n",
                                            lib_config_file_name_pP, i, srs_SubframeConfig);

                                if (strcmp(srs_ackNackST, "ENABLE") == 0)
                                    enb_properties.properties[enb_properties_index]->srs_ackNackST[j] = TRUE;
                                else if (strcmp(srs_ackNackST, "DISABLE") == 0)
                                    enb_properties.properties[enb_properties_index]->srs_ackNackST[j] = FALSE;
                                else
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n",
                                            lib_config_file_name_pP, i, srs_ackNackST);

                                if (strcmp(srs_MaxUpPts, "ENABLE") == 0)
                                    enb_properties.properties[enb_properties_index]->srs_MaxUpPts[j] = TRUE;
                                else if (strcmp(srs_MaxUpPts, "DISABLE") == 0)
                                    enb_properties.properties[enb_properties_index]->srs_MaxUpPts[j] = FALSE;
                                else
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n",
                                            lib_config_file_name_pP, i, srs_MaxUpPts);
                            }

                            enb_properties.properties[enb_properties_index]->pusch_p0_Nominal[j] = pusch_p0_Nominal;

                            if ((pusch_p0_Nominal<-126) || (pusch_p0_Nominal>24))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n",
                                        lib_config_file_name_pP, i, pusch_p0_Nominal);

knopp's avatar
knopp committed
1119
                            if (strcmp(pusch_alpha,"AL0")==0)
1120
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al0;
knopp's avatar
knopp committed
1121
                            else if (strcmp(pusch_alpha,"AL04")==0)
1122
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al04;
knopp's avatar
knopp committed
1123
                            else if (strcmp(pusch_alpha,"AL05")==0)
1124
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al05;
knopp's avatar
knopp committed
1125
                            else if (strcmp(pusch_alpha,"AL06")==0)
1126
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al06;
knopp's avatar
knopp committed
1127
                            else if (strcmp(pusch_alpha,"AL07")==0)
1128
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al07;
knopp's avatar
knopp committed
1129
                            else if (strcmp(pusch_alpha,"AL08")==0)
1130
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al08;
knopp's avatar
knopp committed
1131
                            else if (strcmp(pusch_alpha,"AL09")==0)
1132
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al09;
knopp's avatar
knopp committed
1133
                            else if (strcmp(pusch_alpha,"AL1")==0)
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167
                                enb_properties.properties[enb_properties_index]->pusch_alpha[j] = UplinkPowerControlCommon__alpha_al1;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_p0_Nominal choice: AL0,AL04,AL05,AL06,AL07,AL08,AL09,AL1!\n",
                                        lib_config_file_name_pP, i, pusch_alpha);

                            enb_properties.properties[enb_properties_index]->pucch_p0_Nominal[j] = pucch_p0_Nominal;
                            if ((pucch_p0_Nominal<-127) || (pucch_p0_Nominal>-96))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n",
                                        lib_config_file_name_pP, i, pucch_p0_Nominal);

                            enb_properties.properties[enb_properties_index]->msg3_delta_Preamble[j] = msg3_delta_Preamble;
                            if ((msg3_delta_Preamble<-1) || (msg3_delta_Preamble>6))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n",
                                        lib_config_file_name_pP, i, msg3_delta_Preamble);


                            if (strcmp(pucch_deltaF_Format1,"deltaF_2")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2;
                            else if (strcmp(pucch_deltaF_Format1,"deltaF0")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF0;
                            else if (strcmp(pucch_deltaF_Format1,"deltaF2")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1 choice: deltaF_2,dltaF0,deltaF2!\n",
                                        lib_config_file_name_pP, i, pucch_deltaF_Format1);

                            if (strcmp(pucch_deltaF_Format1b,"deltaF1")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF1;
                            else if (strcmp(pucch_deltaF_Format1b,"deltaF3")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3;
knopp's avatar
knopp committed
1168
                            else if (strcmp(pucch_deltaF_Format1b,"deltaF5")==0)
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF5;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1b choice: deltaF1,dltaF3,deltaF5!\n",
                                        lib_config_file_name_pP, i, pucch_deltaF_Format1b);


                            if (strcmp(pucch_deltaF_Format2,"deltaF_2")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF_2;
                            else if (strcmp(pucch_deltaF_Format2,"deltaF0")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0;
knopp's avatar
knopp committed
1180
                            else if (strcmp(pucch_deltaF_Format2,"deltaF1")==0)
1181
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF1;
knopp's avatar
knopp committed
1182
                            else if (strcmp(pucch_deltaF_Format2,"deltaF2")==0)
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF2;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2 choice: deltaF_2,dltaF0,deltaF1,deltaF2!\n",
                                        lib_config_file_name_pP, i, pucch_deltaF_Format2);


                            if (strcmp(pucch_deltaF_Format2a,"deltaF_2")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF_2;
                            else if (strcmp(pucch_deltaF_Format2a,"deltaF0")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0;
knopp's avatar
knopp committed
1194
                            else if (strcmp(pucch_deltaF_Format2a,"deltaF2")==0)
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF2;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2a choice: deltaF_2,dltaF0,deltaF2!\n",
                                        lib_config_file_name_pP, i, pucch_deltaF_Format2a);

                            if (strcmp(pucch_deltaF_Format2b,"deltaF_2")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF_2;
                            else if (strcmp(pucch_deltaF_Format2b,"deltaF0")==0)
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;
knopp's avatar
knopp committed
1205
                            else if (strcmp(pucch_deltaF_Format2b,"deltaF2")==0)
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
                                enb_properties.properties[enb_properties_index]->pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n",
                                        lib_config_file_name_pP, i, pucch_deltaF_Format2b);




                            enb_properties.properties[enb_properties_index]->rach_numberOfRA_Preambles[j] = (rach_numberOfRA_Preambles/4)-1;
                            if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>64) || ((rach_numberOfRA_Preambles&3)!=0))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_numberOfRA_Preambles choice: 4,8,12,...,64!\n",
                                        lib_config_file_name_pP, i, rach_numberOfRA_Preambles);

                            if (strcmp(rach_preamblesGroupAConfig, "ENABLE") == 0) {
                                enb_properties.properties[enb_properties_index]->rach_preamblesGroupAConfig[j] = TRUE;

                                if (!(config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_SIZEOFRA_PREAMBLESGROUPA, &rach_sizeOfRA_PreamblesGroupA)
                                        && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_RACH_MESSAGESIZEGROUPA, &rach_messageSizeGroupA)
                                        && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB, &rach_messagePowerOffsetGroupB)))
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d  rach_sizeOfRA_PreamblesGroupA, messageSizeGroupA,messagePowerOffsetGroupB!\n",
nikaeinn's avatar
nikaeinn committed
1229 1230
						 //            lib_config_file_name_pP, i, pucch_deltaF_Format2b);
						 lib_config_file_name_pP, i);
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405

                                enb_properties.properties[enb_properties_index]->rach_sizeOfRA_PreamblesGroupA[j] = (rach_sizeOfRA_PreamblesGroupA/4)-1;
                                if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>60) || ((rach_numberOfRA_Preambles&3)!=0))
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_sizeOfRA_PreamblesGroupA choice: 4,8,12,...,60!\n",
                                            lib_config_file_name_pP, i, rach_sizeOfRA_PreamblesGroupA);


                                switch (rach_messageSizeGroupA) {
                                    case 56:
                                        enb_properties.properties[enb_properties_index]->rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b56;
                                        break;
                                    case 144:
                                        enb_properties.properties[enb_properties_index]->rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b144;break;
                                    case 208:
                                        enb_properties.properties[enb_properties_index]->rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b208;break;
                                    case 256:
                                        enb_properties.properties[enb_properties_index]->rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b256;break;
                                    default:
                                        AssertError (0, parse_errors ++,
                                                "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_messageSizeGroupA choice: 56,144,208,256!\n",
                                                lib_config_file_name_pP, i, rach_messageSizeGroupA);
                                        break;
                                }

                                if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_minusinfinity;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB0")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB0;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB5")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB5;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB8")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB8;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB10")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB10;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB12")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB12;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB15")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB15;
                                else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0)
                                    enb_properties.properties[enb_properties_index]->rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18;
                                else
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n",
                                            lib_config_file_name_pP, i, rach_messagePowerOffsetGroupB);

                            }
                            else if (strcmp(rach_preamblesGroupAConfig, "DISABLE") == 0)
                                enb_properties.properties[enb_properties_index]->rach_preamblesGroupAConfig[j] = FALSE;
                            else
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_preamblesGroupAConfig choice: ENABLE,DISABLE !\n",
                                        lib_config_file_name_pP, i, rach_preamblesGroupAConfig);

                            enb_properties.properties[enb_properties_index]->rach_preambleInitialReceivedTargetPower[j] = (rach_preambleInitialReceivedTargetPower+120)/2;
                            if ((rach_preambleInitialReceivedTargetPower<-120) || (rach_preambleInitialReceivedTargetPower>-90) || ((rach_preambleInitialReceivedTargetPower&1)!=0))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleInitialReceivedTargetPower choice: -120,-118,...,-90 !\n",
                                        lib_config_file_name_pP, i, rach_preambleInitialReceivedTargetPower);


                            enb_properties.properties[enb_properties_index]->rach_powerRampingStep[j] = rach_powerRampingStep/2;
                            if ((rach_powerRampingStep<0) || (rach_powerRampingStep>6) || ((rach_powerRampingStep&1)!=0))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_powerRampingStep choice: 0,2,4,6 !\n",
                                        lib_config_file_name_pP, i, rach_powerRampingStep);



                            switch (rach_preambleTransMax) {
                                case 3:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3;
                                    break;
                                case 4:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4;
                                    break;
                                case 5:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5;
                                    break;
                                case 6:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6;
                                    break;
                                case 7:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7;
                                    break;
                                case 8:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8;
                                    break;
                                case 10:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10;
                                    break;
                                case 20:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20;
                                    break;
                                case 50:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50;
                                    break;
                                case 100:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100;
                                    break;
                                case 200:
                                    enb_properties.properties[enb_properties_index]->rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200;
                                    break;
                                default:
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200!\n",
                                            lib_config_file_name_pP, i, rach_preambleTransMax);
                                    break;
                            }
                            enb_properties.properties[enb_properties_index]->rach_raResponseWindowSize[j] =  (rach_raResponseWindowSize==10)?7:rach_raResponseWindowSize-2;
                            if ((rach_raResponseWindowSize<0)||(rach_raResponseWindowSize==9)||(rach_raResponseWindowSize>10))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_raResponseWindowSize choice: 2,3,4,5,6,7,8,10!\n",
                                        lib_config_file_name_pP, i, rach_preambleTransMax);


                            enb_properties.properties[enb_properties_index]->rach_macContentionResolutionTimer[j] = (rach_macContentionResolutionTimer/8)-1;
                            if ((rach_macContentionResolutionTimer<8) || (rach_macContentionResolutionTimer>64) || ((rach_macContentionResolutionTimer&7)!=0))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_macContentionResolutionTimer choice: 8,16,...,56,64!\n",
                                        lib_config_file_name_pP, i, rach_preambleTransMax);

                            enb_properties.properties[enb_properties_index]->rach_maxHARQ_Msg3Tx[j] = rach_maxHARQ_Msg3Tx;
                            if ((rach_maxHARQ_Msg3Tx<0) || (rach_maxHARQ_Msg3Tx>8))
                                AssertError (0, parse_errors ++,
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n",
                                        lib_config_file_name_pP, i, rach_preambleTransMax);


                            switch (pcch_defaultPagingCycle) {
                                case 32:
                                    enb_properties.properties[enb_properties_index]->pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf32;
                                    break;
                                case 64:
                                    enb_properties.properties[enb_properties_index]->pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf64;
                                    break;
                                case 128:
                                    enb_properties.properties[enb_properties_index]->pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf128;
                                    break;
                                case 256:
                                    enb_properties.properties[enb_properties_index]->pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf256;
                                    break;
                                default:
                                    AssertError (0, parse_errors ++,
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_defaultPagingCycle choice: 32,64,128,256!\n",
                                            lib_config_file_name_pP, i, pcch_defaultPagingCycle);
                                    break;
                            }

                            if (strcmp(pcch_nB, "fourT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_fourT;
                            }
                            else if (strcmp(pcch_nB, "twoT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_twoT;
                            }
                            else if (strcmp(pcch_nB, "oneT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_oneT;
                            }
                            else if (strcmp(pcch_nB, "halfT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_halfT;
                            }
                            else if (strcmp(pcch_nB, "quarterT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_quarterT;
                            }
                            else if (strcmp(pcch_nB, "oneEighthT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_oneEighthT;
                            }
                            else if (strcmp(pcch_nB, "oneSixteenthT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_oneSixteenthT;
                            }
                            else if (strcmp(pcch_nB, "oneThirtySecondT") == 0) {
                                enb_properties.properties[enb_properties_index]->pcch_nB[j] = PCCH_Config__nB_oneThirtySecondT;
                            }
                            else
                                AssertError (0, parse_errors ++,
thomasl's avatar
thomasl committed
1406
                                        "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_nB choice: fourT,twoT,oneT,halfT,quarterT,oneighthT,oneSixteenthT,oneThirtySecondT !\n",
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
                                        lib_config_file_name_pP, i, pcch_defaultPagingCycle);



                            switch (bcch_modificationPeriodCoeff) {
                                case 2:
                                    enb_properties.properties[enb_properties_index]->bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n2;
                                    break;
                                case 4:
                                    enb_properties.properties[enb_properties_index]->bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n4;
                                    break;
                                case 8:
                                    enb_properties.properties[enb_properties_index]->bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n8;
                                    break;
                                case 16:
                                    enb_properties.properties[enb_properties_index]->bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n16;
                                    break;
                                default:
                                    AssertError (0, parse_errors ++,
thomasl's avatar
thomasl committed
1426
                                            "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for bcch_modificationPeriodCoeff choice: 2,4,8,16",
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459
                                            lib_config_file_name_pP, i, bcch_modificationPeriodCoeff);

                                    break;
                            }


                            switch (ue_TimersAndConstants_t300) {
                                case 100:
                                    enb_properties.properties[enb_properties_index]->ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms100;
                                    break;
                                case 200:
                                    enb_properties.properties[