enb_config.c 163 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
nikaeinn's avatar
nikaeinn committed
21

gauthier's avatar
gauthier committed
22 23 24
/*
                                enb_config.c
                             -------------------
25
  AUTHOR  : Lionel GAUTHIER, navid nikaein, Laurent Winckel
gauthier's avatar
gauthier committed
26
  COMPANY : EURECOM
27
  EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
28
 */
29 30 31

#include <string.h>
#include <libconfig.h>
32
#include <inttypes.h>
33

34
#include "log.h"
35
#include "log_extern.h"
36 37
#include "assertions.h"
#include "enb_config.h"
38 39
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
winckel's avatar
winckel committed
40 41 42 43
#if defined(OAI_EMU)
# include "OCG.h"
# include "OCG_extern.h"
#endif
44 45 46 47 48 49 50
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
# if defined(ENABLE_USE_MME)
#   include "s1ap_eNB.h"
#   include "sctp_eNB_task.h"
# endif
#endif
51
#include "sctp_default_values.h"
52
#include "SystemInformationBlockType2.h"
53
#include "LAYER2/MAC/extern.h"
54
#include "PHY/extern.h"
55

56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
/* those macros are here to help diagnose problems in configuration files
 * if the lookup fails, a warning is printed
 * (yes we can use the function name for the macro itself, the C preprocessor
 * won't die in an infinite loop)
 */
#define config_setting_lookup_int(setting, name, value) \
    (config_setting_lookup_int(setting, name, value) || \
    (printf("WARNING: setting '%s' not found in configuration file\n", name), 0))
#define config_setting_lookup_int64(setting, name, value) \
    (config_setting_lookup_int64(setting, name, value) || \
    (printf("WARNING: setting '%s' not found in configuration file\n", name), 0))
#define config_setting_lookup_float(setting, name, value) \
    (config_setting_lookup_float(setting, name, value) || \
    (printf("WARNING: setting '%s' not found in configuration file\n", name), 0))
#define config_setting_lookup_bool(setting, name, value) \
    (config_setting_lookup_bool(setting, name, value) || \
    (printf("WARNING: setting '%s' not found in configuration file\n", name), 0))
#define config_setting_lookup_string(setting, name, value) \
    (config_setting_lookup_string(setting, name, value) || \
    (printf("WARNING: setting '%s' not found in configuration file\n", name), 0))

77 78 79 80 81 82 83 84 85 86 87
#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"

88
#define ENB_CONFIG_STRING_COMPONENT_CARRIERS                            "component_carriers"
89

90
#define ENB_CONFIG_STRING_CC_NODE_FUNCTION                              "node_function"
Sandeep Kumar's avatar
Sandeep Kumar committed
91 92
#define ENB_CONFIG_STRING_CC_NODE_TIMING                                "node_timing"   
#define ENB_CONFIG_STRING_CC_NODE_SYNCH_REF                             "node_synch_ref"   
93

94 95 96 97 98 99 100
#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"
101

102 103
#define ENB_CONFIG_STRING_NID_CELL                                      "Nid_cell"
#define ENB_CONFIG_STRING_N_RB_DL                                       "N_RB_DL"
104
#define ENB_CONFIG_STRING_CELL_MBSFN                                  "Nid_cell_mbsfn"
105
#define ENB_CONFIG_STRING_NB_ANT_PORTS                              "nb_antenna_ports"
106 107 108 109 110 111 112 113 114 115 116 117
#define ENB_CONFIG_STRING_NB_ANT_TX                                 "nb_antennas_tx"
#define ENB_CONFIG_STRING_NB_ANT_RX                                 "nb_antennas_rx"
#define ENB_CONFIG_STRING_TX_GAIN                                       "tx_gain"
#define ENB_CONFIG_STRING_RX_GAIN                                       "rx_gain"
#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"
Cedric Roux's avatar
Cedric Roux committed
118
#if !defined(Rel10) && !defined(Rel14)
119
#define ENB_CONFIG_STRING_PUCCH_N1_AN                                 "pucch_n1_AN"
120
#endif
121 122 123
#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"
124 125
#define ENB_CONFIG_STRING_PUSCH_HOPPINGMODE                             "pusch_hoppingMode"
#define ENB_CONFIG_STRING_PUSCH_HOPPINGOFFSET                           "pusch_hoppingOffset"
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
#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"
149
#define ENB_CONFIG_STRING_RACH_SIZEOFRA_PREAMBLESGROUPA                 "rach_sizeOfRA_PreamblesGroupA"
150
#define ENB_CONFIG_STRING_RACH_MESSAGESIZEGROUPA                        "rach_messageSizeGroupA"
151
#define ENB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB                 "rach_messagePowerOffsetGroupB"
152 153 154 155 156 157
#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"
158 159 160 161 162 163 164 165 166
#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"
167
#define ENB_CONFIG_STRING_UE_TRANSMISSION_MODE                          "ue_TransmissionMode"
168

169 170 171 172 173 174 175
#define ENB_CONFIG_STRING_SRB1                                          "srb1_parameters"
#define ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT                    "timer_poll_retransmit"
#define ENB_CONFIG_STRING_SRB1_TIMER_REORDERING                         "timer_reordering"
#define ENB_CONFIG_STRING_SRB1_TIMER_STATUS_PROHIBIT                    "timer_status_prohibit"
#define ENB_CONFIG_STRING_SRB1_POLL_PDU                                 "poll_pdu"
#define ENB_CONFIG_STRING_SRB1_POLL_BYTE                                "poll_byte"
#define ENB_CONFIG_STRING_SRB1_MAX_RETX_THRESHOLD                       "max_retx_threshold"
176 177 178 179 180 181
#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"

182 183 184 185
#define ENB_CONFIG_STRING_SCTP_CONFIG                    "SCTP"
#define ENB_CONFIG_STRING_SCTP_INSTREAMS                 "SCTP_INSTREAMS"
#define ENB_CONFIG_STRING_SCTP_OUTSTREAMS                "SCTP_OUTSTREAMS"

186 187 188 189 190
#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"
191
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U              "ENB_PORT_FOR_S1U"
192

193
#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG     "NETWORK_CONTROLLER"
194 195 196 197
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME      "FLEXRAN_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS        "FLEXRAN_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT                "FLEXRAN_AGENT_PORT"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE               "FLEXRAN_AGENT_CACHE"
198

199 200 201 202 203 204
#define ENB_CONFIG_STRING_RRH_GW_CONFIG                   "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME            "local_if_name"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS            "local_address"
#define ENB_CONFIG_STRING_RRH_GW_REMOTE_ADDRESS           "remote_address"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT               "local_port"
#define ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT              "remote_port"
205
#define ENB_CONFIG_STRING_RRH_GW_ACTIVE                   "rrh_gw_active"
206 207 208 209 210
#define ENB_CONFIG_STRING_RRH_GW_TRANSPORT_PREFERENCE     "tr_preference"
#define ENB_CONFIG_STRING_RRH_GW_RF_TARGET_PREFERENCE     "rf_preference"
#define ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT               "iq_txshift"
#define ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE        "tx_sample_advance"
#define ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE    "tx_scheduling_advance"
211
#define ENB_CONFIG_STRING_RRH_GW_IF_COMPRESSION           "if_compression"
gauthier's avatar
gauthier committed
212

213 214 215 216
#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"
gauthier's avatar
gauthier committed
217

218
// OTG config per ENB-UE DL
219 220 221 222
#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
223

224
// per eNB configuration
225 226
#define ENB_CONFIG_STRING_LOG_CONFIG                       "log_config"
#define ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL                 "global_log_level"
227 228 229
#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"
230 231 232 233 234 235 236 237 238 239
#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"
240 241 242 243
#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"
244 245
#define ENB_CONFIG_STRING_OSA_LOG_LEVEL                    "osa_log_level"
#define ENB_CONFIG_STRING_OSA_LOG_VERBOSITY                "osa_log_verbosity"
246 247


248 249 250
#define KHz (1000UL)
#define MHz (1000 * KHz)

251 252 253 254 255 256 257
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;
258 259
} eutra_band_t;

260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
static const eutra_band_t eutra_bands[] = {
  { 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},
  {20,  832    * MHz,  862    * MHz,  791    * MHz,  821    * MHz, FDD},
  {33, 1900    * MHz, 1920    * MHz, 1900    * MHz, 1920    * MHz, TDD},
  {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},
  {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},
291 292
};

293
Enb_properties_array_t enb_properties;
294

295
void enb_config_display(void)
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
{
  int i,j;

  printf( "\n----------------------------------------------------------------------\n");
  printf( " ENB CONFIG FILE CONTENT LOADED (TBC):\n");
  printf( "----------------------------------------------------------------------\n");

  for (i = 0; i < enb_properties.number; i++) {
    printf( "ENB CONFIG for instance %u:\n\n", i);
    printf( "\teNB name:           \t%s:\n",enb_properties.properties[i]->eNB_name);
    printf( "\teNB ID:             \t%"PRIu32":\n",enb_properties.properties[i]->eNB_id);
    printf( "\tCell type:          \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
    printf( "\tTAC:                \t%"PRIu16":\n",enb_properties.properties[i]->tac);
    printf( "\tMCC:                \t%"PRIu16":\n",enb_properties.properties[i]->mcc);

311
    if (enb_properties.properties[i]->mnc_digit_length == 3) {
312
      printf( "\tMNC:                \t%03"PRIu16":\n",enb_properties.properties[i]->mnc);
313
    } else {
314
      printf( "\tMNC:                \t%02"PRIu16":\n",enb_properties.properties[i]->mnc);
315
    }
316 317 318 319
    
    for (j=0; j< enb_properties.properties[i]->nb_rrh_gw; j++) {
      if (enb_properties.properties[i]->rrh_gw_config[j].active == 1 ){
	printf( "\n\tRRH GW %d config for eNB %u:\n\n", j, i);
320
        printf( "\tinterface name :       \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].rrh_gw_if_name);
321 322 323 324
	printf( "\tlocal address  :       \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].local_address);
	printf( "\tlocal port     :       \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].local_port);
	printf( "\tremote address :       \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_address);
	printf( "\tremote port    :       \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_port);
325 326 327
	printf( "\ttx_scheduling_advance :\t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_scheduling_advance);
	printf( "\ttx_sample_advance :    \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_sample_advance);
	printf( "\tiq_txshift :           \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].iq_txshift);
Raymond Knopp's avatar
Raymond Knopp committed
328
	printf( "\ttransport  :           \t%s Ethernet:\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : (enb_properties.properties[i]->rrh_gw_config[j].rawif4p5 == 1)? "RAW_IF4p5" : (enb_properties.properties[i]->rrh_gw_config[j].udpif4p5 == 1)? "UDP_IF4p5" : (enb_properties.properties[i]->rrh_gw_config[j].rawif5_mobipass == 1)? "RAW_IF5_MOBIPASS" : "UDP");
329
	if (enb_properties.properties[i]->rrh_gw_config[j].exmimo == 1) {
Sandeep Kumar's avatar
Sandeep Kumar committed
330
	  printf( "\tRF target  :           \tEXMIMO:\n");
331
	} else if (enb_properties.properties[i]->rrh_gw_config[j].usrp_b200 == 1) {
Sandeep Kumar's avatar
Sandeep Kumar committed
332
	  printf( "\tRF target  :           \tUSRP_B200:\n");
333
	} else if (enb_properties.properties[i]->rrh_gw_config[j].usrp_x300 == 1) {
Sandeep Kumar's avatar
Sandeep Kumar committed
334
	  printf( "\tRF target  :           \tUSRP_X300:\n");
335
	} else if (enb_properties.properties[i]->rrh_gw_config[j].bladerf == 1) {
Sandeep Kumar's avatar
Sandeep Kumar committed
336
	  printf( "\tRF target  :           \tBLADERF:\n");
337
	} else if (enb_properties.properties[i]->rrh_gw_config[j].lmssdr == 1) {
Sandeep Kumar's avatar
Sandeep Kumar committed
338
	  printf( "\tRF target  :           \tLMSSDR:\n");
339
	} else {
Sandeep Kumar's avatar
Sandeep Kumar committed
340
	  printf( "\tRF target  :           \tNONE:\n");
341
	}
342
    printf( "\tif_compression :         \t%s Compression:\n",(enb_properties.properties[i]->rrh_gw_config[j].if_compress == 1)? "ALAW" : "None");
343 344
      }
    }
345

346 347 348
#if defined(FLEXRAN_AGENT_SB_IF)
    printf( "\nFLEXRAN AGENT CONFIG : \n\n");
    printf( "\tInterface name:           \t%s:\n",enb_properties.properties[i]->flexran_agent_interface_name);
349
    //    printf( "\tInterface IP Address:     \t%s:\n",enb_properties.properties[i]->flexran_agent_ipv4_address);
350 351
    printf( "\tInterface PORT:           \t%d:\n\n",enb_properties.properties[i]->flexran_agent_port);
    printf( "\tCache directory:          \t%s:\n",enb_properties.properties[i]->flexran_agent_cache);
352 353 354
    
#endif 

355
    for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
356
      // CC_ID node function/timing
357 358
      printf( "\n\tnode_function for CC %d:      \t%s:\n",j,eNB_functions[enb_properties.properties[i]->cc_node_function[j]]);
      printf( "\tnode_timing for CC %d:        \t%s:\n",j,eNB_timing[enb_properties.properties[i]->cc_node_timing[j]]);
Sandeep Kumar's avatar
Sandeep Kumar committed
359
      printf( "\tnode_synch_ref for CC %d:     \t%d:\n",j,enb_properties.properties[i]->cc_node_synch_ref[j]);
360

361 362 363 364 365 366
      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]);

      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]);
367
      printf( "\tnb_antenna_ports for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antenna_ports[j]);
368 369
      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]);
370
      
knopp's avatar
knopp committed
371
      // RACH-Config
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
      printf( "\trach_numberOfRA_Preambles for CC %d:\t%ld:\n",j,enb_properties.properties[i]->rach_numberOfRA_Preambles[j]);
      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]) {
        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]);
        printf( "\trach_messagePowerOffsetGroupB for CC %d:\t%d:\n",j,enb_properties.properties[i]->rach_messagePowerOffsetGroupB[j]);
      }

      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]);

      // BCCH-Config
      printf( "\tbcch_modificationPeriodCoeff for CC %d:\t%ld:\n",j,enb_properties.properties[i]->bcch_modificationPeriodCoeff[j]);

      // PCCH-Config
      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]);

      // PRACH-Config
      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]);
      printf( "\tprach_high_speed for CC %d:\t%d:\n",j,enb_properties.properties[i]->prach_high_speed[j]);
      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]);

      // PDSCH-Config
      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]);

      // PUSCH-Config
      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]);
      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]);
      printf( "\tpusch_groupAssignment for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_groupAssignment[j]);
      printf( "\tpusch_sequenceHoppingEnabled for CC %d:\t%d:\n",j,enb_properties.properties[i]->pusch_sequenceHoppingEnabled[j]);
      printf( "\tpusch_nDMRS1 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pusch_nDMRS1[j]);

      // PUCCH-Config

      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]);
Cedric Roux's avatar
Cedric Roux committed
421
#if !defined(Rel10) && !defined(Rel14)
422
      printf( "\tpucch_n1_AN for CC %d:\t%ld:\n",j,enb_properties.properties[i]->pucch_n1_AN[j]);
423
#endif
424 425 426 427 428 429

      // 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]) {
        printf( "\tsrs_BandwidthConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_BandwidthConfig[j]);
430
        printf( "\tsrs_SubframeConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_SubframeConfig[j]);
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
        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

      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]);
      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]);
      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]);

      // UE Timers and Constants

      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]);

457 458
      printf( "\tue_TransmissionMode for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TransmissionMode[j]);

459 460 461 462 463 464
    }

    for (j=0; j < enb_properties.properties[i]->num_otg_elements; j++) {
      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]);
      printf( "\n\tOTG Background Traffic:  \t%s\n", (enb_properties.properties[i]->otg_bg_traffic[j]==1) ? "Enabled" : "Disabled");
465
    }
466 467 468 469 470 471 472 473 474 475 476 477 478 479

    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));
    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));

    printf( "\n--------------------------------------------------------\n");
  }
480 481 482
}


483
static int enb_check_band_frequencies(char* lib_config_file_name_pP,
484 485 486 487 488
                                      int enb_properties_index,
                                      int16_t band,
                                      uint32_t downlink_frequency,
                                      int32_t uplink_frequency_offset,
                                      lte_frame_type_t frame_type)
489
{
490 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
  int errors = 0;

  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;

        AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
                     "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);
        AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
                     "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);

        AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
                     "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);
        AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
                     "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);

        AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
                     "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);
      }
517
    }
518 519 520
  }

  return errors;
521 522
}

gauthier's avatar
gauthier committed
523 524 525 526 527
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
extern int asn_debug;
extern int asn1_xer_print;
#endif

528 529 530 531 532
#ifdef LIBCONFIG_LONG
#define libconfig_int long
#else
#define libconfig_int int
#endif
533 534 535 536 537 538 539
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
{
  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;
540
  config_setting_t *setting_srb1                  = NULL;
541 542
  config_setting_t *setting_mme_addresses         = NULL;
  config_setting_t *setting_mme_address           = NULL;
543 544
  config_setting_t *setting_rrh_gws               = NULL;
  config_setting_t *setting_rrh_gw                = NULL;
545 546
  config_setting_t *setting_enb                   = NULL;
  config_setting_t *setting_otg                   = NULL;
547
  config_setting_t *subsetting_otg                = NULL;
Rohit Gupta's avatar
Rohit Gupta committed
548
  int               parse_errors                  = 0;
549 550
  int               num_enb_properties            = 0;
  int               enb_properties_index          = 0;
551 552
  int               num_enbs                      = 0;
  int               num_mme_address               = 0;
553
  int               num_rrh_gw                    = 0;
554 555
  int               num_otg_elements              = 0;
  int               num_component_carriers        = 0;
556 557
  int               i                             = 0;
  int               j                             = 0;
558
  libconfig_int     enb_id                        = 0;
559 560 561

  const char*       cc_node_function              = NULL; 
  const char*       cc_node_timing                = NULL; 
Sandeep Kumar's avatar
Sandeep Kumar committed
562
  int               cc_node_synch_ref             = 0;
563

564 565 566 567 568
  const char*       cell_type                     = NULL;
  const char*       tac                           = 0;
  const char*       enb_name                      = NULL;
  const char*       mcc                           = 0;
  const char*       mnc                           = 0;
569 570 571
  const char*       frame_type                    = NULL;
  libconfig_int     tdd_config                    = 0;
  libconfig_int     tdd_config_s                  = 0;
572
  const char*            prefix_type              = NULL;
573 574 575 576 577 578
  libconfig_int     eutra_band                    = 0;
  long long int     downlink_frequency            = 0;
  libconfig_int     uplink_frequency_offset       = 0;
  libconfig_int     Nid_cell                      = 0;
  libconfig_int     Nid_cell_mbsfn                = 0;
  libconfig_int     N_RB_DL                       = 0;
579
  libconfig_int     nb_antenna_ports              = 0;
580 581 582 583 584 585
  libconfig_int     nb_antennas_tx                = 0;
  libconfig_int     nb_antennas_rx                = 0;
  libconfig_int     tx_gain                       = 0;
  libconfig_int     rx_gain                       = 0;
  libconfig_int     prach_root                    = 0;
  libconfig_int     prach_config_index            = 0;
586
  const char*            prach_high_speed         = NULL;
587 588 589 590 591
  libconfig_int     prach_zero_correlation        = 0;
  libconfig_int     prach_freq_offset             = 0;
  libconfig_int     pucch_delta_shift             = 0;
  libconfig_int     pucch_nRB_CQI                 = 0;
  libconfig_int     pucch_nCS_AN                  = 0;
Cedric Roux's avatar
Cedric Roux committed
592
#if !defined(Rel10) && !defined(Rel14)
593
  libconfig_int     pucch_n1_AN                   = 0;
594
#endif
595 596 597
  libconfig_int     pdsch_referenceSignalPower    = 0;
  libconfig_int     pdsch_p_b                     = 0;
  libconfig_int     pusch_n_SB                    = 0;
598
  const char *      pusch_hoppingMode             = NULL;
599
  libconfig_int     pusch_hoppingOffset           = 0;
600 601
  const char*          pusch_enable64QAM          = NULL;
  const char*          pusch_groupHoppingEnabled  = NULL;
602
  libconfig_int     pusch_groupAssignment         = 0;
603
  const char*          pusch_sequenceHoppingEnabled = NULL;
604 605 606 607 608 609 610 611 612 613 614 615
  libconfig_int     pusch_nDMRS1                  = 0;
  const char*       phich_duration                = NULL;
  const char*       phich_resource                = NULL;
  const char*       srs_enable                    = NULL;
  libconfig_int     srs_BandwidthConfig           = 0;
  libconfig_int     srs_SubframeConfig            = 0;
  const char*       srs_ackNackST                 = NULL;
  const char*       srs_MaxUpPts                  = NULL;
  libconfig_int     pusch_p0_Nominal              = 0;
  const char*       pusch_alpha                   = NULL;
  libconfig_int     pucch_p0_Nominal              = 0;
  libconfig_int     msg3_delta_Preamble           = 0;
616
  //libconfig_int     ul_CyclicPrefixLength         = 0;
617
  const char*       pucch_deltaF_Format1          = NULL;
618
  //const char*       pucch_deltaF_Format1a         = NULL;
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
  const char*       pucch_deltaF_Format1b         = NULL;
  const char*       pucch_deltaF_Format2          = NULL;
  const char*       pucch_deltaF_Format2a         = NULL;
  const char*       pucch_deltaF_Format2b         = NULL;
  libconfig_int     rach_numberOfRA_Preambles     = 0;
  const char*       rach_preamblesGroupAConfig    = NULL;
  libconfig_int     rach_sizeOfRA_PreamblesGroupA = 0;
  libconfig_int     rach_messageSizeGroupA        = 0;
  const char*       rach_messagePowerOffsetGroupB = NULL;
  libconfig_int     rach_powerRampingStep         = 0;
  libconfig_int     rach_preambleInitialReceivedTargetPower    = 0;
  libconfig_int     rach_preambleTransMax         = 0;
  libconfig_int     rach_raResponseWindowSize     = 0;
  libconfig_int     rach_macContentionResolutionTimer = 0;
  libconfig_int     rach_maxHARQ_Msg3Tx           = 0;
  libconfig_int     pcch_defaultPagingCycle       = 0;
  const char*       pcch_nB                       = NULL;
  libconfig_int     bcch_modificationPeriodCoeff  = 0;
  libconfig_int     ue_TimersAndConstants_t300    = 0;
  libconfig_int     ue_TimersAndConstants_t301    = 0;
  libconfig_int     ue_TimersAndConstants_t310    = 0;
  libconfig_int     ue_TimersAndConstants_t311    = 0;
  libconfig_int     ue_TimersAndConstants_n310    = 0;
  libconfig_int     ue_TimersAndConstants_n311    = 0;
643
  libconfig_int     ue_TransmissionMode           = 0;
644

gauthier's avatar
sync  
gauthier committed
645

646 647 648 649 650 651
  libconfig_int     srb1_timer_poll_retransmit    = 0;
  libconfig_int     srb1_timer_reordering         = 0;
  libconfig_int     srb1_timer_status_prohibit    = 0;
  libconfig_int     srb1_poll_pdu                 = 0;
  libconfig_int     srb1_poll_byte                = 0;
  libconfig_int     srb1_max_retx_threshold       = 0;
652

653 654
  libconfig_int     my_int;

655 656

  char*             if_name                       = NULL;
657
  char*             ipv4                          = NULL;
658
  char*             ipv4_remote                   = NULL;
659 660 661
  char*             ipv6                          = NULL;
  char*             active                        = NULL;
  char*             preference                    = NULL;
662
  char*             if_compression                = NULL;
663 664 665 666 667 668

  char*             tr_preference                 = NULL;
  char*             rf_preference                 = NULL;
  libconfig_int     tx_scheduling_advance         = 0;
  libconfig_int     tx_sample_advance             = 0;
  libconfig_int     iq_txshift                    = 0;
669 670
  libconfig_int     local_port                    = 0;
  libconfig_int     remote_port                   = 0;
671 672 673 674 675 676 677 678 679
  const char*       active_enb[MAX_ENB];
  char*             enb_interface_name_for_S1U    = NULL;
  char*             enb_ipv4_address_for_S1U      = NULL;
  libconfig_int     enb_port_for_S1U              = 0;
  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;
680 681 682 683
  char*             flexran_agent_interface_name      = NULL;
  char*             flexran_agent_ipv4_address        = NULL;
  libconfig_int     flexran_agent_port                = 0;
  char*             flexran_agent_cache               = NULL;
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707
  libconfig_int     otg_ue_id                     = 0;
  char*             otg_app_type                  = NULL;
  char*             otg_bg_traffic                = NULL;
  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;
  char*             gtpu_log_level                = NULL;
  char*             gtpu_log_verbosity            = NULL;
  char*             udp_log_level                 = NULL;
  char*             udp_log_verbosity             = NULL;
  char*             osa_log_level                 = NULL;
  char*             osa_log_verbosity             = NULL;

Cedric Roux's avatar
Cedric Roux committed
708 709 710 711
  /* for no gcc warnings */
  (void)astring;
  (void)my_int;

712 713 714 715 716
  memset((char*) (enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
  memset((char*)active_enb,     0 , MAX_ENB * sizeof(char*));

  config_init(&cfg);

717
  if (lib_config_file_name_pP != NULL) {
718
    /* Read the file. If there is an error, report it and exit. */
719
    if (! config_read_file(&cfg, lib_config_file_name_pP)) {
720 721
      config_destroy(&cfg);
      AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
722
    }
723 724 725 726
  } else {
    config_destroy(&cfg);
    AssertFatal (0, "No eNB configuration file provided!\n");
  }
727

gauthier's avatar
gauthier committed
728
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
729

730
  if (  (config_lookup_string( &cfg, ENB_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
731 732 733 734 735 736 737 738 739 740 741 742
    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;
743
    }
744 745
  }

gauthier's avatar
gauthier committed
746
#endif
747 748 749
  // Get list of active eNBs, (only these will be configured)
  setting = config_lookup(&cfg, ENB_CONFIG_STRING_ACTIVE_ENBS);

750
  if (setting != NULL) {
751 752 753 754 755 756 757 758 759 760
    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;
761
    }
762 763 764 765
  }

  /* Output a list of all eNBs. */
  setting = config_lookup(&cfg, ENB_CONFIG_STRING_ENB_LIST);
766

767
  if (setting != NULL) {
768 769 770 771 772 773
    enb_properties_index = 0;
    num_enbs = config_setting_length(setting);

    for (i = 0; i < num_enbs; i++) {
      setting_enb = config_setting_get_elem(setting, i);

774
      if (! config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id)) {
775
        /* Calculate a default eNB ID */
776
# if defined(ENABLE_USE_MME)
777
        uint32_t hash;
778

779 780
        hash = s1ap_generate_eNB_id ();
        enb_id = i + (hash & 0xFFFF8);
781
# else
782
        enb_id = i;
783
# endif
784
      }
785

786
      if (  !(       config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE,           &cell_type)
787 788 789 790
                    && 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)
791

792 793

            )
794
        ) {
795
        AssertFatal (0,
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
                     "Failed to parse eNB configuration file %s, %u th enb\n",
                     lib_config_file_name_pP, i);
        continue; // FIXME this prevents segfaults below, not sure what happens after function exit
      }

      // 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 {
813
            AssertFatal (0,
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
                         "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;

835
          if (setting_component_carriers != NULL) {
836 837 838 839 840 841 842 843 844

            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);
845 846
              if (!(config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_CC_NODE_FUNCTION, &cc_node_function)
                   && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_CC_NODE_TIMING, &cc_node_timing)
Sandeep Kumar's avatar
Sandeep Kumar committed
847
                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CC_NODE_SYNCH_REF, &cc_node_synch_ref)
848
                   && config_setting_lookup_string(component_carrier, ENB_CONFIG_STRING_FRAME_TYPE, &frame_type)
849 850 851 852 853 854 855 856 857
                   && 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)
858
                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_PORTS, &nb_antenna_ports)
859 860 861 862 863 864 865 866 867 868 869 870
                   && 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)
                   && 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)
Cedric Roux's avatar
Cedric Roux committed
871
#if !defined(Rel10) && !defined(Rel14)
872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913
                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_PUCCH_N1_AN, &pucch_n1_AN)
#endif
                   && 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)
914
                   && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UE_TRANSMISSION_MODE,  &ue_TransmissionMode)
915

Cedric Roux's avatar
Cedric Roux committed
916
#if defined(Rel10) || defined(Rel14)
917 918 919

#endif
                  )) {
920
                AssertFatal (0,
921 922
                             "Failed to parse eNB configuration file %s, Component Carrier %d!\n",
                             lib_config_file_name_pP, enb_properties.properties[enb_properties_index]->nb_cc++);
923
                continue; // FIXME this prevents segfaults below, not sure what happens after function exit
924 925 926 927
              }

              enb_properties.properties[enb_properties_index]->nb_cc++;

928 929 930 931
              if (strcmp(cc_node_function, "eNodeB_3GPP") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = eNodeB_3GPP;
              } else if (strcmp(cc_node_function, "eNodeB_3GPP_BBU") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = eNodeB_3GPP_BBU;
932 933 934 935 936 937
              } else if (strcmp(cc_node_function, "NGFI_RCC_IF4p5") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = NGFI_RCC_IF4p5;
              } else if (strcmp(cc_node_function, "NGFI_RAU_IF4p5") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = NGFI_RAU_IF4p5;
              } else if (strcmp(cc_node_function, "NGFI_RRU_IF4p5") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = NGFI_RRU_IF4p5;
938 939 940 941 942 943 944 945
              } else if (strcmp(cc_node_function, "NGFI_RRU_IF5") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_function[j] = NGFI_RRU_IF5;
              } else {
                AssertError (0, parse_errors ++,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: eNodeB_3GPP or eNodeB_3GPP_BBU or NGFI_IF4_RCC or NGFI_IF4_RRU or NGFI_IF5_RRU !\n",
                             lib_config_file_name_pP, i, cc_node_function);
              }

Sandeep Kumar's avatar
Sandeep Kumar committed
946
              if (strcmp(cc_node_timing, "synch_to_ext_device") == 0) {
947
                enb_properties.properties[enb_properties_index]->cc_node_timing[j] = synch_to_ext_device;
Sandeep Kumar's avatar
Sandeep Kumar committed
948
              } else if (strcmp(cc_node_timing, "synch_to_other") == 0) {
949
                enb_properties.properties[enb_properties_index]->cc_node_timing[j] = synch_to_other;
Cedric Roux's avatar
Cedric Roux committed
950 951
              } else if (strcmp(cc_node_timing, "synch_to_mobipass_standalone") == 0) {
                enb_properties.properties[enb_properties_index]->cc_node_timing[j] = synch_to_mobipass_standalone;
952 953 954 955 956 957
              } else {
                AssertError (0, parse_errors ++,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: SYNCH_TO_DEVICE or SYNCH_TO_OTHER !\n",
                             lib_config_file_name_pP, i, cc_node_timing);
              }

Sandeep Kumar's avatar
Sandeep Kumar committed
958 959 960 961 962 963 964 965
              if ((cc_node_synch_ref >= -1) && (cc_node_synch_ref < num_component_carriers)) {  
               enb_properties.properties[enb_properties_index]->cc_node_synch_ref[j] = (int16_t) cc_node_synch_ref; 
              } else {
                AssertError (0, parse_errors ++,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for node_synch_ref choice: valid CC_id or -1 !\n",
                             lib_config_file_name_pP, i, cc_node_synch_ref);
              }
              
966
              enb_properties.properties[enb_properties_index]->tdd_config[j] = tdd_config;
967
              AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6,
968 969 970 971
                           "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
                           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;
972
              AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8,
973 974 975
                           "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
                           lib_config_file_name_pP, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);

976
              if (!prefix_type)
977
                AssertFatal (0,
978 979 980
                             "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) {
981 982 983 984
                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 {
985
                AssertFatal (0,
986 987 988
                             "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);
              }
989
              
990 991 992 993 994 995
              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) {
996
                AssertFatal (0,
997 998 999 1000 1001 1002 1003
                             "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)) {
1004
                AssertFatal (0,
1005 1006 1007 1008 1009 1010 1011 1012 1013
                             "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 {
1014
                AssertFatal (0,
1015 1016 1017 1018 1019 1020
                             "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;
1021
              AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6,
1022 1023 1024 1025 1026
                           "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
                           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;
1027
              AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8,
1028 1029 1030 1031 1032 1033
                           "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
                           lib_config_file_name_pP, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);



              if (!prefix_type)
1034
                AssertFatal (0,
1035 1036 1037 1038 1039 1040 1041
                             "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) {
                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 {
1042
                AssertFatal (0,
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
                             "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;

1060
              if (enb_check_band_frequencies(lib_config_file_name_pP,
1061 1062 1063 1064
                              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],
1065 1066 1067
                              enb_properties.properties[enb_properties_index]->frame_type[j])) {
                AssertFatal(0, "error calling enb_check_band_frequencies\n");
              }
1068 1069 1070

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

1071
              if ((nb_antenna_ports <1) || (nb_antenna_ports > 2))
1072
                AssertFatal (0,
1073 1074 1075 1076 1077
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n",
                             lib_config_file_name_pP, i, nb_antenna_ports);

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

1078
              if ((nb_antennas_tx <1) || (nb_antennas_tx > 64))
1079
                AssertFatal (0,
1080
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..64 !\n",
1081 1082 1083 1084
                             lib_config_file_name_pP, i, nb_antennas_tx);

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

1085
              if ((nb_antennas_rx <1) || (nb_antennas_rx > 64))
1086
                AssertFatal (0,
1087
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_rx choice: 1..64 !\n",
1088 1089 1090 1091 1092
                             lib_config_file_name_pP, i, nb_antennas_rx);

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

              if ((tx_gain <0) || (tx_gain > 127))
1093
                AssertFatal (0,
1094 1095 1096 1097 1098 1099
                             "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))
1100
                AssertFatal (0,
1101 1102 1103 1104 1105 1106
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rx_gain choice: 0..160 !\n",
                             lib_config_file_name_pP, i, rx_gain);

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

              if ((prach_root <0) || (prach_root > 1023))
1107
                AssertFatal (0,
1108 1109 1110 1111 1112 1113
                             "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))
1114
                AssertFatal (0,
1115 1116 1117 1118
                             "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);

              if (!prach_high_speed)
1119
                AssertFatal (0,
1120 1121
                             "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);
1122
              else if (strcmp(prach_high_speed, "ENABLE") == 0) {
1123
                enb_properties.properties[enb_properties_index]->prach_high_speed[j] = TRUE;
1124
              } else if (strcmp(prach_high_speed, "DISABLE") == 0) {
1125
                enb_properties.properties[enb_properties_index]->prach_high_speed[j] = FALSE;
1126
              } else
1127
                AssertFatal (0,
1128 1129 1130 1131 1132
                             "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;

1133
              if ((prach_zero_correlation <0) || (prach_zero_correlation > 15))
1134
                AssertFatal (0,
1135 1136 1137 1138 1139 1140
                             "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))
1141
                AssertFatal (0,
1142 1143 1144 1145 1146 1147 1148
                             "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))
1149
                AssertFatal (0,
1150 1151 1152 1153 1154 1155
                             "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))
1156
                AssertFatal (0,
1157 1158 1159 1160 1161 1162
                             "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))
1163
                AssertFatal (0,
1164 1165 1166
                             "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);

Cedric Roux's avatar
Cedric Roux committed
1167
#if !defined(Rel10) && !defined(Rel14)
1168 1169 1170
              enb_properties.properties[enb_properties_index]->pucch_n1_AN[j] = pucch_n1_AN;

              if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047))
1171
                AssertFatal (0,
1172 1173
                             "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);
1174 1175

#endif
1176 1177 1178
              enb_properties.properties[enb_properties_index]->pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower;

              if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50))
1179
                AssertFatal (0,
1180 1181 1182 1183 1184 1185
                             "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))
1186
                AssertFatal (0,
1187 1188 1189 1190 1191 1192
                             "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))
1193
                AssertFatal (0,
1194 1195 1196 1197
                             "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);

              if (!pusch_hoppingMode)
1198
                AssertFatal (0,
gauthier's avatar