enb_config.c 44.2 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 26 27

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

  Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.

gauthier's avatar
gauthier committed
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
gauthier's avatar
gauthier committed
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"
winckel's avatar
winckel committed
46 47 48 49
#if defined(OAI_EMU)
# include "OCG.h"
# include "OCG_extern.h"
#endif
50 51 52 53 54 55 56 57 58 59
#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"

60 61 62 63 64 65 66 67 68 69 70 71 72 73
#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"

#define ENB_CONFIG_STRING_DEFAULT_PAGING_DRX            "default_paging_drx"

#define ENB_CONFIG_STRING_FRAME_TYPE                    "frame_type"
74 75
#define ENB_CONFIG_STRING_TDD_CONFIG                    "tdd_config"
#define ENB_CONFIG_STRING_TDD_CONFIG_S                  "tdd_config_s"
76 77 78 79 80
#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
#define ENB_CONFIG_STRING_COMPONENT_CARRIERS            "component_carriers"
#define ENB_CONFIG_STRING_CELL_ID                       "cell_id"
#define ENB_CONFIG_STRING_N_RB_DL                       "N_RB_DL"

85 86 87 88 89 90 91 92 93 94 95 96
#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"

gauthier's avatar
gauthier committed
97 98 99 100 101 102 103

#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"


104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
// per eNB configuration 
#define ENB_CONFIG_STRING_LOG_CONFIG                       "log_config"
#define ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL                 "global_log_level"
#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"
#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"




124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
#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[] =
{
    { 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},

    {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},
};

166
static Enb_properties_array_t enb_properties;
167

168
static void enb_config_display(void) {
169
  int i,j;
170 171 172 173 174

    printf( "\n----------------------------------------------------------------------\n");
    printf( " ENB CONFIG FILE CONTENT LOADED (TBC):\n");
    printf( "----------------------------------------------------------------------\n");
    for (i = 0; i < enb_properties.number; i++) {
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
        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%u:\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%u:\n",enb_properties.properties[i]->tac);
        printf( "\tMCC:                \t%u:\n",enb_properties.properties[i]->mcc);
        printf( "\tMNC:                \t%u:\n",enb_properties.properties[i]->mnc);
	printf( "\teutra band:         \t%d:\n",enb_properties.properties[i]->eutra_band);
        printf( "\tdownlink freq:      \t%u:\n",enb_properties.properties[i]->downlink_frequency);
        printf( "\tuplink freq:        \t%d:\n",enb_properties.properties[i]->uplink_frequency_offset);

	for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
	  printf( "\n\tCell ID for CC %d:\t%d:\n",j,enb_properties.properties[i]->cell_id[j]);
	  printf( "\tN_RB_DL for CC %d:\t%d:\n",j,enb_properties.properties[i]->N_RB_DL[j]);
	}
	
      	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( "\n--------------------------------------------------------\n");
200 201 202 203
    }
}


204 205 206 207 208 209 210
static int enb_check_band_frequencies(char* lib_config_file_name_pP,
                                      int enb_properties_index,
                                      int16_t band,
                                      uint32_t downlink_frequency,
                                      int32_t uplink_frequency_offset,
                                      lte_frame_type_t frame_type)
{
211
    int errors = 0;
212 213 214 215 216 217 218 219 220 221 222

    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;

223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
                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);
240 241 242
            }
        }
    }
243
    return errors;
244 245
}

gauthier's avatar
gauthier committed
246 247 248 249 250
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
extern int asn_debug;
extern int asn1_xer_print;
#endif

251
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
252
  config_t          cfg;
gauthier's avatar
gauthier committed
253 254
  config_setting_t *setting                       = NULL;
  config_setting_t *subsetting                    = NULL;
255 256
  config_setting_t *setting_component_carriers    = NULL;
  config_setting_t *component_carrier             = NULL;
gauthier's avatar
gauthier committed
257 258 259 260 261
  config_setting_t *setting_mme_addresses         = NULL;
  config_setting_t *setting_mme_address           = NULL;
  config_setting_t *setting_enb                   = NULL;
  int               num_enb_properties            = 0;
  int               enb_properties_index          = 0;
262 263
  int               num_enbs;
  int               num_mme_address;
264
  int               num_component_carriers        =0;
265 266
  int               i;
  int               j;
gauthier's avatar
gauthier committed
267 268 269
  int               parse_errors                  = 0;
  long int          enb_id                        = 0;
  const char*       cell_type                     = NULL;
nikaeinn's avatar
nikaeinn committed
270
  const char*       tac                           = 0;
gauthier's avatar
gauthier committed
271
  const char*       enb_name                      = NULL;
nikaeinn's avatar
nikaeinn committed
272 273
  const char*       mcc                           = 0;
  const char*       mnc                           = 0;
gauthier's avatar
gauthier committed
274
  const char*       default_drx                   = NULL;
275
  const char*       frame_type;
276 277
  long int          tdd_config;
  long int          tdd_config_s;
278
  const char*       prefix_type;
279
  long int          eutra_band;
280
  long long int     downlink_frequency;
281
  long int          uplink_frequency_offset;
282 283
  long int          cell_id[MAX_NUM_CCs];
  long int          N_RB_DL[MAX_NUM_CCs];
gauthier's avatar
gauthier committed
284 285 286 287
  char*             ipv4                          = NULL;
  char*             ipv6                          = NULL;
  char*             active                        = NULL;
  char*             preference                    = NULL;
288
  const char*       active_enb[MAX_ENB];
gauthier's avatar
gauthier committed
289 290 291 292 293 294
  char*             enb_interface_name_for_S1U    = NULL;
  char*             enb_ipv4_address_for_S1U      = NULL;
  char*             enb_interface_name_for_S1_MME = NULL;
  char*             enb_ipv4_address_for_S1_MME   = NULL;
  char             *address                       = NULL;
  char             *cidr                          = NULL;
gauthier's avatar
gauthier committed
295
  char             *astring                       = NULL;
296 297 298 299 300 301 302 303 304 305 306 307 308 309
  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;
310

311
  memset((char*) (enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
312
  memset((char*)active_enb,     0 , MAX_ENB * sizeof(char*));
313 314 315

  config_init(&cfg);

winckel's avatar
winckel committed
316 317 318 319 320 321
  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);
322
          AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
winckel's avatar
winckel committed
323 324 325
      }
  }
  else
326 327
  {
      config_destroy(&cfg);
winckel's avatar
winckel committed
328
      AssertFatal (0, "No eNB configuration file provided!\n");
329 330
  }

gauthier's avatar
gauthier committed
331 332 333
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
  if(  (config_lookup_string( &cfg, ENB_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
      if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
334
          asn_debug      = 0;
gauthier's avatar
gauthier committed
335 336 337 338 339 340 341 342 343 344 345 346 347
          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;
      }
  }
#endif
348 349 350 351 352 353 354 355 356 357 358 359
  // 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]);
360
          num_enb_properties += 1;
361 362 363 364 365 366 367 368
      }
  }

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

          if(! config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id)) {
375 376
              /* Calculate a default eNB ID */
# if defined(ENABLE_USE_MME)
377 378 379 380
              uint32_t hash;

              hash = s1ap_generate_eNB_id ();
              enb_id = i + (hash & 0xFFFF8);
381 382 383
# else
              enb_id = i;
# endif
384 385 386
          }

          if(  !(       config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE,           &cell_type)
387
                     && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_ENB_NAME,            &enb_name)
nikaeinn's avatar
nikaeinn committed
388 389 390
                     && 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)
391
                     && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_DEFAULT_PAGING_DRX,  &default_drx)
392
			
393 394
                )
            ) {
395
              AssertError (0, parse_errors ++,
winckel's avatar
winckel committed
396
                      "Failed to parse eNB configuration file %s, %u th enb\n",
397 398 399
                      lib_config_file_name_pP, i);
          }
          // search if in active list
400
          for (j=0; j < num_enb_properties; j++) {
401
              if (strcmp(active_enb[j], enb_name) == 0) {
402
                  enb_properties.properties[enb_properties_index] = calloc(1, sizeof(Enb_properties_t));
403

404
                  enb_properties.properties[enb_properties_index]->eNB_id   = enb_id;
405
                  if (strcmp(cell_type, "CELL_MACRO_ENB") == 0) {
406
                      enb_properties.properties[enb_properties_index]->cell_type = CELL_MACRO_ENB;
407
                  } else  if (strcmp(cell_type, "CELL_HOME_ENB") == 0) {
408
                      enb_properties.properties[enb_properties_index]->cell_type = CELL_HOME_ENB;
409
                  } else {
410
                      AssertError (0, parse_errors ++,
411 412
                              "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);
413
                  }
nikaeinn's avatar
nikaeinn committed
414 415 416 417 418
                  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);
419 420

                  if (strcmp(default_drx, "PAGING_DRX_32") == 0) {
421
                      enb_properties.properties[enb_properties_index]->default_drx = PAGING_DRX_32;
422
                  } else  if (strcmp(default_drx, "PAGING_DRX_64") == 0) {
423
                      enb_properties.properties[enb_properties_index]->default_drx = PAGING_DRX_64;
424
                  } else  if (strcmp(default_drx, "PAGING_DRX_128") == 0) {
425
                      enb_properties.properties[enb_properties_index]->default_drx = PAGING_DRX_128;
426
                  } else  if (strcmp(default_drx, "PAGING_DRX_256") == 0) {
427
                      enb_properties.properties[enb_properties_index]->default_drx = PAGING_DRX_256;
428
                  } else {
429
                      AssertError (0, parse_errors ++,
430 431 432 433 434 435 436
                              "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for default_drx choice: PAGING_DRX_32..PAGING_DRX_256 !\n",
                              lib_config_file_name_pP, i, default_drx);
                  }

                  // Parse optional physical parameters
                  if(config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_FRAME_TYPE, &frame_type)) {
                      if (strcmp(frame_type, "FDD") == 0) {
437
                          enb_properties.properties[enb_properties_index]->frame_type = FDD;
438
                      } else  if (strcmp(frame_type, "TDD") == 0) {
439
                          enb_properties.properties[enb_properties_index]->frame_type = TDD;
440
                      } else {
441
                          AssertError (0, parse_errors ++,
442 443 444 445
                                  "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);
                      }
                  } else {
446
                      enb_properties.properties[enb_properties_index]->frame_type = FDD; // Default frame type
447 448
                  }

449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
                  if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_TDD_CONFIG, &tdd_config)) {
                      enb_properties.properties[enb_properties_index]->tdd_config = tdd_config;
                      AssertError (tdd_config <= TDD_Config__subframeAssignment_sa6, parse_errors ++,
                              "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %ld (should be 0-%d)!",
                              lib_config_file_name_pP, i, tdd_config, TDD_Config__subframeAssignment_sa6);
                  } else {
                      enb_properties.properties[enb_properties_index]->tdd_config = 3; // Default TDD sub-frame configuration
                  }

                  if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_TDD_CONFIG_S, &tdd_config_s)) {
                      enb_properties.properties[enb_properties_index]->tdd_config_s = tdd_config_s;
                      AssertError (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, parse_errors ++,
                              "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %ld (should be 0-%d)!",
                              lib_config_file_name_pP, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);
                  } else {
                      enb_properties.properties[enb_properties_index]->tdd_config_s = 0; // Default TDD S-sub-frame configuration
                  }

467 468
                  if(config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_PREFIX_TYPE, &prefix_type)) {
                      if (strcmp(prefix_type, "NORMAL") == 0) {
469
                          enb_properties.properties[enb_properties_index]->prefix_type = NORMAL;
470
                      } else  if (strcmp(prefix_type, "EXTENDED") == 0) {
471
                          enb_properties.properties[enb_properties_index]->prefix_type = EXTENDED;
472
                      } else {
473
                          AssertError (0, parse_errors ++,
474 475 476 477
                                  "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);
                      }
                  } else {
478
                      enb_properties.properties[enb_properties_index]->prefix_type = NORMAL; // Default prefix type
479 480
                  }

481 482
                  if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_EUTRA_BAND, &eutra_band)) {
                      enb_properties.properties[enb_properties_index]->eutra_band = eutra_band;
483
		      // printf( "\teutra band:\t%d\n",enb_properties.properties[enb_properties_index]->eutra_band);
484 485
                  } else {
                      enb_properties.properties[enb_properties_index]->eutra_band = 7; // Default band
486
                      //printf( "\teutra band:\t%d (default)\n",enb_properties.properties[enb_properties_index]->eutra_band);
487 488
                  }

489 490
                  if(config_setting_lookup_int64(setting_enb, ENB_CONFIG_STRING_DOWNLINK_FREQUENCY, &downlink_frequency)) {
                      enb_properties.properties[enb_properties_index]->downlink_frequency = (uint32_t) downlink_frequency;
491
                      //printf( "\tdownlink freq:\t%u\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
492
                  } else {
493
                      enb_properties.properties[enb_properties_index]->downlink_frequency = 2680000000UL; // Default downlink frequency
494
		      // printf( "\tdownlink freq:\t%u (default)\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
495
                  }
496
                  if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, &uplink_frequency_offset)) {
497
                      enb_properties.properties[enb_properties_index]->uplink_frequency_offset = (unsigned int) uplink_frequency_offset;
498
                      //printf( "\tuplink freq offset:\t%ld\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
499
                  } else {
500 501 502 503 504 505
                      // Default uplink frequency offset
                      if (enb_properties.properties[enb_properties_index]->frame_type == FDD) {
                          enb_properties.properties[enb_properties_index]->uplink_frequency_offset = -120000000;
                      } else {
                          enb_properties.properties[enb_properties_index]->uplink_frequency_offset = 0;
                      }
506
                      //printf( "\tuplink freq offset:\t%ld (default)\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
507
                  }
508

509
                  parse_errors += enb_check_band_frequencies(lib_config_file_name_pP,
gauthier's avatar
gauthier committed
510 511 512 513 514
                                             enb_properties_index,
                                             enb_properties.properties[enb_properties_index]->eutra_band,
                                             enb_properties.properties[enb_properties_index]->downlink_frequency,
                                             enb_properties.properties[enb_properties_index]->uplink_frequency_offset,
                                             enb_properties.properties[enb_properties_index]->frame_type);
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 540 541 542 543 544 545
		  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);
		      if(!(config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CELL_ID, &cell_id[j]) && 
			   config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_N_RB_DL, &N_RB_DL[j])   )
			 ){
			AssertError (0, parse_errors ++,
				     "Failed to parse eNB configuration file %s, Component Carrier!\n",
				     lib_config_file_name_pP);
		      }
		      enb_properties.properties[enb_properties_index]->nb_cc++;
		      enb_properties.properties[enb_properties_index]->cell_id[j]= cell_id[j];
		      enb_properties.properties[enb_properties_index]->N_RB_DL[j]= N_RB_DL[j];
		      //printf("adding component carrier %d\n", j);
		    }
		    
		  } else {
		    for (j=0; j< MAX_NUM_CCs; j++) {
		      enb_properties.properties[enb_properties_index]->nb_cc +=1;
		      enb_properties.properties[enb_properties_index]->cell_id[j]=j;
		      enb_properties.properties[enb_properties_index]->N_RB_DL[j]=25;
		    }
		  }
		  
546 547
                  setting_mme_addresses = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_MME_IP_ADDRESS);
                  num_mme_address     = config_setting_length(setting_mme_addresses);
548
                  enb_properties.properties[enb_properties_index]->nb_mme = 0;
549 550 551 552 553 554 555 556 557
                  for (j = 0; j < num_mme_address; j++) {
                      setting_mme_address = config_setting_get_elem(setting_mme_addresses, j);
                      if(  !(
                              config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IPV4_ADDRESS, (const char **)&ipv4)
                              && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IPV6_ADDRESS, (const char **)&ipv6)
                              && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, (const char **)&active)
                              && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, (const char **)&preference)
                            )
                        ) {
558
                          AssertError (0, parse_errors ++,
559
                                  "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n",
560 561
                                  lib_config_file_name_pP, i, j);
                      }
562
                      enb_properties.properties[enb_properties_index]->nb_mme += 1;
563

564 565
                      enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4_address = strdup(ipv4);
                      enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6_address = strdup(ipv6);
566
                      if (strcmp(active, "yes") == 0) {
567
                          enb_properties.properties[enb_properties_index]->mme_ip_address[j].active = 1;
winckel's avatar
winckel committed
568 569 570
#if defined(ENABLE_USE_MME)
                          EPC_MODE_ENABLED = 1;
#endif
571 572 573
                      } // else { (calloc)

                      if (strcmp(preference, "ipv4") == 0) {
574
                          enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4 = 1;
575
                      } else if (strcmp(preference, "ipv6") == 0) {
576
                          enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
577
                      } else if (strcmp(preference, "no") == 0) {
578 579
                          enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4 = 1;
                          enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
580 581
                      }
                  }
582
		  // NETWORK_INTERFACES
gauthier's avatar
gauthier committed
583 584 585
                  subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
                  if(subsetting != NULL) {
                      if(  (
586
                              config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1_MME,
gauthier's avatar
gauthier committed
587
                                      (const char **)&enb_interface_name_for_S1_MME)
588
                           && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_IPV4_ADDRESS_FOR_S1_MME,
gauthier's avatar
gauthier committed
589
                                   (const char **)&enb_ipv4_address_for_S1_MME)
590
                           && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1U,
gauthier's avatar
gauthier committed
591
                                   (const char **)&enb_interface_name_for_S1U)
592
                           && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U,
gauthier's avatar
gauthier committed
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
                                   (const char **)&enb_ipv4_address_for_S1U)
                         )
                     ){
                          enb_properties.properties[enb_properties_index]->enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U);
                          cidr = enb_ipv4_address_for_S1U;
                          address = strtok(cidr, "/");
                          if (address) {
                              IPV4_STR_ADDR_TO_INT_NWBO ( address, enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1U, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
                          }

                          enb_properties.properties[enb_properties_index]->enb_interface_name_for_S1_MME = strdup(enb_interface_name_for_S1_MME);
                          cidr = enb_ipv4_address_for_S1_MME;
                          address = strtok(cidr, "/");
                          if (address) {
                              IPV4_STR_ADDR_TO_INT_NWBO ( address, enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR eNB S1_MME !\n" );
                          }
                      }
                  }
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 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 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
		  // log_config 
		  subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_LOG_CONFIG);
                  if(subsetting != NULL) {
		    // global 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL, (const char **)  &glog_level)) {
                      if ((enb_properties.properties[enb_properties_index]->glog_level = map_str_to_int(log_level_names, glog_level)) == -1)
			enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
		      //printf( "\tGlobal log level :\t%s->%d\n",glog_level, enb_properties.properties[enb_properties_index]->glog_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,(const char **)  &glog_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->glog_verbosity = map_str_to_int(log_verbosity_names, glog_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED;
		      //printf( "\tGlobal log verbosity:\t%s->%d\n",glog_verbosity, enb_properties.properties[enb_properties_index]->glog_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED; 
		    } 
		    // HW
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_LEVEL, (const char **) &hw_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->hw_log_level = map_str_to_int(log_level_names,hw_log_level)) == -1)
			enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
                      //printf( "\tHW log level :\t%s->%d\n",hw_log_level,enb_properties.properties[enb_properties_index]->hw_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_VERBOSITY, (const char **) &hw_log_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->hw_log_verbosity = map_str_to_int(log_verbosity_names,hw_log_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED;
                      //printf( "\tHW log verbosity:\t%s->%d\n",hw_log_verbosity, enb_properties.properties[enb_properties_index]->hw_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED; 
		    } 
		    // phy 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_LEVEL,(const char **) &phy_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->phy_log_level = map_str_to_int(log_level_names,phy_log_level)) == -1)
			enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
                      //printf( "\tPHY log level :\t%s->%d\n",phy_log_level,enb_properties.properties[enb_properties_index]->phy_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_VERBOSITY, (const char **)&phy_log_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->phy_log_verbosity = map_str_to_int(log_verbosity_names,phy_log_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
                      //printf( "\tPHY log verbosity:\t%s->%d\n",phy_log_level,enb_properties.properties[enb_properties_index]->phy_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
		    } 
		    //mac 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_LEVEL, (const char **)&mac_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->mac_log_level = map_str_to_int(log_level_names,mac_log_level)) == -1 )
			enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
                      //printf( "\tMAC log level :\t%s->%d\n",mac_log_level,enb_properties.properties[enb_properties_index]->mac_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_VERBOSITY, (const char **)&mac_log_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->mac_log_verbosity = map_str_to_int(log_verbosity_names,mac_log_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED; 
                      //printf( "\tMAC log verbosity:\t%s->%d\n",mac_log_verbosity,enb_properties.properties[enb_properties_index]->mac_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED; 
		    } 
		    //rlc
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_LEVEL, (const char **)&rlc_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->rlc_log_level = map_str_to_int(log_level_names,rlc_log_level)) == -1)
			enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
                      //printf( "\tRLC log level :\t%s->%d\n",rlc_log_level, enb_properties.properties[enb_properties_index]->rlc_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_VERBOSITY, (const char **)&rlc_log_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->rlc_log_verbosity = map_str_to_int(log_verbosity_names,rlc_log_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED; 
                      //printf( "\tRLC log verbosity:\t%s->%d\n",rlc_log_verbosity, enb_properties.properties[enb_properties_index]->rlc_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED; 
		    } 
		    //pdcp 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_LEVEL, (const char **)&pdcp_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->pdcp_log_level = map_str_to_int(log_level_names,pdcp_log_level)) == -1)
			enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
                      //printf( "\tPDCP log level :\t%s->%d\n",pdcp_log_level, enb_properties.properties[enb_properties_index]->pdcp_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY, (const char **)&pdcp_log_verbosity)) {
                      enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = map_str_to_int(log_verbosity_names,pdcp_log_verbosity);
                      //printf( "\tPDCP log verbosity:\t%s->%d\n",pdcp_log_verbosity, enb_properties.properties[enb_properties_index]->pdcp_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = LOG_MED; 
		    } 
		    //rrc
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_LEVEL, (const char **)&rrc_log_level)) {
                      if ((enb_properties.properties[enb_properties_index]->rrc_log_level = map_str_to_int(log_level_names,rrc_log_level)) == -1 )
			enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
                      //printf( "\tRRC log level :\t%s->%d\n",rrc_log_level,enb_properties.properties[enb_properties_index]->rrc_log_level);
		    } else {
                      enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
		    } 
		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_VERBOSITY, (const char **)&rrc_log_verbosity)) {
                      if ((enb_properties.properties[enb_properties_index]->rrc_log_verbosity = map_str_to_int(log_verbosity_names,rrc_log_verbosity)) == -1)
			enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
                      //printf( "\tRRC log verbosity:\t%s->%d\n",rrc_log_verbosity,enb_properties.properties[enb_properties_index]->rrc_log_verbosity);
		    } else {
                      enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
		    } 
		    
                  } else { // not configuration is given 
		    enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
		    enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED; 
		    enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
		    enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED; 
		    enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
		    enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
		    enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
		    enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED;
		    enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
		    enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED;
		    enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
		    enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = LOG_MED; 
		    enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
		    enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
		  }

736 737 738 739 740 741
                  enb_properties_index += 1;
                  break;
              }
          }
      }
  }
742 743
  enb_properties.number = num_enb_properties;

744
  AssertError (enb_properties_index == num_enb_properties, parse_errors ++,
745
          "Failed to parse eNB configuration file %s, mismatch between %u active eNBs and %u corresponding defined eNBs !\n",
746
          lib_config_file_name_pP, num_enb_properties, enb_properties_index);
747

748
  AssertFatal (parse_errors == 0,
749
               "Failed to parse eNB configuration file %s, found %d error%s !\n",
750
               lib_config_file_name_pP, parse_errors, parse_errors > 1 ? "s" : "");
751
  enb_config_display();
752
  return &enb_properties;
gauthier's avatar
gauthier committed
753

754 755 756 757
}

const Enb_properties_array_t *enb_config_get(void) {
    return &enb_properties;
758
}
759