oaisim_config.c 88 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * 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
 */

22
23
/*! \file oaisim_config.c
* \brief Configuration of oaisim
24
25
* \author Navid Nikaein 
* \date 2013-2015
26
27
28
29
30
31
32
* \version 1.0
* \company Eurecom
* \email: openair_tech@eurecom.fr
* \note
* \warning
*/

33
34
35
36
37
38
39
40
41
42
43
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>

#include "oaisim_config.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "UTIL/OMG/omg.h"
44
#include "UTIL/OMG/grid.h"
45
46
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg.h"
47
#include "UTIL/OTG/otg_externs.h"
winckel's avatar
winckel committed
48
#include "oml.h"
gauthier's avatar
gauthier committed
49
#include "msc.h"
50
#if ENABLE_RAL
51
52
53
#include "lteRALenb.h"
#include "lteRALue.h"
#endif
54

55
56
57
58
#if defined(ENABLE_ITTI)
# include "intertask_interface_init.h"
#endif

59

60
61
62
63
64
65
66
67
68
mapping omg_model_names[] = {
  {"STATIC", STATIC},
  {"RWP", RWP},
  {"RWALK", RWALK},
  {"TRACE", TRACE},
  {"SUMO", SUMO},
  {"STEADY_RWP", STEADY_RWP},
  {"MAX_NUM_MOB_TYPES", MAX_NUM_MOB_TYPES},
  {NULL, -1}
69
};
70
// subtypes for RWP in grid map
71
mapping omg_rwp_names[] = {
72
73
74
75
76
77
  {"MIN_RWP_TYPES", MIN_RWP_TYPES},
  {"RESTRICTED_RWP",RESTIRICTED_RWP},
  {"CONNECTED_DOMAIN", CONNECTED_DOMAIN},
  {"MAX_RWP_TYPES", MAX_RWP_TYPES},
  {NULL, -1}
};
78

knopp's avatar
   
knopp committed
79
void  ocg_config_proto(void);
80

81
82
void init_oai_emulation(void)
{
83
84

  int i;
knopp's avatar
   
knopp committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
  int CC_id;

  oai_emulation.environment_system_config.fading.large_scale.selected_option = "free_space";
  oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_exponent = 3.00;
  oai_emulation.environment_system_config.fading.free_space_model_parameters.pathloss_0_dB = -100;
  oai_emulation.environment_system_config.fading.small_scale.selected_option = "AWGN";
  oai_emulation.environment_system_config.fading.ricean_8tap.rice_factor_dB = 0;
  oai_emulation.environment_system_config.fading.shadowing.decorrelation_distance_m = 0;
  oai_emulation.environment_system_config.fading.shadowing.variance_dB = 0;
  oai_emulation.environment_system_config.fading.shadowing.inter_site_correlation = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.number_of_sectors = 1;
  oai_emulation.environment_system_config.antenna.eNB_antenna.beam_width_dB = 1.13;
  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[0] = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[1] = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.alpha_rad[2] = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_gain_dBi = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.tx_power_dBm = 15;
  oai_emulation.environment_system_config.antenna.eNB_antenna.rx_noise_level_dB = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[0] = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[1] = 0;
  oai_emulation.environment_system_config.antenna.eNB_antenna.antenna_orientation_degree[2] = 0;
  oai_emulation.environment_system_config.antenna.UE_antenna.antenna_gain_dBi = 0;
  oai_emulation.environment_system_config.antenna.UE_antenna.tx_power_dBm = 20;
  oai_emulation.environment_system_config.antenna.UE_antenna.rx_noise_level_dB = 0; // noise figure
  oai_emulation.environment_system_config.wall_penetration_loss_dB = 5;
  oai_emulation.environment_system_config.system_bandwidth_MB = 7.68;
  oai_emulation.environment_system_config.system_frequency_GHz = 1.9;
112

knopp's avatar
   
knopp committed
113
114
115
116
117
118
  oai_emulation.topology_config.area.x_m = 1000;
  oai_emulation.topology_config.area.y_m = 1000;
  oai_emulation.topology_config.network_type.selected_option = "homogeneous";
  oai_emulation.topology_config.cell_type.selected_option = "macrocell";
  oai_emulation.topology_config.relay.number_of_relays = 0;
  oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option = "STATIC";
119
  oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option="MAX_RWP_TYPES";
knopp's avatar
   
knopp committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
  //oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.horizontal_grid = 1;
  //oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.vertical_grid = 1;
  oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_trip_type.selected_option = "random_destination";
  oai_emulation.topology_config.mobility.UE_mobility.UE_initial_distribution.selected_option = "random";
  oai_emulation.topology_config.mobility.UE_mobility.random_UE_distribution.number_of_nodes = 1;
  oai_emulation.topology_config.mobility.UE_mobility.concentrated_UE_distribution.number_of_nodes = 1;
  oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.random_grid.number_of_nodes = 1;
  oai_emulation.topology_config.mobility.UE_mobility.grid_UE_distribution.border_grid.number_of_nodes = 1;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps = 0.1;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps = 20.0;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms = 0.1;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms = 5.0;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms = 0.1;
  oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms = 10.0;
  oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option = "STATIC";
  oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option = "random";
136
137
  oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y = 1;
knopp's avatar
   
knopp committed
138
139
140
141
142
143
144
145
146
147
148
149
  oai_emulation.topology_config.mobility.eNB_mobility.random_eNB_distribution.number_of_cells = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.number_of_cells = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.hexagonal_eNB_distribution.inter_eNB_distance_km = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_x = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.grid_eNB_distribution.number_of_grid_y = 1;
  oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
  sprintf(oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file,"static_1enb.tr");
  oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file = (char*) malloc(256);
  sprintf(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,"static_2ues.tr");
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command = (char*) malloc(20);
  sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,"sumo");
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file = (char*) malloc(256);
150
  snprintf( oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file, 256, "%s/UTIL/OMG/SUMO/SCENARIOS/scen.sumo.cfg", getenv("OPENAIR2_DIR") );
knopp's avatar
   
knopp committed
151
152
153
154
155
156
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start=0;
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end=0;
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; //  1000ms
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip = (char*) malloc(40);
  sprintf(oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip,"127.0.1.1");
  oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport = 8883;
157

knopp's avatar
   
knopp committed
158
  oai_emulation.application_config.packet_gen_type = "substract_string";
159

knopp's avatar
   
knopp committed
160
161
162
163
164
  for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++) {
    oai_emulation.application_config.predefined_traffic.source_id[i] = "1:10";
    oai_emulation.application_config.predefined_traffic.application_type[i] = "no_predefined_traffic";
    oai_emulation.application_config.predefined_traffic.background[i] = "disable";
    oai_emulation.application_config.predefined_traffic.aggregation_level[i] = 1;
165
166
    oai_emulation.application_config.predefined_traffic.flow_start[i] = 0;
    oai_emulation.application_config.predefined_traffic.flow_duration[i] = 1000;//uniform_dist((i+1)*100,0xffff);
167

knopp's avatar
   
knopp committed
168
    oai_emulation.application_config.predefined_traffic.destination_id[i] = 0;
169

knopp's avatar
   
knopp committed
170
171
172
173
174
175
176
    oai_emulation.application_config.customized_traffic.source_id[i] = "1";
    oai_emulation.application_config.customized_traffic.destination_id[i] = "2";
    oai_emulation.application_config.customized_traffic.transport_protocol[i] = "udp";
    oai_emulation.application_config.customized_traffic.background[i] = "disable";
    oai_emulation.application_config.customized_traffic.m2m[i] = "disable";
    oai_emulation.application_config.customized_traffic.ip_version[i] = "ipv4";
    oai_emulation.application_config.customized_traffic.aggregation_level[i] = 1;
177
178
    oai_emulation.application_config.customized_traffic.flow_start[i] = 0;// (i+1)*30;
    oai_emulation.application_config.customized_traffic.flow_duration[i] = 1000;// uniform_dist((i+1)*100,0xffff);
knopp's avatar
   
knopp committed
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    oai_emulation.application_config.customized_traffic.idt_dist[i] = "uniform";
    oai_emulation.application_config.customized_traffic.idt_min_ms[i] = 100;
    oai_emulation.application_config.customized_traffic.idt_max_ms[i] = 1000;
    oai_emulation.application_config.customized_traffic.idt_standard_deviation[i] = 1;
    oai_emulation.application_config.customized_traffic.idt_lambda[i] = 1;
    oai_emulation.application_config.customized_traffic.size_dist[i] = "uniform";
    oai_emulation.application_config.customized_traffic.size_min_byte[i] = 200;
    oai_emulation.application_config.customized_traffic.size_max_byte[i] = 500;
    oai_emulation.application_config.customized_traffic.size_standard_deviation[i] = 1;
    oai_emulation.application_config.customized_traffic.size_lambda[i] = 1;
    oai_emulation.application_config.customized_traffic.stream[i] = 1;
    oai_emulation.application_config.customized_traffic.destination_port[i] = 8080;
    oai_emulation.application_config.customized_traffic.prob_off_pu[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_off_ed[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_off_pe[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_pu_ed[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_pu_pe[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_ed_pe[i]= 0;
    oai_emulation.application_config.customized_traffic.prob_ed_pu[i]= 0;
    oai_emulation.application_config.customized_traffic.holding_time_off_ed[i]= 0;
    oai_emulation.application_config.customized_traffic.holding_time_off_pu[i]= 0;
    oai_emulation.application_config.customized_traffic.holding_time_off_pe[i]= 0;
    oai_emulation.application_config.customized_traffic.holding_time_pe_off[i]= 0;
    oai_emulation.application_config.customized_traffic.pu_size_pkts[i]= 0;
    oai_emulation.application_config.customized_traffic.ed_size_pkts[i]= 0;
  }
205

206
207
  /* protocol config */
  oai_emulation.protocol_config.eNB_mac_config.num_groups=1;
208
209


knopp's avatar
   
knopp committed
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
  oai_emulation.emulation_config.emulation_time_ms = 0;
  oai_emulation.emulation_config.curve = "disable";
  oai_emulation.emulation_config.background_stats = "disable";
  oai_emulation.emulation_config.performance_metrics.throughput = "disable";
  oai_emulation.emulation_config.performance_metrics.latency ="disable";
  oai_emulation.emulation_config.performance_metrics.loss_rate ="disable";
  oai_emulation.emulation_config.performance_metrics.owd_radio_access = "disable";
  oai_emulation.emulation_config.layer.phy = 0;
  oai_emulation.emulation_config.layer.mac = 0;
  oai_emulation.emulation_config.layer.rlc = 0;
  oai_emulation.emulation_config.layer.pdcp = 0;
  oai_emulation.emulation_config.layer.rrc = 0;
  oai_emulation.emulation_config.layer.omg = 0;
  oai_emulation.emulation_config.layer.otg = 0;
  oai_emulation.emulation_config.layer.emu = 1;
225

knopp's avatar
   
knopp committed
226
227
228
229
230
  oai_emulation.emulation_config.log_emu.level = "debug";
  oai_emulation.emulation_config.log_emu.verbosity = "low";
  oai_emulation.emulation_config.log_emu.interval = 1;
  oai_emulation.emulation_config.packet_trace.enabled = 0;
  oai_emulation.emulation_config.seed.value = 0; // 0 means randomly generated by OAI
231

knopp's avatar
   
knopp committed
232
  oai_emulation.info.ocg_ok = 0;
233
234


knopp's avatar
   
knopp committed
235
  // phy related params :
236
  oai_emulation.info.n_frames=MAX_FRAME_NUMBER; // number of frames simulated by default
knopp's avatar
   
knopp committed
237
  oai_emulation.info.n_frames_flag=0; // if set, then let the emulation goes to infinity
238

knopp's avatar
   
knopp committed
239
  //status
240
241
242
243
  oai_emulation.info.is_primary_master=0;
  oai_emulation.info.master_list=0;
  oai_emulation.info.nb_ue_remote=0;
  oai_emulation.info.nb_enb_remote=0;
244
  oai_emulation.info.nb_rn_remote=0;
245
246
  oai_emulation.info.first_ue_local=0;
  oai_emulation.info.first_enb_local=0;
247
  oai_emulation.info.first_rn_local=0;
248
  oai_emulation.info.master_id=0;
249
  oai_emulation.info.nb_ue_local= 1;//default 1 UE
250
  oai_emulation.info.nb_enb_local= 1;//default 1 eNB
251
  oai_emulation.info.nb_rn_local= 0;//default 0 RN : currently only applicable for eMBMS
252
253
254
255
256
257
258
  oai_emulation.info.ethernet_flag=0;
  oai_emulation.info.ocm_enabled=1;// flag ?
  oai_emulation.info.ocg_enabled=0;// flag c
  oai_emulation.info.otg_enabled=0;// flag T
  oai_emulation.info.opt_enabled=0; // P flag
  oai_emulation.info.opt_mode=-1; // arg for P flag
  oai_emulation.info.cli_enabled=0;// I flag
259
  oai_emulation.info.omv_enabled =0; // v flag
260
  oai_emulation.info.vcd_enabled=0;
261
  oai_emulation.info.opp_enabled=0;
262
  oai_emulation.info.oeh_enabled=0;
263

264
  oai_emulation.info.cba_group_active=0;
265
  oai_emulation.info.cba_backoff=30;
266
  oai_emulation.info.eMBMS_active_state=0;
267
  oai_emulation.info.handover_active=0;
268
  oai_emulation.info.omg_model_enb=STATIC; //default to static mobility model
269
  oai_emulation.info.omg_model_rn=STATIC; //default to static mobility model
270
  oai_emulation.info.omg_model_ue=STATIC; //default to static mobility model
271
  oai_emulation.info.omg_rwp_type = RESTIRICTED_RWP;
272
  oai_emulation.info.omg_model_ue_current=STATIC; //default to static mobility model
nikaeinn's avatar
nikaeinn committed
273
  oai_emulation.info.otg_traffic="no_predefined_traffic";
274
  oai_emulation.info.otg_bg_traffic_enabled = 0; // G flag
275
276
  oai_emulation.info.max_predefined_traffic_config_index = 0;
  oai_emulation.info.max_customized_traffic_config_index = 0;
277
278
279
  oai_emulation.info.frame = 0; // frame counter of emulation
  oai_emulation.info.time_s = 0; // time of emulation
  oai_emulation.info.time_ms = 0; // time of emulation
280
281
282
283
  oai_emulation.info.seed = time(NULL); // time-based random seed , , included in ocg report

  oai_emulation.info.cli_num_enb= NUMBER_OF_eNB_MAX;
  oai_emulation.info.cli_num_ue= NUMBER_OF_UE_MAX;
284
285
286

  oai_emulation.info.slot_isr = 0;
  oai_emulation.info.slot_sfd = -1;
287

288
289
  //for (i=0; i < oai_emulation.info.cli_num_enb; i++)
  for (i=0; i < NUMBER_OF_eNB_MAX; i++)
290
    oai_emulation.info.cli_start_enb[i]=1;
291
292
293
294

  // for (i=0; i < oai_emulation.info.cli_num_ue; i++)
  for (i=0; i < NUMBER_OF_UE_MAX; i++)
    oai_emulation.info.cli_start_ue[i]=1;
295

296
297
  for (i=0; i < NUMBER_OF_eNB_MAX+NUMBER_OF_UE_MAX; i++)
    oai_emulation.info.oai_ifup[i]=0;
298
299
300
301

  oai_emulation.info.nb_master       =0;
  oai_emulation.info.ethernet_id     =0;
  oai_emulation.info.multicast_group =0;
302
  oai_emulation.info.multicast_ifname=NULL;
303
  oai_emulation.info.g_log_level     = LOG_INFO;
304
305
  oai_emulation.info.g_log_verbosity = 0x15;
  oai_emulation.info.g_log_verbosity_option = "medium";
306

307
  for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
knopp's avatar
   
knopp committed
308
309
310
311
312
313
314
315
    oai_emulation.info.frame_type[CC_id]=TDD;
    oai_emulation.info.frame_type_name[CC_id]="TDD";
    oai_emulation.info.tdd_config[CC_id]=3;
    oai_emulation.info.tdd_config_S[CC_id]=0;
    oai_emulation.info.extended_prefix_flag[CC_id]=0;
    oai_emulation.info.N_RB_DL[CC_id]=25;
    oai_emulation.info.transmission_mode[CC_id]=2;
  }
316

317
  oai_emulation.profile = "EURECOM";
318
319
320
}


321
322
void oaisim_config(void)
{
323
324

  // init log gen first
325
  //initialize the log generator
knopp's avatar
   
knopp committed
326
327


328
329
  logInit();

330
331
#if defined(ENABLE_ITTI)
  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file);
332
  MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
333
334
#endif

335
  // init ocg if enabled, otherwise take the params form the init_oai_emulation()
336
337
  //  and command line options given by the user
  if (oai_emulation.info.ocg_enabled == 1) { // activate OCG: xml-based scenario parser
338
    OCG_main(oai_emulation.info.local_server);// eurecom or portable
339
340

    if (oai_emulation.info.ocg_ok != 1) {
341
342
343
      LOG_E(OCG, "Error found by OCG; emulation not launched.\n");
      LOG_E(OCG, "Please find more information in the OCG_report.xml located at %s.\n", oai_emulation.info.output_path);
      exit (-1);
344
345
346
    }
  }

347

348
#if ENABLE_RAL
349
350
351
  mRAL_init_default_values();
  eRAL_init_default_values();
#endif
352
  olg_config();
353
  ocg_config_emu();
354
355
  ocg_config_env();// mobility gen
  ocg_config_topo(); // packet tracer using wireshark
356
  ocg_config_proto();
357

358
  // if T is set or ocg enabled
359
360
361
362
363
364
365
366
367
368
  if (oai_emulation.info.otg_enabled ) {
    set_component_filelog(OTG);
    set_component_filelog(OTG_LATENCY);
    set_component_filelog(OTG_GP);
    set_component_filelog(OTG_LATENCY_BG);
    set_component_filelog(OTG_GP_BG);
    set_component_filelog(OTG_JITTER);
    /* g_log->log_component[OTG].filelog=1;
    g_log->log_component[OTG_LATENCY].filelog=1;
    g_log->log_component[OTG_OWD].filelog = 1;*/
369
    ocg_config_app(); // packet generator
370
  }
371

372
373
374
  // add a var to control this, and pass this var to OMG
  set_component_filelog(OMG);
  LOG_I(OMG,"setting OMG file log \n");
375

376
377
}

378
379
int olg_config(void)
{
380
  int comp;
381
382
383
384
385
  int ocg_log_level     = map_str_to_int(log_level_names,     oai_emulation.emulation_config.log_emu.level);
  int ocg_log_verbosity = map_str_to_int(log_verbosity_names, oai_emulation.emulation_config.log_emu.verbosity);
  // fix me:
  oai_emulation.info.g_log_level     = ((oai_emulation.info.ocg_enabled == 1)  && (ocg_log_level != -1))     ? ocg_log_level : oai_emulation.info.g_log_level;
  oai_emulation.info.g_log_verbosity = (((oai_emulation.info.ocg_enabled == 1) && (ocg_log_verbosity != -1)) ? ocg_log_verbosity :
386
                                        map_str_to_int(log_verbosity_names, oai_emulation.info.g_log_verbosity_option));
387
  set_glog(oai_emulation.info.g_log_level, oai_emulation.info.g_log_verbosity ); //g_glog
388

389
390
  // component, log level, log interval
  for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++)
391
392
393
394
    set_comp_log(comp,
                 oai_emulation.info.g_log_level,
                 oai_emulation.info.g_log_verbosity,
                 oai_emulation.emulation_config.log_emu.interval);
395

396
  LOG_I(EMU, "OCG log level %d, oai log level%d \n ",ocg_log_level, oai_emulation.info.g_log_level);
397
  LOG_N(EMU,"global log level is set to (%s,%d) with vebosity (%s, 0x%x) and frequency %d\n",
398
399
400
401
402
        map_int_to_str (log_level_names, oai_emulation.info.g_log_level),
        oai_emulation.info.g_log_level,
        map_int_to_str (log_verbosity_names,oai_emulation.info.g_log_verbosity),
        oai_emulation.info.g_log_verbosity,
        oai_emulation.emulation_config.log_emu.interval );
403
404


405
  /*
406
  // if perf eval then reset the otg log level
407
408
409
410
411
  set_comp_log(PHY,  LOG_EMERG, 0x15,1);
  set_comp_log(EMU,  LOG_EMERG, 0x15,1);
  set_comp_log(OCG,  LOG_EMERG, 0x15,1);
  set_comp_log(OCM,  LOG_EMERG, 0x15,1);
  set_comp_log(OTG,  LOG_EMERG, 0x15,1);
412
  set_comp_log(MAC,  LOG_EMERG, 0x15,1);
413
414
  set_comp_log(OMG,  LOG_EMERG, 0x15,1);
  set_comp_log(OPT,  LOG_EMERG, 0x15,1);
415
416
417
  set_comp_log(PDCP, LOG_DEBUG, LOG_MED,1);
  set_comp_log(RLC,  LOG_DEBUG, LOG_MED,1);
  set_comp_log(RRC,  LOG_DEBUG, LOG_MED,1);
418
  */
gauthier's avatar
gauthier committed
419
420
421
422
423
424
425
#if defined(ENABLE_USE_MME)
  set_comp_log(UDP_,  LOG_DEBUG, LOG_MED,1);
  set_comp_log(GTPU,  LOG_DEBUG, LOG_MED,1);
  set_comp_log(SPGW,  LOG_DEBUG, LOG_MED,1);
  set_comp_log(S1AP,  LOG_DEBUG, LOG_MED,1);
  set_comp_log(SCTP,  LOG_DEBUG, LOG_MED,1);
#endif
426

427
#if ENABLE_RAL
428
429
430
431
432
  set_comp_log(RAL_ENB, LOG_TRACE, LOG_MED,1);
  set_comp_log(RAL_UE,  LOG_TRACE, LOG_MED,1);
  set_log(RAL_ENB,  LOG_DEBUG, 1);
  set_log(RAL_UE,  LOG_DEBUG, 1);
#endif
gauthier's avatar
gauthier committed
433

434

435
436
437
438
439
440
441
442
443
444
   //set_log(OCG,  LOG_DEBUG, 1);
   //set_log(EMU,  LOG_INFO,  20);
   set_log(MAC,  LOG_DEBUG, 1);
   set_log(RLC,  LOG_TRACE, 1);
   //set_log(PHY,  LOG_DEBUG, 1);
   set_log(PDCP, LOG_TRACE, 1);
   set_log(RRC,  LOG_DEBUG, 1);
   //set_log(OCM,  LOG_INFO, 20);
   //set_log(OTG,  LOG_INFO, 1);
   set_comp_log(OCG,  LOG_ERR, 0x15,1);
nikaeinn's avatar
nikaeinn committed
445
   set_comp_log(EMU,  LOG_DEBUG,  0x15,20);
446
447
448
   set_comp_log(MAC,  LOG_TRACE, 0x15,1);
   set_comp_log(RLC,  LOG_TRACE, 0x15,1);
   set_comp_log(PHY,  LOG_TRACE, 0x15, 1);
449
450
   set_comp_log(PDCP, LOG_DEBUG, 0x15,1);
   set_comp_log(RRC,  LOG_DEBUG, 0x15,1);
451
   set_comp_log(OCM,  LOG_DEBUG, 0x15,20);
nikaeinn's avatar
nikaeinn committed
452
   set_comp_log(OTG,  LOG_DEBUG, 0x15,1);
453
   set_comp_log(OMG,  LOG_NOTICE, 0x15,1);
454
   set_comp_log(OPT,  LOG_ERR, 0x15,1);
455

gauthier's avatar
gauthier committed
456

457
  // set_comp_log(MAC, LOG_TRACE, LOG_FULL,1);
458
  return 1;
459
460
}

461
462
463
int ocg_config_env(void)
{
  // int func related to channel desc from oaisim.c could be moved here
knopp's avatar
   
knopp committed
464
  int CC_id;
465

466
467
  if (oai_emulation.info.ocg_enabled) {
    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
knopp's avatar
   
knopp committed
468
      oai_emulation.info.frame_type[CC_id] = map_str_to_int(frame_type_names, oai_emulation.info.frame_type_name[CC_id]);
469
470

      if (oai_emulation.info.frame_type[CC_id] == -1) {
471
        LOG_E(EMU,"frame type incorrect %s, set it to TDD \n",oai_emulation.info.frame_type_name[CC_id]);
472
473
474
475
476
477
478
479
480
        oai_emulation.info.frame_type[CC_id]=TDD;
      } else
        LOG_I(EMU,"Frame type is %s \n",oai_emulation.info.frame_type_name[CC_id]);

      if (oai_emulation.info.frame_type[CC_id] == TDD ) {
        if ((oai_emulation.info.tdd_config[CC_id] > 6) || (oai_emulation.info.tdd_config[CC_id] < 0)) {
          LOG_E(EMU,"TDD config %d out of range, set it to 3\n",oai_emulation.info.tdd_config[CC_id]);
          oai_emulation.info.tdd_config[CC_id]=3;
        } else
481
          LOG_I(EMU,"TDD config is set to %d\n",oai_emulation.info.tdd_config[CC_id]);
knopp's avatar
   
knopp committed
482
      }
483
    }
484
  }
485

486
  return 1;
487
}
488
489
int ocg_config_topo(void)
{
490

491
492
493
  int i;
  // omg
  init_omg_global_params();
494

495
496
497
  // setup params for openair mobility generator
  //common params
  for(i=0; i < MAX_NUM_NODE_TYPES; i++) {
498

499
500
501
502
503
504
505
506
507
508
509
510
511
    omg_param_list[i].min_x = 0;
    omg_param_list[i].max_x = oai_emulation.topology_config.area.x_m;
    omg_param_list[i].min_y = 0;
    omg_param_list[i].max_y= oai_emulation.topology_config.area.y_m;
    // init values
    omg_param_list[i].min_speed = 0.1;
    omg_param_list[i].max_speed = 20.0;
    omg_param_list[i].min_journey_time = 0.1;
    omg_param_list[i].max_journey_time = 10.0;
    omg_param_list[i].min_azimuth = 0; // ???
    omg_param_list[i].max_azimuth = 360; // ???
    omg_param_list[i].min_sleep = 0.1;
    omg_param_list[i].max_sleep = 8.0;
512
    omg_param_list[i].nodes_type = i;
513
514
    omg_param_list[i].nodes=0;
    omg_param_list[i].mobility_type=STATIC;
515

516
    // init OMG for eNBs
517

518
519
    if(i==eNB) {
      if ((oai_emulation.info.omg_model_enb = map_str_to_int(omg_model_names, oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option))== -1)
520
521
        oai_emulation.info.omg_model_enb = STATIC;

522
      LOG_I(OMG,"eNB mobility model is (%s, %d)\n",
523
524
525
526
            oai_emulation.topology_config.mobility.eNB_mobility.eNB_mobility_type.selected_option,
            oai_emulation.info.omg_model_enb);

      omg_param_list[i].mobility_type = oai_emulation.info.omg_model_enb;
527
528
      omg_param_list[i].nodes = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_rn_local;
      omg_param_list[i].seed = oai_emulation.info.seed; // specific seed for enb and ue to avoid node overlapping
529
530


531
      if (oai_emulation.info.omg_model_enb == TRACE) {
532
533
534
535
536
537
538
539
540
541
542
543
        omg_param_list[i].mobility_file = (char*) malloc(256);// user-specific trace file "%s/UTIL/OMG/mobility.txt",getenv("OPENAIR2_DIR")
        //memset(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,0,256);
        //sprintf(omg_param_list.mobility_file,"%s",oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
        sprintf(omg_param_list[i].mobility_file,"%s/UTIL/OMG/TRACE/%s",
                getenv("OPENAIR2_DIR"),
                oai_emulation.topology_config.mobility.eNB_mobility.trace_config.trace_mobility_file);
        LOG_I(OMG,"TRACE file at %s\n", omg_param_list[i].mobility_file);
        // notify the user if the file is not found
      }



544
      if (strcmp(oai_emulation.topology_config.mobility.eNB_mobility.eNB_initial_distribution.selected_option, "fixed") == 0) {
545
546
547
        omg_param_list[i].user_fixed = true;
        omg_param_list[i].fixed_x = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_x;
        omg_param_list[i].fixed_y = (double)oai_emulation.topology_config.mobility.eNB_mobility.fixed_eNB_distribution.pos_y;
548
      }
549

550
      /*// at this moment, we use the above moving dynamics for mobile eNB
551
552
553
554
555
556
      if (omg_param_list.nodes >0 )
      init_mobility_generator(omg_param_list);*/

    } else if (i== UE) {      // init OMG for UE


557
558
      // input of OMG: STATIC: 0, RWP: 1, RWALK 2, or TRACE 3, or SUMO or STEADY_RWP
      if ((oai_emulation.info.omg_model_ue = map_str_to_int(omg_model_names, oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option))== -1)
559
560
        oai_emulation.info.omg_model_ue = STATIC;

561
      LOG_I(OMG,"UE mobility model is (%s, %d)\n",
562
563
564
            oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option,
            oai_emulation.info.omg_model_ue);

565
      if (oai_emulation.info.omg_model_ue == RWP) {
566
567
568
569
570
571
572
573
574
575
576
577
578
579
        oai_emulation.info.omg_rwp_type = map_str_to_int(omg_rwp_names,oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option);

        if (oai_emulation.info.omg_rwp_type == -1) {
          LOG_I(OMG,"Apply standard RWP model \n");
        } else {
          LOG_I(OMG,"Apply %s mobility model (%d) \n", oai_emulation.topology_config.mobility.UE_mobility.grid_walk.grid_map.selected_option,
                oai_emulation.info.omg_rwp_type);
          omg_param_list[i].rwp_type=  oai_emulation.info.omg_rwp_type;
          omg_param_list[i].max_vertices =
            max_vertices_ongrid (omg_param_list[i]);

          omg_param_list[i].max_block_num =
            max_connecteddomains_ongrid (omg_param_list[i]);
        }
580
      }
581

582
      omg_param_list[i].mobility_type    = oai_emulation.info.omg_model_ue;
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
      omg_param_list[i].nodes = oai_emulation.info.nb_ue_local+ oai_emulation.info.nb_rn_local;
      omg_param_list[i].seed = oai_emulation.info.seed + oai_emulation.info.nb_ue_local; //fixme: specific seed for enb and ue to avoid node overlapping

      omg_param_list[i].min_speed = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps == 0) ? 0.1 :
                                    oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_speed_mps;

      omg_param_list[i].max_speed = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps == 0) ? 0.1 :
                                    oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_speed_mps;

      omg_param_list[i].min_journey_time = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms == 0) ? 0.1 :
                                           oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_journey_time_ms;

      omg_param_list[i].max_journey_time = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms == 0) ? 0.1 :
                                           oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_journey_time_ms;

      omg_param_list[i].min_azimuth = 0.1; // wait for advanced OSD
      omg_param_list[i].max_azimuth = 360;

      omg_param_list[i].min_sleep = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms == 0) ? 0.1 :
                                    oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.min_sleep_ms;

      omg_param_list[i].max_sleep = (oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms == 0) ? 0.1 :
                                    oai_emulation.topology_config.mobility.UE_mobility.UE_moving_dynamics.max_sleep_ms;


      if (oai_emulation.info.omg_model_ue == TRACE) {
        omg_param_list[i].mobility_file = (char*) malloc(256);// user-specific trace file "%s/UTIL/OMG/mobility.txt",getenv("OPENAIR2_DIR")
        //memset(oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file,0,256);
        //sprintf(omg_param_list.mobility_file,"%s",oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
        snprintf( omg_param_list[i].mobility_file, 256, "%s/UTIL/OMG/TRACE/%s",
                  getenv("OPENAIR2_DIR"),
                  oai_emulation.topology_config.mobility.UE_mobility.trace_config.trace_mobility_file);
        LOG_I(OMG,"TRACE file at %s\n", omg_param_list[i].mobility_file);

      } else if (oai_emulation.info.omg_model_ue == SUMO) {
        omg_param_list[i].sumo_command = (char*) malloc(20);
        sprintf(omg_param_list[i].sumo_command, "%s", oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command);
        omg_param_list[i].sumo_config = (char*) malloc(256);
        sprintf(omg_param_list[i].sumo_config, "%s", oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file);
        omg_param_list[i].sumo_start = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.start;

        if (oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end > 0 )
          omg_param_list[i].sumo_end = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.end;
        else
          omg_param_list[i].sumo_end = (oai_emulation.info.n_frames_flag == 1 ) ?  oai_emulation.info.n_frames : MAX_FRAME_NUMBER ; // fixme: the else case is infinity

        omg_param_list[i].sumo_step = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.step=1; //  1000ms
        omg_param_list[i].sumo_host = (char*) malloc(40);
        sprintf(omg_param_list[i].sumo_host,"%s",oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip);
        omg_param_list[i].sumo_port = oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hport ;
        LOG_D(OMG, "opt (%s,%d) cmd (%s,%s) config_file (%s,%s) hip (%s,%s) \n",
              oai_emulation.topology_config.mobility.UE_mobility.UE_mobility_type.selected_option,oai_emulation.info.omg_model_ue,
              omg_param_list[i].sumo_command, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.command,
              omg_param_list[i].sumo_config, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.file,
              omg_param_list[i].sumo_host, oai_emulation.topology_config.mobility.UE_mobility.sumo_config.hip);
      }

640
    }
641

642
643
    if (oai_emulation.topology_config.omv == 1 )
      oai_emulation.info.omv_enabled =  1;
644

645
  }//for
646
647


648
  init_mobility_generator(omg_param_list);
649

650
  return 1;
651
652
653
654
}



655
656
int ocg_config_app(void)
{
657
658
659
660
661
662
663
664

  char colon[] = ":";
  char comma[] = ",";
  char tmp_source_id[128];
  char tmp_destination_id[128];
  char *check_format1;
  char *check_format2;
  char *check_format1_dst;
665
666
  char *source_id_start = NULL;
  char *source_id_end = NULL;
667
668
669
670
671
672
673
674
675
676
  char *destination_id_start;
  char *destination_id_end;
  int sid_start;
  int sid_end;
  int did_start;
  int did_end;
  char *per_source_id;
  int source_id_index;
  int destination_id_index;
  int i,j,k,l;
677

678
679
  int predefined_traffic_config_index;
  int customized_traffic_config_index;
680
681
  unsigned int state;

682
683
684
685
686
687
688
689
690
  init_all_otg(oai_emulation.info.n_frames);
  g_otg->seed= oai_emulation.info.seed;
  g_otg->num_nodes = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_ue_local;
  g_otg->throughput_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.throughput);
  g_otg->latency_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.latency);
  g_otg->loss_metric =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.loss_rate);
  g_otg->owd_radio_access =map_str_to_int(switch_names,oai_emulation.emulation_config.performance_metrics.owd_radio_access);
  g_otg->curve=map_str_to_int(switch_names,oai_emulation.emulation_config.curve);
  g_otg->background_stats=map_str_to_int(switch_names,oai_emulation.emulation_config.background_stats);
691

692
  g_otg->packet_gen_type=map_str_to_int(packet_gen_names,oai_emulation.application_config.packet_gen_type);
693

nikaeinn's avatar
nikaeinn committed
694
  LOG_I(OTG,"Metrics: Throuput %s(%d), One-way latency %s(%d) for %s, loss rate %s(%d), online curves %s(%d)\n",
695
696
697
698
699
        oai_emulation.emulation_config.performance_metrics.throughput,g_otg->throughput_metric,
        oai_emulation.emulation_config.performance_metrics.latency,g_otg->latency_metric,
        (g_otg->owd_radio_access==1)? "Radio Access Network" : "End to End",
        oai_emulation.emulation_config.performance_metrics.loss_rate,g_otg->loss_metric,
        oai_emulation.emulation_config.curve,g_otg->curve );
nikaeinn's avatar
nikaeinn committed
700

701
  for (i=0; i<g_otg->num_nodes; i++) {
702

703
    for (j=0; j<g_otg->num_nodes; j++) {
704
705
706
      // g_otg->duration[i][j]=oai_emulation.emulation_config.emulation_time_ms;
      g_otg->dst_port[i][j]=oai_emulation.application_config.customized_traffic.destination_port[i];
      g_otg->dst_ip[i][j]=oai_emulation.application_config.customized_traffic.destination_id[i];
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
      for (k=0; k<MAX_NUM_APPLICATION; k++) {
        g_otg->ip_v[i][j][k]=map_str_to_int(otg_ip_version_names, oai_emulation.application_config.customized_traffic.ip_version[i]);
        g_otg->trans_proto[i][j][k]=map_str_to_int(otg_transport_protocol_names, oai_emulation.application_config.customized_traffic.transport_protocol[i]);
        g_otg->application_type[i][j][k]=map_str_to_int(otg_app_type_names, "no_predefined_traffic");
        g_otg->aggregation_level[i][j][k]=oai_emulation.application_config.customized_traffic.aggregation_level[i];

        g_otg->flow_start[i][j][k]=flow_start_time(i,j,oai_emulation.info.n_frames,
                                   oai_emulation.application_config.customized_traffic.flow_start[i+j],
                                   oai_emulation.application_config.customized_traffic.flow_duration[i+j]);
        g_otg->flow_duration[i][j][k]=oai_emulation.application_config.customized_traffic.flow_duration[i+j];

        for (l=0; l<MAX_NUM_TRAFFIC_STATE; l++) {
          g_otg->idt_dist[i][j][k][l]=map_str_to_int(otg_distribution_names, "no_customized_traffic");
          g_otg->idt_min[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_min_ms[i];
          g_otg->idt_max[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_max_ms[i];
          g_otg->idt_std_dev[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_standard_deviation[i];
          g_otg->idt_lambda[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_lambda[i];
          g_otg->idt_scale[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_scale[i];
          g_otg->idt_shape[i][j][k][l]=oai_emulation.application_config.customized_traffic.idt_shape[i];
          g_otg->size_dist[i][j][k][l]=map_str_to_int(otg_distribution_names, "no_customized_traffic");
          g_otg->size_min[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_min_byte[i];
          g_otg->size_max[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_max_byte[i];
          g_otg->size_std_dev[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_standard_deviation[i];
          g_otg->size_lambda[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_lambda[i];
          g_otg->size_scale[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_scale[i];
          g_otg->size_shape[i][j][k][l]=oai_emulation.application_config.customized_traffic.size_shape[i];
        }
735
736
737
      }
    }
  }
738

739
740
  LOG_D(OTG,"initializing the RNG with %s %d\n",(g_otg->seed==0)?"Random Seed" : "Fixed Seed", g_otg->seed);
  init_seeds(g_otg->seed); // initialize all the nodes, then configure the nodes the user specifically did in the XML in the following
741

742
  LOG_I(OTG,"oai_emulation.info.max_predefined_traffic_config_index = %d\n", oai_emulation.info.max_predefined_traffic_config_index);
743
  LOG_I(OTG,"oai_emulation.info.max_customized_traffic_config_index = %d\n", oai_emulation.info.max_customized_traffic_config_index);
744

745
746
747

  if (oai_emulation.info.ocg_ok) {
    ///// for the predefined traffic
748
    for (predefined_traffic_config_index = 1;
749
750
         predefined_traffic_config_index <= oai_emulation.info.max_predefined_traffic_config_index;
         predefined_traffic_config_index++) {
751

752
      LOG_I(OTG,"OCG_config_OTG: predefined no. %d\n", predefined_traffic_config_index);
753

nikaeinn's avatar
nikaeinn committed
754
755
756
757
758
759
      //strcpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
      //strcpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
      strncpy(tmp_source_id, oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index], sizeof(tmp_source_id));
      tmp_source_id[sizeof(tmp_source_id) - 1] = 0; // terminate string
      strncpy(tmp_destination_id, oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index], sizeof(tmp_destination_id));
      tmp_destination_id[sizeof(tmp_destination_id) - 1] = 0; // terminate string
760
761
762
      check_format1 = strstr(tmp_source_id, colon);
      check_format2 = strstr(tmp_source_id, comma);
      check_format1_dst = strstr(tmp_destination_id, colon);
763
764


765
      if (check_format1 != NULL) { // format 1:10
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
        source_id_start = strtok(tmp_source_id, colon);
        source_id_end = strtok(NULL, colon);

        sid_start = atoi(source_id_start);
        sid_end = atoi(source_id_end);

        //destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
        if (check_format1_dst != NULL) { // format 1:10
          destination_id_start = strtok(tmp_destination_id, colon);
          destination_id_end = strtok(NULL, colon);

          did_start = atoi(destination_id_start);
          did_end = atoi(destination_id_end);
        } else {
          did_start = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
          did_end = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
        }

        for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
          for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
            if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
              g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
                  oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);

              g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                  oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
              g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
              g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=  flow_start_time(source_id_index,destination_id_index,
                  oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
                  oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
              g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];

              LOG_I(OTG,"predef (1):: OCG_config_OTG [MAX UE=%d] [MAX eNB=%d]: FORMAT (%d:%d) source = %d, dest = %d, Application ID = %d background %d, Aggregation=%d , m2m= %d, flow start/duration %d/%d \n",
                    oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local,  sid_start, sid_end, source_id_index, destination_id_index,
                    g_otg->application_idx[source_id_index][destination_id_index],
                    g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
              g_otg->application_idx[source_id_index][destination_id_index]+=1;
            }
          }
        }
812
      } else if (check_format2 != NULL) { // format 1,2,3,5
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
        per_source_id = strtok(tmp_source_id, comma);
        destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);

        while (per_source_id != NULL) {
          source_id_index = atoi(per_source_id);

          if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
            g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
                oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);
            g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
            g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
            g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index, destination_id_index,
                oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
                oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
            g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];
            g_otg->application_idx[source_id_index][destination_id_index]+=1;
          }

          per_source_id = strtok(NULL, comma);

        }
837
      } else { // single node configuration
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
        source_id_index = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
        //destination_id_index = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
        sid_start = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);
        sid_end = atoi(oai_emulation.application_config.predefined_traffic.source_id[predefined_traffic_config_index]);

        if (check_format1_dst != NULL) { // format 1:10
          destination_id_start = strtok(tmp_destination_id, colon);
          destination_id_end = strtok(NULL, colon);

          did_start = atoi(destination_id_start);
          did_end = atoi(destination_id_end);
        } else {
          did_start = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
          did_end = atoi(oai_emulation.application_config.predefined_traffic.destination_id[predefined_traffic_config_index]);
        }

        for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
          for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
            if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
              g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_app_type_names,
                  oai_emulation.application_config.predefined_traffic.application_type[predefined_traffic_config_index]);
              g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                  oai_emulation.application_config.predefined_traffic.background[predefined_traffic_config_index]);
              g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.predefined_traffic.aggregation_level[predefined_traffic_config_index];
              g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index,destination_id_index,
                  oai_emulation.info.n_frames,oai_emulation.application_config.predefined_traffic.flow_start[predefined_traffic_config_index],
                  oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index]);
              g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.predefined_traffic.flow_duration[predefined_traffic_config_index];

              LOG_I(OTG,"predef (2):: OCG_config_OTG: [MAX UE=%d] [MAX eNB=%d]: FORMAT (%d:%d) source = %d, dest = %d, Application ID %d, type %d, Background=%d, Aggregation=%d, m2m=%d, start/duration %d/%d\n",
                    oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local, sid_start, sid_end, source_id_index, destination_id_index,
                    g_otg->application_idx[source_id_index][destination_id_index],
                    g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
              g_otg->application_idx[source_id_index][destination_id_index]+=1;
            }
          }
        }
882
      }
883

884
885
      init_predef_traffic(oai_emulation.info.nb_ue_local, oai_emulation.info.nb_enb_local);
    }
886

887
    ///////// for the customized traffic
888
    for (customized_traffic_config_index = 1;
889
890
         customized_traffic_config_index <= oai_emulation.info.max_customized_traffic_config_index;
         customized_traffic_config_index++) {
891

892
893
      LOG_I(OTG,"OCG_config_OTG: customized no. %d, max_customized %d \n", customized_traffic_config_index, oai_emulation.info.max_customized_traffic_config_index);
      strcpy(tmp_source_id, oai_emulation.application_config.customized_traffic.source_id[customized_traffic_config_index]);
894

895
896
      check_format1 = strstr(tmp_source_id, colon);
      check_format2 = strstr(tmp_source_id, comma);
897

898
899
      strcpy(tmp_destination_id, oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
      check_format1_dst = strstr(tmp_destination_id, colon);
900
901
      state=PE_STATE;

902
      if (check_format1 != NULL) { // format 1:10
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
        source_id_start = strtok(tmp_source_id, colon);
        source_id_end = strtok(NULL, colon) ;

        sid_start = atoi(source_id_start);
        sid_end = atoi(source_id_end);

        if (check_format1_dst != NULL) { // format 1:10
          destination_id_start = strtok(tmp_destination_id, colon);
          destination_id_end = strtok(NULL, colon);

          did_start = atoi(destination_id_start);
          did_end = atoi(destination_id_end);
        } else {
          did_start = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
          did_end = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);
        }

        for (destination_id_index = did_start; destination_id_index <= did_end; destination_id_index++) {
          for (source_id_index = sid_start; source_id_index <= sid_end; source_id_index++) {
            if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst
              g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(switch_names,
                  oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]);
              g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                  oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]);
              g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names,
                  oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]);
              g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names,
                  oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]);
              g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.aggregation_level[customized_traffic_config_index];
              g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]= flow_start_time(source_id_index,destination_id_index,
                  oai_emulation.info.n_frames,oai_emulation.application_config.customized_traffic.flow_start[customized_traffic_config_index],
                  oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index]);
              g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index];
              g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
                  oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
              //  printf("[OTG] config index %d dist %s\n", customized_traffic_config_index,oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
              g_otg->idt_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_min_ms[customized_traffic_config_index];
              g_otg->idt_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_max_ms[customized_traffic_config_index];
              g_otg->idt_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_standard_deviation[customized_traffic_config_index];
              g_otg->idt_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_lambda[customized_traffic_config_index];
              g_otg->idt_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_scale[customized_traffic_config_index];
              g_otg->idt_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.idt_shape[customized_traffic_config_index];
              g_otg->size_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
                  oai_emulation.application_config.customized_traffic.size_dist[customized_traffic_config_index]);
              g_otg->size_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_min_byte[customized_traffic_config_index];
              g_otg->size_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_max_byte[customized_traffic_config_index];
              g_otg->size_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_standard_deviation[customized_traffic_config_index];
              g_otg->size_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_lambda[customized_traffic_config_index];
              g_otg->size_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_scale[customized_traffic_config_index];
              g_otg->size_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
                oai_emulation.application_config.customized_traffic.size_shape[customized_traffic_config_index];
              g_otg->dst_port[source_id_index][destination_id_index] = oai_emulation.application_config.customized_traffic.destination_port[customized_traffic_config_index];
              g_otg->pu_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.pu_size_pkts[customized_traffic_config_index];
              g_otg->ed_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.ed_size_pkts[customized_traffic_config_index];
              g_otg->prob_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_off_pu[customized_traffic_config_index];
              g_otg->prob_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_off_ed[customized_traffic_config_index];
              g_otg->prob_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_off_pe[customized_traffic_config_index];
              g_otg->prob_pu_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_pu_ed[customized_traffic_config_index];
              g_otg->prob_pu_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_pu_pe[customized_traffic_config_index];
              g_otg->prob_ed_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_ed_pe[customized_traffic_config_index];
              g_otg->prob_ed_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.prob_ed_pu[customized_traffic_config_index];
              g_otg->holding_time_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.holding_time_off_ed[customized_traffic_config_index];
              g_otg->holding_time_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.holding_time_off_pu[customized_traffic_config_index];
              g_otg->holding_time_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.holding_time_off_pe[customized_traffic_config_index];
              g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
                oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index];

              LOG_I(OTG,"customized:: OCG_config_OTG: (1) FORMAT (%d:%d) source = %d, dest = %d, Application = %d, state %d, background %d IDT DIST %d start/duration %d/%d\n", sid_start, sid_end, source_id_index,
                    destination_id_index,
                    g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    state,
                    g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state],
                    g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                    g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);

              g_otg->application_idx[source_id_index][destination_id_index]+=1;
            }
          }
        }
1008

1009
      } else if (check_format2 != NULL) { // format 1,2,3,5
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
        per_source_id = strtok(tmp_source_id, comma);
        destination_id_index = atoi(oai_emulation.application_config.customized_traffic.destination_id[customized_traffic_config_index]);

        while (per_source_id != NULL) {
          source_id_index = atoi(per_source_id);

          if (g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] == 0) { // no app is defined for this pair src.dst

            g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]);
            g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,
                oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]);
            g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names,
                oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]);
            g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names,
                oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]);
            g_otg->aggregation_level[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.aggregation_level[customized_traffic_config_index];
            g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=flow_start_time(source_id_index,destination_id_index,
                oai_emulation.info.n_frames,oai_emulation.application_config.customized_traffic.flow_start[customized_traffic_config_index],
                oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index]);
            g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.flow_duration[customized_traffic_config_index];
            g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
                oai_emulation.application_config.customized_traffic.idt_dist[customized_traffic_config_index]);
            g_otg->idt_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_min_ms[customized_traffic_config_index];
            g_otg->idt_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_max_ms[customized_traffic_config_index];
            g_otg->idt_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_standard_deviation[customized_traffic_config_index];
            g_otg->idt_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_lambda[customized_traffic_config_index];
            g_otg->idt_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_scale[customized_traffic_config_index];
            g_otg->idt_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.idt_shape[customized_traffic_config_index];
            g_otg->size_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] = map_str_to_int(otg_distribution_names,
                oai_emulation.application_config.customized_traffic.size_dist[customized_traffic_config_index]);
            g_otg->size_min[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_min_byte[customized_traffic_config_index];
            g_otg->size_max[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_max_byte[customized_traffic_config_index];
            g_otg->size_std_dev[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_standard_deviation[customized_traffic_config_index];
            g_otg->size_lambda[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_lambda[customized_traffic_config_index];
            g_otg->size_scale[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_scale[customized_traffic_config_index];
            g_otg->size_shape[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state] =
              oai_emulation.application_config.customized_traffic.size_shape[customized_traffic_config_index];
            g_otg->dst_port[source_id_index][destination_id_index] = oai_emulation.application_config.customized_traffic.destination_port[customized_traffic_config_index];
            g_otg->pu_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.pu_size_pkts[customized_traffic_config_index];
            g_otg->ed_size_pkts[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.ed_size_pkts[customized_traffic_config_index];
            g_otg->prob_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_off_pu[customized_traffic_config_index];
            g_otg->prob_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_off_ed[customized_traffic_config_index];
            g_otg->prob_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_off_pe[customized_traffic_config_index];
            g_otg->prob_pu_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_pu_ed[customized_traffic_config_index];
            g_otg->prob_pu_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_pu_pe[customized_traffic_config_index];
            g_otg->prob_ed_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_ed_pe[customized_traffic_config_index];
            g_otg->prob_ed_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.prob_ed_pu[customized_traffic_config_index];
            g_otg->holding_time_off_ed[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.holding_time_off_ed[customized_traffic_config_index];
            g_otg->holding_time_off_pu[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.holding_time_off_pu[customized_traffic_config_index];
            g_otg->holding_time_off_pe[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.holding_time_off_pe[customized_traffic_config_index];
            g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=
              oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index];


1090
1091
            LOG_I(OTG,"customized:: OCG_config_OTG: (2) FORMAT (%s:%s) source = %d, dest = %d, dist type for size = %d [TODO: check code, printed value may not be correct, checks the indexes of the arry access] start/duration %d/%d\n", source_id_start, source_id_end, source_id_index,
                  destination_id_index, g_otg->size_dist[source_id_index][destination_id_index][0][0],
1092
1093
1094
1095
1096
1097
                  g_otg->flow_start[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]],
                  g_otg->flow_duration[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]);
            per_source_id = strtok(NULL, comma);
            g_otg->application_idx[source_id_index][destination_id_index]+=1;
          }
        }
1098
      } else { // single node configuration
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205