From 7862b309d4213c56b66b446e9ce1986e6e162bdf Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Fri, 31 Jan 2014 14:23:26 +0000 Subject: [PATCH] Changed eNB_id option handling to have default value if not given in configuration file. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5000 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/ENB_APP/enb_app.c | 5 ----- openair2/ENB_APP/enb_config.c | 13 ++++++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 1ae974ce8f7..8bcf0f881c6 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -113,11 +113,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end) # endif { s1ap_register_enb_req_t *s1ap_register_eNB; - uint32_t hash; - - /* Overwrite default eNB ID */ - hash = s1ap_generate_eNB_id (); - enb_properties[enb_id]->eNB_id = enb_id + (hash & 0xFFFF8); /* note: there is an implicit relationship between the data structure and the message name */ msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index cbaba2a9aba..f36ae74d1bc 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -126,9 +126,16 @@ int enb_config_init(char* lib_config_file_name_pP, Enb_properties_t **enb_proper num_enbs = config_setting_length(setting); for (i = 0; i < num_enbs; i++) { setting_enb = config_setting_get_elem(setting, i); - if( !( - config_setting_lookup_int (setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id) - && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE, &cell_type) + + if(! config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id)) { + uint32_t hash; + + /* Calculate a default eNB ID */ + hash = s1ap_generate_eNB_id (); + enb_id = i + (hash & 0xFFFF8); + } + + if( !( config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE, &cell_type) && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_ENB_NAME, &enb_name) && config_setting_lookup_int (setting_enb, ENB_CONFIG_STRING_TRACKING_AREA_CODE, &tac) && config_setting_lookup_int (setting_enb, ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE, &mcc) -- GitLab