diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab
index 0d9f37ed24b6c037c569c1ab243c4a95e7be4714..b050eff60e72dd12f63b4432c0a5c6d9567f0474 100644
--- a/ci-scripts/Jenkinsfile-gitlab
+++ b/ci-scripts/Jenkinsfile-gitlab
@@ -166,6 +166,14 @@ pipeline {
             }
         }
 
+        stage ("Start VM -- L2-Sim") {
+            steps {
+                timeout (time: 5, unit: 'MINUTES') {
+                    sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
+                }
+            }
+        }
+
         stage ("Start VM -- phy-sim") {
             steps {
                 timeout (time: 5, unit: 'MINUTES') {
@@ -215,7 +223,7 @@ pipeline {
                     steps {
                         gitlabCommitStatus(name: "Build eNb-ethernet") {
                             timeout (time: 20, unit: 'MINUTES') {
-                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
                             }
                         }
                     }
@@ -224,11 +232,20 @@ pipeline {
                     steps {
                         gitlabCommitStatus(name: "Build UE-ethernet") {
                             timeout (time: 20, unit: 'MINUTES') {
-                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
                             }
                         }
                     }
                 }
+                stage ("Build L2-Simulator-eNB") {
+                    steps {
+                        //gitlabCommitStatus(name: "Build UE-ethernet") {
+                            timeout (time: 20, unit: 'MINUTES') {
+                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+                            }
+                        //}
+                    }
+                }
                 stage ("Build physical simulators") {
                     steps {
                         gitlabCommitStatus(name: "Build phy-sim") {
@@ -313,6 +330,15 @@ pipeline {
                         }
                     }
                 }
+                stage ("Test L2 simulator") {
+                    steps {
+                        //gitlabCommitStatus(name: "Test basic-sim") {
+                            timeout (time: 30, unit: 'MINUTES') {
+                                sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+                            }
+                        //}
+                    }
+                }
                 stage ("Build Flexran Controller") {
                     when {
                         expression {doFlexranCtrlTest}
diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran
index 547970e45ea7cf13ea6d880b1233a516ba19c55d..39347b35584884dde6e0f33003bd188add6d6cf0 100644
--- a/ci-scripts/Jenkinsfile-tmp-ran
+++ b/ci-scripts/Jenkinsfile-tmp-ran
@@ -218,7 +218,7 @@ pipeline {
                                     buildStageStatus = false
                                 }
                             }
-                            sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus}"
+                            sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
                         }
                     }
                 }
diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
index f3cb31f449b775f66b1884d30c3b28304bdbc857..2c2ca635a6d7035261f1b65a1ce30add15caae08 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
@@ -197,8 +197,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -227,7 +227,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
index e33daa7a8a4cf1c00907083359f9d9317a871af0..4dd8c1ee22d9dd88003bf5b74dfd859f606a2a7e 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
@@ -197,8 +197,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -218,7 +218,7 @@ RUs = (
          att_rx         = 0;
          bands          = [7];
          max_pdschReferenceSignalPower = -27;
-         max_rxgain                    = 115;
+         max_rxgain                    = 125;
          eNB_instances  = [0];
 
     }
@@ -227,7 +227,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
index 32e8bb99315e0ee7fefa56557f8809a0e4b05d2f..cae47b152c2129a67b5f090fc1c352035b7e0048 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
@@ -197,8 +197,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -218,7 +218,7 @@ RUs = (
          att_rx         = 0;
          bands          = [7];
          max_pdschReferenceSignalPower = -27;
-         max_rxgain                    = 115;
+         max_rxgain                    = 120;
          eNB_instances  = [0];
 
     }
@@ -227,7 +227,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
index fc2f24b8a1e03080b54c7fd5b5eb2fa6c31e4858..6c80a4f7cf0d14817d3e911192e395993ab8d69c 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
@@ -200,8 +200,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -234,7 +234,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
index 010ef28061e795757a5016cc8cb29895c08f78a5..f4be50810c431a608f7b5732c3337201d2140f70 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
@@ -200,8 +200,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -234,7 +234,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
index ddf01096cd7012e4af498fb7148616d7e49a8462..48c8370b4b25399b465d6be0e787e6c669d00eaf 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
@@ -200,8 +200,8 @@ MACRLCs = (
 	tr_s_preference = "local_L1";
 	tr_n_preference = "local_RRC";
 	phy_test_mode = 0;
-        puSch10xSnr     =  200;
-        puCch10xSnr     =  200;
+        puSch10xSnr     =  160;
+        puCch10xSnr     =  160;
         }  
 );
 
@@ -234,7 +234,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
new file mode 100644
index 0000000000000000000000000000000000000000..c2a86f079e983672a2fcf8949e211d6862d00b94
--- /dev/null
+++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
@@ -0,0 +1,236 @@
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB-Eurecom-LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code = 1;
+
+    plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    component_carriers = (
+      {
+      node_function             = "3GPP_eNODEB";
+      node_timing               = "synch_to_ext_device";
+      node_synch_ref            = 0;
+      frame_type					      = "FDD";
+      tdd_config 					      = 3;
+      tdd_config_s            			      = 0;
+      prefix_type             			      = "NORMAL";
+      eutra_band              			      = 7;
+      downlink_frequency      			      = 2685000000L;
+      uplink_frequency_offset 			      = -120000000;
+      Nid_cell					      = 0;
+      N_RB_DL                 			      = 50;
+      Nid_cell_mbsfn          			      = 0;
+      nb_antenna_ports                                = 1;
+      nb_antennas_tx          			      = 1;
+      nb_antennas_rx          			      = 1;
+      tx_gain                                            = 90;
+      rx_gain                                            = 125;
+      pbch_repetition                                 = "FALSE";
+      prach_root              			      = 0;
+      prach_config_index      			      = 0;
+      prach_high_speed        			      = "DISABLE";
+      prach_zero_correlation  			      = 1;
+      prach_freq_offset       			      = 2;
+      pucch_delta_shift       			      = 1;
+      pucch_nRB_CQI           			      = 0;
+      pucch_nCS_AN            			      = 0;
+      pucch_n1_AN             			      = 0;
+      pdsch_referenceSignalPower 			      = -27;
+      pdsch_p_b                  			      = 0;
+      pusch_n_SB                 			      = 1;
+      pusch_enable64QAM          			      = "DISABLE";
+      pusch_hoppingMode                                  = "interSubFrame";
+      pusch_hoppingOffset                                = 0;
+      pusch_groupHoppingEnabled  			      = "ENABLE";
+      pusch_groupAssignment      			      = 0;
+      pusch_sequenceHoppingEnabled		   	      = "DISABLE";
+      pusch_nDMRS1                                       = 1;
+      phich_duration                                     = "NORMAL";
+      phich_resource                                     = "ONESIXTH";
+      srs_enable                                         = "DISABLE";
+      /*  srs_BandwidthConfig                                =;
+      srs_SubframeConfig                                 =;
+      srs_ackNackST                                      =;
+      srs_MaxUpPts                                       =;*/
+
+      pusch_p0_Nominal                                   = -96;
+      pusch_alpha                                        = "AL1";
+      pucch_p0_Nominal                                   = -104;
+      msg3_delta_Preamble                                = 6;
+      pucch_deltaF_Format1                               = "deltaF2";
+      pucch_deltaF_Format1b                              = "deltaF3";
+      pucch_deltaF_Format2                               = "deltaF0";
+      pucch_deltaF_Format2a                              = "deltaF0";
+      pucch_deltaF_Format2b		    	      = "deltaF0";
+
+      rach_numberOfRA_Preambles                          = 64;
+      rach_preamblesGroupAConfig                         = "DISABLE";
+      /*
+      rach_sizeOfRA_PreamblesGroupA                      = ;
+      rach_messageSizeGroupA                             = ;
+      rach_messagePowerOffsetGroupB                      = ;
+      */
+      rach_powerRampingStep                              = 4;
+      rach_preambleInitialReceivedTargetPower            = -108;
+      rach_preambleTransMax                              = 10;
+      rach_raResponseWindowSize                          = 10;
+      rach_macContentionResolutionTimer                  = 48;
+      rach_maxHARQ_Msg3Tx                                = 4;
+
+      pcch_default_PagingCycle                           = 128;
+      pcch_nB                                            = "oneT";
+      bcch_modificationPeriodCoeff			      = 2;
+      ue_TimersAndConstants_t300			      = 1000;
+      ue_TimersAndConstants_t301			      = 1000;
+      ue_TimersAndConstants_t310			      = 1000;
+      ue_TimersAndConstants_t311			      = 10000;
+      ue_TimersAndConstants_n310			      = 20;
+      ue_TimersAndConstants_n311			      = 1;
+      ue_TransmissionMode                                    = 1;
+
+      //Parameters for SIB18
+      rxPool_sc_CP_Len                                       = "normal";
+      rxPool_sc_Period                                       = "sf40";
+      rxPool_data_CP_Len                                     = "normal";
+      rxPool_ResourceConfig_prb_Num                          = 20;
+      rxPool_ResourceConfig_prb_Start                        = 5;
+      rxPool_ResourceConfig_prb_End                          = 44;
+      rxPool_ResourceConfig_offsetIndicator_present          = "prSmall";
+      rxPool_ResourceConfig_offsetIndicator_choice           = 0;
+      rxPool_ResourceConfig_subframeBitmap_present           = "prBs40";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_buf              = "00000000000000000000";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_size             = 5;
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused      = 0;
+/*    rxPool_dataHoppingConfig_hoppingParameter                       = 0;
+      rxPool_dataHoppingConfig_numSubbands                            = "ns1";
+      rxPool_dataHoppingConfig_rbOffset                               = 0;
+      rxPool_commTxResourceUC-ReqAllowed                              = "TRUE";
+*/
+      // Parameters for SIB19
+      discRxPool_cp_Len                                               = "normal"
+      discRxPool_discPeriod                                           = "rf32"
+      discRxPool_numRetx                                              = 1;
+      discRxPool_numRepetition                                        = 2;
+      discRxPool_ResourceConfig_prb_Num                               = 5;
+      discRxPool_ResourceConfig_prb_Start                             = 3;
+      discRxPool_ResourceConfig_prb_End                               = 21;
+      discRxPool_ResourceConfig_offsetIndicator_present               = "prSmall";
+      discRxPool_ResourceConfig_offsetIndicator_choice                = 0;
+      discRxPool_ResourceConfig_subframeBitmap_present                = "prBs40";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf          = "f0ffffffff";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_size         = 5;
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused  = 0;
+
+      }
+    );
+
+
+    srb1_parameters :
+    {
+        # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+        timer_poll_retransmit    = 80;
+
+        # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+        timer_reordering         = 35;
+
+        # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+        timer_status_prohibit    = 0;
+
+        # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+        poll_pdu                 =  4;
+
+        # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+        poll_byte                =  99999;
+
+        # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+        max_retx_threshold       =  4;
+    }
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "CI_MME_IP_ADDR";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "ens3";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "CI_ENB_IP_ADDR";
+        ENB_INTERFACE_NAME_FOR_S1U               = "ens3";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        ENB_IPV4_ADDRESS_FOR_X2C                 = "CI_ENB_IP_ADDR";
+        ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+        
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+      	local_s_if_name  = "lo:";			  
+      	remote_s_address = "127.0.0.1";
+    	local_s_address  = "127.0.0.2"; 
+    	local_s_portc    = 50001;	
+    	remote_s_portc   = 50000;
+    	local_s_portd    = 50011;	
+    	remote_s_portd   = 50010;
+	tr_s_preference = "nfapi";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+log_config =
+    {
+      global_log_level                      ="info";
+      global_log_verbosity                  ="medium";
+      hw_log_level                          ="info";
+      hw_log_verbosity                      ="medium";
+      phy_log_level                         ="info";
+      phy_log_verbosity                     ="medium";
+      mac_log_level                         ="info";
+      mac_log_verbosity                     ="high";
+      rlc_log_level                         ="info";
+      rlc_log_verbosity                     ="medium";
+      pdcp_log_level                        ="info";
+      pdcp_log_verbosity                    ="medium";
+      rrc_log_level                         ="info";
+      rrc_log_verbosity                     ="medium";
+   };
diff --git a/ci-scripts/conf_files/rru.fdd.band7.conf b/ci-scripts/conf_files/rru.fdd.band7.conf
index ff5e13908e182b9c983dbaca6c10291aa0cd8f84..dab69e1f1ed4c5833f843ef3d9cdd90e4f6b740b 100644
--- a/ci-scripts/conf_files/rru.fdd.band7.conf
+++ b/ci-scripts/conf_files/rru.fdd.band7.conf
@@ -20,7 +20,7 @@ RUs = (
 THREAD_STRUCT = (
   {
     #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
-    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
     #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
     worker_config      = "WORKER_ENABLE";
   }
diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf
new file mode 100644
index 0000000000000000000000000000000000000000..ea0236cab4e97b640b0c8ac17601ccb184c22c25
--- /dev/null
+++ b/ci-scripts/conf_files/ue.nfapi.conf
@@ -0,0 +1,44 @@
+log_config = {
+  global_log_level                      ="info";
+  global_log_verbosity                  ="medium";
+  hw_log_level                          ="info";
+  hw_log_verbosity                      ="medium";
+  phy_log_level                         ="info";
+  phy_log_verbosity                     ="medium";
+  mac_log_level                         ="info";
+  mac_log_verbosity                     ="medium";
+  rlc_log_level                         ="info";
+  rlc_log_verbosity                     ="medium";
+  pdcp_log_level                        ="info";
+  pdcp_log_verbosity                    ="medium";
+  rrc_log_level                         ="info";
+  rrc_log_verbosity                     ="full";
+};
+
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "nfapi";
+    	local_n_if_name  = "lo";
+      	remote_n_address = "127.0.0.2";
+    	local_n_address  = "127.0.0.1";
+    	local_n_portc    = 50000;
+    	remote_n_portc   = 50001;
+    	local_n_portd    = 50010;
+    	remote_n_portd   = 50011;
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+       nb_tx          = 1
+       nb_rx          = 1
+       att_tx         = 90
+       att_rx         = 0;
+       bands          = [7,38,42,43];
+       max_pdschReferenceSignalPower = -27;
+       max_rxgain                    = 125;
+    }		      
+);
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 710e06c2c20a9b444eb318645ffa1025d5b7555c..62add8429b754f3e08cb04ce4e7c4da200258075 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -42,6 +42,7 @@ ENB_PROCESS_OK = +1
 ENB_PROCESS_SEG_FAULT = -11
 ENB_PROCESS_ASSERTION = -12
 ENB_PROCESS_REALTIME_ISSUE = -13
+ENB_PROCESS_NOLOGFILE_TO_ANALYZE = -14
 HSS_PROCESS_FAILED = -2
 HSS_PROCESS_OK = +2
 MME_PROCESS_FAILED = -3
@@ -118,6 +119,12 @@ class SSHConnection():
 		self.htmlTabNames = []
 		self.htmlTabIcons = []
 		self.finalStatus = False
+		self.eNBOsVersion = ''
+		self.eNBKernelVersion = ''
+		self.eNBUhdVersion = ''
+		self.eNBCpuNb = ''
+		self.eNBCpuModel = ''
+		self.eNBCpuMHz = ''
 
 	def open(self, ipaddress, username, password):
 		count = 0
@@ -206,8 +213,8 @@ class SSHConnection():
 		count = 0
 		copy_status = False
 		logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination)
-		while count < 4:
-			scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 5)
+		while count < 10:
+			scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 100)
 			scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
 			if scp_response == 0:
 				scp_spawn.sendline('yes')
@@ -237,16 +244,16 @@ class SSHConnection():
 				time.sleep(1)
 			count += 1
 		if copy_status:
-			pass
+			return 0
 		else:
-			sys.exit('SCP failed')
+			return -1
 
 	def copyout(self, ipaddress, username, password, source, destination):
 		count = 0
 		copy_status = False
 		logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination)
 		while count < 4:
-			scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 5)
+			scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 100)
 			scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
 			if scp_response == 0:
 				scp_spawn.sendline('yes')
@@ -460,8 +467,9 @@ class SSHConnection():
 					self.close()
 					time.sleep(1)
 					pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap'
-					self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
-					self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
+					copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
+					if (copyin_res == 0):
+						self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
 				sys.exit(1)
 			else:
 				self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
@@ -1716,7 +1724,8 @@ class SSHConnection():
 			return ENB_PROCESS_ASSERTION
 		if foundRealTimeIssue:
 			logging.debug('\u001B[1;37;41m eNB faced real time issues! \u001B[0m')
-			return ENB_PROCESS_REALTIME_ISSUE
+			self.htmleNBFailureMsg += 'eNB faced real time issues!\n'
+			#return ENB_PROCESS_REALTIME_ISSUE
 		if rlcDiscardBuffer > 0:
 			rlcMsg = 'eNB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)'
 			logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m')
@@ -1735,6 +1744,7 @@ class SSHConnection():
 		result = re.search('lte-softmodem', str(self.ssh.before))
 		if result is not None:
 			self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGKILL lte-softmodem || true', '\$', 5)
+			time.sleep(5)
 		self.close()
 		# If tracer options is on, stopping tshark on EPC side
 		result = re.search('T_stdout', str(self.Initialize_eNB_args))
@@ -1767,7 +1777,13 @@ class SSHConnection():
 		else:
 			result = re.search('enb_', str(self.eNBLogFile))
 			if result is not None:
-				self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
+				copyin_res = self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
+				if (copyin_res == -1):
+					logging.debug('\u001B[1;37;41m Could not copy eNB logfile to analyze it! \u001B[0m')
+					self.htmleNBFailureMsg = 'Could not copy eNB logfile to analyze it!'
+					self.CreateHtmlTestRow('N/A', 'KO', ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
+					self.eNBLogFile = ''
+					return
 				logging.debug('\u001B[1m Analyzing eNB logfile \u001B[0m')
 				logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
 				if (logStatus < 0):
@@ -1946,6 +1962,37 @@ class SSHConnection():
 			self.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5)
 			self.command('zip spgw.log.zip xGwLog.0', '\$', 60)
 		self.close()
+	def RetrieveSystemVersion(self):
+		if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '':
+			Usage()
+			sys.exit('Insufficient Parameter')
+		self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
+		self.command('lsb_release -a', '\$', 5)
+		result = re.search('Description:\\\\t(?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', str(self.ssh.before))
+		if result is not None:
+			self.eNBOsVersion = result.group('os_type')
+			logging.debug('OS is: ' + self.eNBOsVersion)
+		self.command('uname -r', '\$', 5)
+		result = re.search('uname -r\\\\r\\\\n(?P<kernel_version>[a-zA-Z0-9\-\_\.]+)', str(self.ssh.before))
+		if result is not None:
+			self.eNBKernelVersion = result.group('kernel_version')
+			logging.debug('Kernel Version is: ' + self.eNBKernelVersion)
+		self.command('dpkg --list | egrep --color=never libuhd003', '\$', 5)
+		result = re.search('libuhd003:amd64 *(?P<uhd_version>[0-9\.]+)', str(self.ssh.before))
+		if result is not None:
+			self.eNBUhdVersion = result.group('uhd_version')
+			logging.debug('UHD Version is: ' + self.eNBUhdVersion)
+		self.command('lscpu', '\$', 5)
+		result = re.search('CPU\(s\): *(?P<nb_cpus>[0-9]+).*Model name: *(?P<model>[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P<cpu_mhz>[0-9\.]+)', str(self.ssh.before))
+		if result is not None:
+			self.eNBCpuNb = result.group('nb_cpus')
+			logging.debug('nb_cpus: ' + self.eNBCpuNb)
+			self.eNBCpuModel = result.group('model')
+			logging.debug('model: ' + self.eNBCpuModel)
+			self.eNBCpuMHz = result.group('cpu_mhz') + ' MHz'
+			logging.debug('cpu_mhz: ' + self.eNBCpuMHz)
+		self.close()
+
 #-----------------------------------------------------------
 # HTML Reporting....
 #-----------------------------------------------------------
@@ -2096,17 +2143,37 @@ class SSHConnection():
 
 	def CreateHtmlFooter(self, passStatus):
 		if (os.path.isfile('test_results.html')):
+			self.RetrieveSystemVersion()
 			self.htmlFile = open('test_results.html', 'a')
 			self.htmlFile.write('</div>\n')
 			self.htmlFile.write('  <p></p>\n')
-			self.htmlFile.write('  <table class="table">\n')
-			self.htmlFile.write('      <tr">\n')
-			self.htmlFile.write('        <th bgcolor = "#33CCFF">Final Status</th>\n')
+			self.htmlFile.write('  <table class="table table-condensed">\n')
+			self.htmlFile.write('      <tr>\n')
+			self.htmlFile.write('        <th colspan=6>eNB Server Characteristics</th>\n')
+			self.htmlFile.write('      </tr>\n')
+			self.htmlFile.write('      <tr>\n')
+			self.htmlFile.write('        <td>OS Version</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBOsVersion + '</span></td>\n')
+			self.htmlFile.write('        <td>Kernel Version</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBKernelVersion + '</span></td>\n')
+			self.htmlFile.write('        <td>UHD Version</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBUhdVersion + '</span></td>\n')
+			self.htmlFile.write('      </tr>\n')
+			self.htmlFile.write('      <tr>\n')
+			self.htmlFile.write('        <td>Nb CPUs</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBCpuNb + '</span></td>\n')
+			self.htmlFile.write('        <td>CPU Model Name</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBCpuModel + '</span></td>\n')
+			self.htmlFile.write('        <td>CPU Frequency</td>\n')
+			self.htmlFile.write('        <td><span class="label label-default">' + self.eNBCpuMHz + '</span></td>\n')
+			self.htmlFile.write('      </tr>\n')
+			self.htmlFile.write('      <tr>\n')
+			self.htmlFile.write('        <th colspan=4 bgcolor = "#33CCFF">Final Status</th>\n')
 			if passStatus:
-				self.htmlFile.write('        <th bgcolor="green"><font color="white">PASS <span class="glyphicon glyphicon-ok"></span></font></th>\n')
+				self.htmlFile.write('        <th colspan=2 bgcolor="green"><font color="white">PASS <span class="glyphicon glyphicon-ok"></span></font></th>\n')
 			else:
-				self.htmlFile.write('        <th bgcolor="red"><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
-			self.htmlFile.write('      </tr">\n')
+				self.htmlFile.write('        <th colspan=2 bgcolor="red"><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
+			self.htmlFile.write('      </tr>\n')
 			self.htmlFile.write('  </table>\n')
 			self.htmlFile.write('  <p></p>\n')
 			self.htmlFile.write('  <div class="well well-lg">End of Test Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2018 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n')
@@ -2132,7 +2199,9 @@ class SSHConnection():
 				elif (processesStatus == ENB_PROCESS_ASSERTION):
 					self.htmlFile.write('        <td bgcolor = "lightcoral" >KO - eNB process ended in Assertion</td>\n')
 				elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE):
-					self.htmlFile.write('        <td bgcolor = "lightcoral" >KO - eNB process faced Real Time issue(s)/td>\n')
+					self.htmlFile.write('        <td bgcolor = "lightcoral" >KO - eNB process faced Real Time issue(s)</td>\n')
+				elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE):
+					self.htmlFile.write('        <td bgcolor = "orange" >OK</td>\n')
 				elif (processesStatus == HSS_PROCESS_FAILED):
 					self.htmlFile.write('        <td bgcolor = "lightcoral" >KO - HSS process not found</td>\n')
 				elif (processesStatus == MME_PROCESS_FAILED):
@@ -2151,7 +2220,7 @@ class SSHConnection():
 				if result is not None:
 					cellBgColor = 'red'
 				else:
-					result = re.search('showed|Reestablishment', self.htmleNBFailureMsg)
+					result = re.search('showed|Reestablishment|Could not copy eNB logfile', self.htmleNBFailureMsg)
 					if result is not None:
 						cellBgColor = 'orange'
 				self.htmlFile.write('        <td bgcolor = "' + cellBgColor + '" colspan=' + str(self.htmlUEConnected) + '><pre style="background-color:' +
diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool
index 8bf7853d0ce1ab7516cb4a4e3efd4b66d1b60309..6e0a83e07dcde0b825e5a04f191b99ff362750b0 100755
--- a/ci-scripts/oai-ci-vm-tool
+++ b/ci-scripts/oai-ci-vm-tool
@@ -40,6 +40,7 @@ function variant_usage {
     echo "    --variant cppcheck     OR -v4"
     echo "    --variant enb-ethernet OR -v7"
     echo "    --variant ue-ethernet  OR -v8"
+    echo "    --variant l2-sim       OR -v9"
     echo "    --variant flexran-rtc  OR -v10"
 }
 
@@ -285,6 +286,18 @@ case $key in
     NBARGS=$[$NBARGS+256]
     shift
     ;;
+    -v9)
+    VM_NAME=ci-l2-sim
+    VM_MEMORY=8192
+    VM_CPU=8
+    ARCHIVES_LOC=l2_sim
+    LOG_PATTERN=.Rel14.txt
+    NB_PATTERN_FILES=4
+    BUILD_OPTIONS="--eNB -t ETHERNET"
+    RUN_OPTIONS="complex"
+    NBARGS=$[$NBARGS+256]
+    shift
+    ;;
     -v10)
     VM_NAME=ci-flexran-rtc
     ARCHIVES_LOC=flexran
@@ -350,6 +363,17 @@ case $key in
         BUILD_OPTIONS="--UE -t ETHERNET --noS1"
         NBARGS=$[$NBARGS+256]
         ;;
+        l2-sim)
+        VM_NAME=ci-l2-sim
+        VM_MEMORY=8192
+        VM_CPU=8
+        ARCHIVES_LOC=l2_sim
+        LOG_PATTERN=.Rel14.txt
+        NB_PATTERN_FILES=4
+        BUILD_OPTIONS="--eNB -t ETHERNET"
+        RUN_OPTIONS="complex"
+        NBARGS=$[$NBARGS+256]
+        ;;
         flexran-rtc)
         VM_NAME=ci-flexran-rtc
         ARCHIVES_LOC=flexran
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index bed46f0acefa478d2b34e49b8a79380e2e14610c..4d87ba579151e46765af0269f02e12feac142155 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -280,17 +280,171 @@ function recover_core_dump {
     fi
 }
 
-function terminate_ltebox_epc {
-    echo "echo \"cd /opt/ltebox/tools\"" > $1
-    echo "cd /opt/ltebox/tools" >> $1
-    echo "echo \"sudo ./stop_ltebox\"" >> $1
-    echo "sudo ./stop_ltebox" >> $1
-    echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1
-    echo "sudo daemon --name=simulated_hss --stop" >> $1
-    echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1
-    echo "sudo killall --signal SIGKILL hss_sim" >> $1
-    ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
-    rm $1
+function install_epc_on_vm {
+    local LOC_EPC_VM_NAME=$1
+    local LOC_EPC_VM_CMDS=$2
+
+    if [ -d /opt/ltebox-archives/ ]
+    then
+        # Checking if all ltebox archives are available to run ltebx epc on a brand new VM
+        if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ]
+        then
+            echo "############################################################"
+            echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox"
+            echo "############################################################"
+            LTEBOX=1
+        fi
+    fi
+    # Here we could have other types of EPC detection
+
+    # Do we need to start the EPC VM
+    echo "EPC_VM_CMD_FILE     = $LOC_EPC_VM_CMDS"
+    IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $LOC_EPC_VM_NAME`
+    if [ $IS_EPC_VM_ALIVE -eq 0 ]
+    then
+        echo "############################################################"
+        echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base"
+        echo "############################################################"
+        uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching
+    fi
+
+    uvt-kvm wait $LOC_EPC_VM_NAME --insecure
+    local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME`
+    echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR"
+    scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+
+    # ltebox specific actions (install and start)
+    LTE_BOX_TO_INSTALL=1
+    if [ $LTEBOX -eq 1 ]
+    then
+        echo "ls -ls /opt/ltebox/tools/start_ltebox" > $LOC_EPC_VM_CMDS
+        RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+        NB_EXES=`echo $RESPONSE | grep -c ltebox`
+        if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi
+    fi
+
+    if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ]
+    then
+        echo "############################################################"
+        echo "Copying ltebox archives into EPC VM ($LOC_EPC_VM_NAME)" 
+        echo "############################################################"
+        scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+        scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+        scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+
+        echo "############################################################"
+        echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)"
+        echo "############################################################"
+        echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
+        echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS
+        echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+        echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+
+        # Installing HSS
+        echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS
+        echo "cd /opt" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $LOC_EPC_VM_CMDS
+        echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $LOC_EPC_VM_CMDS
+        echo "echo \"cd /opt/hss_sim0609\"" >> $LOC_EPC_VM_CMDS
+        echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
+
+        # Installing ltebox
+        echo "echo \"cd /home/ubuntu\"" >> $LOC_EPC_VM_CMDS
+        echo "cd /home/ubuntu" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $LOC_EPC_VM_CMDS
+        echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
+
+        echo "echo \"cd /opt/ltebox/etc/\"" >> $LOC_EPC_VM_CMDS
+        echo "cd /opt/ltebox/etc/" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $LOC_EPC_VM_CMDS
+        echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $LOC_EPC_VM_CMDS
+        echo "sudo sed -i  -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' gw.conf" >> $LOC_EPC_VM_CMDS
+        echo "sudo sed -i  -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' mme.conf" >> $LOC_EPC_VM_CMDS
+
+        ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+        rm -f $LOC_EPC_VM_CMDS
+    fi
+}
+
+function start_epc {
+    local LOC_EPC_VM_NAME=$1
+    local LOC_EPC_VM_CMDS=$2
+    local LOC_EPC_VM_IP_ADDR=$3
+
+    if [ $LTEBOX -eq 1 ]
+    then
+        echo "############################################################"
+        echo "Start EPC on EPC VM ($LOC_EPC_VM_NAME)"
+        echo "############################################################"
+        echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS
+        echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS
+        echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS
+
+        echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS
+        echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS
+        echo "echo \"sudo ./start_ltebox\"" >> $LOC_EPC_VM_CMDS
+        echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $LOC_EPC_VM_CMDS
+
+        ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+        rm -f $LOC_EPC_VM_CMDS
+
+        i="0"
+        echo "ifconfig tun5 | egrep -c \"inet addr\"" > $LOC_EPC_VM_CMDS
+        while [ $i -lt 10 ]
+        do
+            sleep 2
+            CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+            if [ $CONNECTED -eq 1 ]
+            then
+                i="100"
+            else
+                i=$[$i+1]
+            fi
+        done
+        rm $LOC_EPC_VM_CMDS
+        if [ $i -lt 50 ]
+        then
+            echo "Problem w/ starting ltebox EPC"
+            echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+            exit -1
+        fi
+    fi
+
+    # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC
+
+}
+
+function retrieve_real_epc_ip_addr {
+    local LOC_EPC_VM_NAME=$1
+    local LOC_EPC_VM_CMDS=$2
+    local LOC_EPC_VM_IP_ADDR=$3
+
+    if [ $LTEBOX -eq 1 ]
+    then
+        # in our configuration file, we are using pool 5
+        echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's#  P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS
+        REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+        echo "EPC IP Address     is : $REAL_EPC_IP_ADDR"
+        rm $LOC_EPC_VM_CMDS
+    fi
+}
+
+function terminate_epc {
+    if [ $LTEBOX -eq 1 ]
+    then
+        echo "echo \"cd /opt/ltebox/tools\"" > $1
+        echo "cd /opt/ltebox/tools" >> $1
+        echo "echo \"sudo ./stop_ltebox\"" >> $1
+        echo "sudo ./stop_ltebox" >> $1
+        echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1
+        echo "sudo daemon --name=simulated_hss --stop" >> $1
+        echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1
+        echo "sudo killall --signal SIGKILL hss_sim" >> $1
+        ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+        rm $1
+    fi
 }
 
 function start_flexran_ctrl {
@@ -322,6 +476,85 @@ function query_flexran_ctrl_status {
     rm $1
 }
 
+function build_ue_on_separate_folder {
+    echo "mkdir tmp-ue" > $1
+    echo "cd tmp-ue" >> $1
+    echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $1
+    echo "unzip -qq -DD ../localZip.zip" >> $1
+
+    # We may have some adaptation to do
+    if [ -f /opt/ltebox-archives/adapt_ue_l2_sim.txt ]
+    then
+        echo "############################################################"
+        echo "Doing some adaptation on UE side"
+        echo "############################################################"
+        cat /opt/ltebox-archives/adapt_ue_l2_sim.txt >> $1
+    fi
+
+    echo "echo \"source oaienv\"" >> $1
+    echo "source oaienv" >> $1
+    echo "cd cmake_targets/" >> $1
+    echo "mkdir log" >> $1
+    echo "chmod 777 log" >> $1
+    echo "echo \"./build_oai --UE -t ETHERNET \"" >> $1
+    echo "./build_oai --UE -t ETHERNET > log/ue-build.txt 2>&1" >> $1
+    echo "cd tools" >> $1
+    echo "sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up" >> $1
+    echo "sudo chmod 666 /etc/iproute2/rt_tables" >> $1
+    echo "source init_nas_s1 UE" >> $1
+    echo "ifconfig" >> $1
+    ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+    rm -f $1
+}
+
+function start_l2_sim_enb {
+    local LOC_VM_IP_ADDR=$2
+    local LOC_EPC_IP_ADDR=$3
+    local LOC_LOG_FILE=$4
+    local LOC_NB_RBS=$5
+    local LOC_CONF_FILE=$6
+    echo "cd /home/ubuntu/tmp" > $1
+    echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
+    echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+    echo "echo \"source oaienv\"" >> $1
+    echo "source oaienv" >> $1
+    echo "cd ci-scripts/conf_files/" >> $1
+    echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+    echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL                                         = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+    echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
+    echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
+    echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+    echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+    echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+    echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1
+    echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+    echo "cat ./my-lte-softmodem-run.sh" >> $1
+    echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+    echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
+
+    ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
+    sleep 10
+    rm $1
+}
+
+function start_l2_sim_ue {
+    local LOC_VM_IP_ADDR=$2
+    local LOC_LOG_FILE=$3
+    local LOC_CONF_FILE=$4
+    echo "echo \"cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/\"" >> $1
+    echo "sudo chmod 777 /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1
+    echo "cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1
+    echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp-ue/ci-scripts/conf_files/$LOC_CONF_FILE --L2-emul 3 --num-ues 1\" > ./my-lte-softmodem-run.sh " >> $1
+    echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+    echo "cat ./my-lte-softmodem-run.sh" >> $1
+    echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+    echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
+
+    ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
+    sleep 10
+    rm $1
+}
+
 function run_test_on_vm {
     echo "############################################################"
     echo "OAI CI VM script"
@@ -459,148 +692,26 @@ function run_test_on_vm {
         fi
         mkdir --parents $ARCHIVES_LOC
 
+        # Creating a VM for EPC and installing SW
         EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"`
+        EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
         LTEBOX=0
-        if [ -d /opt/ltebox-archives/ ]
-        then
-            # Checking if all ltebox archives are available to run ltebx epc on a brand new VM
-            if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ]
-            then
-                echo "############################################################"
-                echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox"
-                echo "############################################################"
-                LTEBOX=1
-            fi
-        fi
-        # Here we could have other types of EPC detection
-
-        # Do we need to start the EPC VM
-        EPC_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#epc-cmds#"`
-        echo "EPC_VM_CMD_FILE     = $EPC_VM_CMDS"
-        IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $EPC_VM_NAME`
-        if [ $IS_EPC_VM_ALIVE -eq 0 ]
-        then
-            echo "############################################################"
-            echo "Creating test EPC VM ($EPC_VM_NAME) on Ubuntu Cloud Image base"
-            echo "############################################################"
-            uvt-kvm create $EPC_VM_NAME release=xenial --unsafe-caching
-        fi
-
-        uvt-kvm wait $EPC_VM_NAME --insecure
+        install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
         EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
-        echo "$EPC_VM_NAME has for IP addr = $EPC_VM_IP_ADDR"
-        scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
-
-        # ltebox specific actions (install and start)
-        LTE_BOX_TO_INSTALL=1
-        if [ $LTEBOX -eq 1 ]
-        then
-            echo "ls -ls /opt/ltebox/tools/start_ltebox" > $EPC_VM_CMDS
-            RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
-            NB_EXES=`echo $RESPONSE | grep -c ltebox`
-            if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi
-        fi
 
-        if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ]
-        then
-            echo "############################################################"
-            echo "Copying ltebox archives into EPC VM ($EPC_VM_NAME)" 
-            echo "############################################################"
-            scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
-            scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
-            scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu
+        # Starting EPC
+        start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
 
-            echo "############################################################"
-            echo "Install EPC on EPC VM ($EPC_VM_NAME)"
-            echo "############################################################"
-            echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $EPC_VM_CMDS
-            echo "touch /home/ubuntu/.hushlogin" >> $EPC_VM_CMDS
-            echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $EPC_VM_CMDS
-            echo "sudo apt-get update > zip-install.txt 2>&1" >> $EPC_VM_CMDS
-            echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $EPC_VM_CMDS
-
-            # Installing HSS
-            echo "echo \"cd /opt\"" >> $EPC_VM_CMDS
-            echo "cd /opt" >> $EPC_VM_CMDS
-            echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $EPC_VM_CMDS
-            echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $EPC_VM_CMDS
-            echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS
-            echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS
-
-            # Installing ltebox
-            echo "echo \"cd /home/ubuntu\"" >> $EPC_VM_CMDS
-            echo "cd /home/ubuntu" >> $EPC_VM_CMDS
-            echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $EPC_VM_CMDS
-            echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $EPC_VM_CMDS
-
-            echo "echo \"cd /opt/ltebox/etc/\"" >> $EPC_VM_CMDS
-            echo "cd /opt/ltebox/etc/" >> $EPC_VM_CMDS
-            echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $EPC_VM_CMDS
-            echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $EPC_VM_CMDS
-            echo "sudo sed -i  -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' gw.conf" >> $EPC_VM_CMDS
-            echo "sudo sed -i  -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' mme.conf" >> $EPC_VM_CMDS
-        fi
+        # Retrieve EPC real IP address
+        retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
 
-        # Starting EPC
-        if [ $LTEBOX -eq 1 ]
+        # We may have some adaptation to do
+        if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ]
         then
             echo "############################################################"
-            echo "Start EPC on EPC VM ($EPC_VM_NAME)"
+            echo "Doing some adaptation on UE side"
             echo "############################################################"
-            echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS
-            echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS
-            echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $EPC_VM_CMDS
-            echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $EPC_VM_CMDS
-
-            echo "echo \"cd /opt/ltebox/tools/\"" >> $EPC_VM_CMDS
-            echo "cd /opt/ltebox/tools/" >> $EPC_VM_CMDS
-            echo "echo \"sudo ./start_ltebox\"" >> $EPC_VM_CMDS
-            echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $EPC_VM_CMDS
-
-            ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS
-            rm -f $EPC_VM_CMDS
-
-            # We may have some adaptation to do
-            if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ]
-            then
-                echo "############################################################"
-                echo "Doing some adaptation on UE side"
-                echo "############################################################"
-                ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt
-            fi
-
-            i="0"
-            echo "ifconfig tun5 | egrep -c \"inet addr\"" > $EPC_VM_CMDS
-            while [ $i -lt 10 ]
-            do
-                sleep 2
-                CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
-                if [ $CONNECTED -eq 1 ]
-                then
-                    i="100"
-                else
-                    i=$[$i+1]
-                fi
-            done
-            rm $EPC_VM_CMDS
-            if [ $i -lt 50 ]
-            then
-                echo "Problem w/ starting ltebox EPC"
-                echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
-                exit -1
-            fi
-        fi
-
-        # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC
-
-        # Retrieve EPC real IP address
-        if [ $LTEBOX -eq 1 ]
-        then
-            # in our configuration file, we are using pool 5
-            echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's#  P-t-P:.*\$##'" > $EPC_VM_CMDS
-            REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS`
-            echo "EPC IP Address     is : $REAL_EPC_IP_ADDR"
-            rm $EPC_VM_CMDS
+            ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt
         fi
 
         echo "############################################################"
@@ -621,7 +732,7 @@ function run_test_on_vm {
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
             recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
             exit -1
         fi
@@ -680,7 +791,7 @@ function run_test_on_vm {
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
             recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
             exit -1
         fi
@@ -739,7 +850,7 @@ function run_test_on_vm {
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
             recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
             exit -1
         fi
@@ -791,7 +902,7 @@ function run_test_on_vm {
             if [ $j -lt 50 ]
             then
                 echo "ERROR: compiling flexran controller on vm went wrong"
-                terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+                terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
                 echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
                 exit -1
             fi
@@ -801,7 +912,7 @@ function run_test_on_vm {
             if [ $IS_FLEXRAN_VM_ALIVE -eq 0 ]
             then
                 echo "ERROR: Flexran Ctl VM is not alive"
-                terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+                terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
                 echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
                 exit -1
             fi
@@ -835,7 +946,7 @@ function run_test_on_vm {
                 scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
                 scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
                 recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-                terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+                terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
                 stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR
                 echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
                 exit -1
@@ -878,7 +989,7 @@ function run_test_on_vm {
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
             recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
             exit -1
         fi
@@ -929,7 +1040,7 @@ function run_test_on_vm {
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
             scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
             recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
             exit -1
         fi
@@ -980,7 +1091,7 @@ function run_test_on_vm {
 #            scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
 #            scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
 #            recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-#            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+#            terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
 #            echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
 #            exit -1
 #        fi
@@ -1016,10 +1127,7 @@ function run_test_on_vm {
         echo "Terminate EPC"
         echo "############################################################"
 
-        if [ $LTEBOX -eq 1 ]
-        then
-            terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
-        fi
+        terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
 
         if [ $KEEP_VM_ALIVE -eq 0 ]
         then
@@ -1051,4 +1159,78 @@ function run_test_on_vm {
             echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
         fi
     fi
+
+    if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-l2-sim.* ]]
+    then
+        PING_STATUS=0
+        IPERF_STATUS=0
+        if [ -d $ARCHIVES_LOC ]
+        then
+            rm -Rf $ARCHIVES_LOC
+        fi
+        mkdir --parents $ARCHIVES_LOC
+
+        # Building UE elsewhere in VM
+        build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR
+
+        # Creating a VM for EPC and installing SW
+        EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#l2-epc#"`
+        EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
+        LTEBOX=0
+        install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
+        EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
+
+        # Starting EPC
+        start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+        # Retrieve EPC real IP address
+        retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+        echo "############################################################"
+        echo "Starting the eNB in FDD-5MHz mode"
+        echo "############################################################"
+        CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log
+        start_l2_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf
+
+        echo "############################################################"
+        echo "Starting the UEs"
+        echo "############################################################"
+        CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log
+        start_l2_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf
+
+        sleep 30
+        echo "ping -I oip1 -c 20 $REAL_EPC_IP_ADDR" > $VM_CMDS
+        ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+
+        echo "############################################################"
+        echo "Terminate enb/ue simulators"
+        echo "############################################################"
+        terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
+        scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+        scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+
+        echo "############################################################"
+        echo "Terminate EPC"
+        echo "############################################################"
+
+        terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+        if [ $KEEP_VM_ALIVE -eq 0 ]
+        then
+            echo "############################################################"
+            echo "Destroying VMs"
+            echo "############################################################"
+            uvt-kvm destroy $VM_NAME
+            ssh-keygen -R $VM_IP_ADDR
+            uvt-kvm destroy $EPC_VM_NAME
+            ssh-keygen -R $EPC_VM_IP_ADDR
+        fi
+
+        if [ $STATUS -eq 0 ]
+        then
+            echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+        else
+            echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+        fi
+    fi
 }
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
index 68b382968273fc960d3e490cdd430d8955f6ea6e..b6c441b19aeac33f6d1710b610b62277ed3d2ff6 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
@@ -26,9 +26,9 @@
 	<htmlTabIcon>tasks</htmlTabIcon>
 	<TestCaseRequestedList>
  040101
- 030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201
+ 030121 040301 040521 040623 040624 040625 040662 040401 040201 030201
 	</TestCaseRequestedList>
-	<TestCaseExclusionList></TestCaseExclusionList>
+	<TestCaseExclusionList>040626 040627 040661 040663 040664</TestCaseExclusionList>
 
 	<testCase id="030121">
 		<class>Initialize_eNB</class>
@@ -110,16 +110,16 @@
 
 	<testCase id="040661">
 		<class>Iperf</class>
-		<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(balanced profile)</desc>
-		<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args>
+		<desc>iperf (20MHz - UL/12Mbps/UDP)(30 sec)(balanced profile)</desc>
+		<iperf_args>-u -b 12M -t 30 -i 1 -R</iperf_args>
 		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
 		<iperf_profile>balanced</iperf_profile>
 	</testCase>
 
 	<testCase id="040662">
 		<class>Iperf</class>
-		<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc>
-		<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args>
+		<desc>iperf (20MHz - UL/17Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 17M -t 30 -i 1 -R</iperf_args>
 		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
 		<iperf_profile>single-ue</iperf_profile>
 	</testCase>
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
index 340d33196a5998bf25186256a5d091b207b46b69..88fb30b840caaf8f5fe686b19b59b6d55e045227 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
@@ -94,9 +94,9 @@
 
 	<testCase id="040652">
 		<class>Iperf</class>
-		<desc>iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc>
-		<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args>
-		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
+		<desc>iperf (10MHz - UL/5Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 5M -t 30 -i 1 -R</iperf_args>
+		<iperf_packetloss_threshold>60</iperf_packetloss_threshold>
 		<iperf_profile>single-ue</iperf_profile>
 	</testCase>
 
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
index 5d8646cd5e90822aa7aab74249764e0c805f9782..798fc1bc8f6fa301e84f155e1656cd6f31cbf4e2 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
@@ -86,16 +86,16 @@
 
         <testCase id="040624">
 		<class>Iperf</class>
-		<desc>iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile)</desc>
-		<iperf_args>-u -b 70M -t 30 -i 1</iperf_args>
+		<desc>iperf (20MHz - DL/50Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 50M -t 30 -i 1</iperf_args>
 		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
 		<iperf_profile>single-ue</iperf_profile>
         </testCase>
 
 	<testCase id="040662">
 		<class>Iperf</class>
-		<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc>
-		<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args>
+		<desc>iperf (20MHz - UL/10Mbps/UDP)(30 sec)(single-ue profile)</desc>
+		<iperf_args>-u -b 10M -t 30 -i 1 -R</iperf_args>
 		<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
 		<iperf_profile>single-ue</iperf_profile>
 	</testCase>
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index a110cca71a51ffcfc8860ff22f3dd68f85dc086f..8f6396f8298d0084b30ea8b49dec0bd554e36183 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -183,7 +183,6 @@ set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
 #########################
 # set a flag for changes in the source code
 # these changes are related to hardcoded path to include .h files
-add_definitions(-DCMAKER)
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
 
@@ -616,6 +615,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY     False "trace some PHY exchang
 add_boolean_option(UE_EXPANSION             False         "enable UE_EXPANSION with max 256 UE")
 add_boolean_option(PHY_TX_THREAD            False         "enable UE_EXPANSION with max 256 UE")
 add_boolean_option(PRE_SCD_THREAD           False         "enable UE_EXPANSION with max 256 UE")
+add_boolean_option(UESIM_EXPANSION          False         "enable UESIM_EXPANSION with max 256 UE")
 
 ########################
 # Include order
@@ -2154,7 +2154,6 @@ add_executable(test_epc_generate_scenario
   ${OPENAIR2_DIR}/ENB_APP/enb_config.h
   ${OPENAIR2_DIR}/COMMON/commonDef.h
   ${OPENAIR2_DIR}/COMMON/messages_def.h
-  ${OPENAIR2_DIR}/COMMON/messages_types.h
   ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
   )
 target_link_libraries (test_epc_generate_scenario
@@ -2174,7 +2173,6 @@ add_executable(test_epc_play_scenario
   ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
   ${OPENAIR2_DIR}/COMMON/commonDef.h
   ${OPENAIR2_DIR}/COMMON/messages_def.h
-  ${OPENAIR2_DIR}/COMMON/messages_types.h
   )
 target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
 target_link_libraries (test_epc_play_scenario
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
index 54f369f97772e7bdbf8214b191afdfb89e7cfce4..bd71125cf0ac1d920b742f12dccb8b04ffbc671f 100755
--- a/cmake_targets/at_commands/CMakeLists.txt
+++ b/cmake_targets/at_commands/CMakeLists.txt
@@ -76,7 +76,6 @@ macro(add_boolean_option name val helpstr)
 endmacro(add_boolean_option)
 
 # compilation flags
-# added CMAKER conditional compilation to not bother legacy building system
 #############################################
 if(NOT CMAKE_BUILD_TYPE)
 set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
@@ -84,7 +83,7 @@ endif()
 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
 
 #
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -DCMAKER")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat ")
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3")
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2")
 
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 01f4b63a8f91c6539aba13157350302cbfa9e7dd..2728cac9b1721298ccad67a1867709cfd71defde 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -43,6 +43,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
 MSC_GEN=0
 XFORMS="True"
 UE_EXPANSION="False"
+UESIM_EXPANSION="False"
 PRINT_STATS="False"
 VCD_TIMING="False"
 DEADLINE_SCHEDULER_FLAG_USER="False"
@@ -218,6 +219,10 @@ function main() {
             UE_EXPANSION="True"
             echo_info "Will compile with UE_EXPANSION"
             shift;;
+       --musim)
+            UESIM_EXPANSION="True"
+            echo_info "Will compile with UESIM_EXPANSION"
+            shift;;
        --UE-conf-nvram)
             conf_nvram_path=$(readlink -f $2)
             shift 2;;
@@ -551,6 +556,7 @@ function main() {
     echo "set ( UE_EXPANSION $UE_EXPANSION )"      >>  $cmake_file
 #    echo "set ( PHY_TX_THREAD $UE_EXPANSION )"     >>  $cmake_file
     echo "set ( PRE_SCD_THREAD $UE_EXPANSION )"    >>  $cmake_file
+    echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )"      >>  $cmake_file
     echo "set ( RRC_ASN1_VERSION \"${REL}\")"      >>  $cmake_file
     echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )"     >>  $cmake_file
     echo "set ( RF_BOARD \"${HW}\")"               >>  $cmake_file
diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1
index cab4ad047bf4d42d9a4ba1890c9cef9967ec2a00..b78ab34ff9f90d825303e3bb807e0f8e177f3df6 100755
--- a/cmake_targets/tools/init_nas_s1
+++ b/cmake_targets/tools/init_nas_s1
@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko
 
 if [ "$1" = "UE" ]; then
   echo "bring up $LTEIF interface for UE"
-  ifconfig $LTEIF up
+  sudo ifconfig $LTEIF up
 fi
 
-ip route flush cache
+sudo ip route flush cache
 sleep 1
-sysctl -w net.ipv4.conf.all.log_martians=1
+sudo sysctl -w net.ipv4.conf.all.log_martians=1
 echo "Disabling reverse path filtering"
-sysctl -w net.ipv4.conf.all.rp_filter=0
-ip route flush cache
+sudo sysctl -w net.ipv4.conf.all.rp_filter=0
+sudo ip route flush cache
 
 # Check table 200 lte in /etc/iproute2/rt_tables
 fgrep lte /etc/iproute2/rt_tables  > /dev/null 
 if [ $? -ne 0 ]; then
     echo "200 lte " >> /etc/iproute2/rt_tables
 fi
-ip rule add fwmark 1 table lte
-ip route add default dev $LTEIF table lte
+sudo ip rule add fwmark 1 table lte
+sudo ip route add default dev $LTEIF table lte
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 7fca12540d49083d3160ff594487b7286c0ab141..635287afb45b6dfc919543a10d0a61a83cfe6dce 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -75,6 +75,7 @@ int processoption(paramdef_t *cfgoptions, char *value) {
   if ( value == NULL) {
     if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
       fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
+      exit_fun("[CONFIG] command line parsing fatal error");
       return 0;
     } else {        /* boolean value option without argument, set value to true*/
       tmpval = defbool;
@@ -143,7 +144,10 @@ int processoption(paramdef_t *cfgoptions, char *value) {
   return optisset;
 }
 
-int config_check_cmdlineopt(char *prefix) {
+/*--------------------------------------------------------------------*/
+/*  check unknown options in the command line
+*/
+int config_check_unknown_cmdlineopt(char *prefix) {
   int unknowndetected=0;
   char testprefix[CONFIG_MAXOPTLENGTH]="";
   int finalcheck = 0;
@@ -161,6 +165,8 @@ int config_check_cmdlineopt(char *prefix) {
 
     if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
 
+    if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue;
+
     if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
 
     if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
@@ -173,7 +179,7 @@ int config_check_cmdlineopt(char *prefix) {
   printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
               unknowndetected,testprefix,((prefix==NULL)?"":prefix));
   return unknowndetected;
-}  /* parse_cmdline*/
+}  /* config_check_unknown_cmdlineopt */
 
 int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
   int c = config_get_if()->argc;
@@ -269,7 +275,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
   printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
 
   if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) {
-    i=config_check_cmdlineopt(prefix);
+    i=config_check_unknown_cmdlineopt(prefix);
 
     if (i > 0) {
       fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n",
diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c
index afbe1ae88795048ec8b50770741bd46fc4416e9c..b149bfd6368eaad1fa862fc63def7d3f823b9e95 100644
--- a/common/config/config_userapi.c
+++ b/common/config/config_userapi.c
@@ -370,6 +370,12 @@ int config_checkstr_assign_integer(paramdef_t *param) {
   return -1;
 }
 
+void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams) {
+  for (int i=0; i< numparams ; i++ ) {
+    params[i].chkPptr = &(checkfunctions[i]);
+  }
+}
+
 int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
   int status = 0;
 
diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h
index 5542148343bf6bdaefc8287e179bd0b868fd2ba6..d0508ffbeb97f1302463dd91341f7eefa8598f1a 100644
--- a/common/config/config_userapi.h
+++ b/common/config/config_userapi.h
@@ -57,10 +57,13 @@ extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
 
 /* apis to get/check parameters, to be used by oai modules, at configuration time */
 #define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
-extern int config_check_cmdlineopt(char *prefix);
+extern int config_check_unknown_cmdlineopt(char *prefix);
 extern int config_get(paramdef_t *params,int numparams, char *prefix);
 extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
 
+/* apis to set some of the paramdef_t fields before using the get/getlist api's */
+extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
+
 /* apis to retrieve parameters info after calling get or getlist functions */
 extern int config_isparamset(paramdef_t *params,int paramidx);
 extern int config_get_processedint(paramdef_t *cfgoption);
diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c
index cb6fa46293ed77aa97812e557f8d6c4843c10ef9..2d861f2dc33df5684730d1cf1af9bfe57c0c73d2 100644
--- a/common/config/libconfig/config_libconfig.c
+++ b/common/config/libconfig/config_libconfig.c
@@ -42,60 +42,60 @@
 #include "errno.h"
 
 #if ( LIBCONFIG_VER_MAJOR == 1 && LIBCONFIG_VER_MINOR < 5)
-#define config_setting_lookup config_lookup_from
+  #define config_setting_lookup config_lookup_from
 #endif
 
 void config_libconfig_end(void );
 
-int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath)
-{
-const char *str;
-int st;
-int numelt;
-
-   numelt=config_setting_length(setting);
-   config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
-   st=0;
-   for (int i=0; i< numelt ; i++) {
-       str=config_setting_get_string_elem(setting,i);
-       if (str==NULL) {
-          printf("[LIBCONFIG] %s%i  not found in config file\n", cfgoptions->optname,i);
-       } else {
-            config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
-            sprintf(cfgoptions->strlistptr[i],"%s",str);
-	    st++;
-            printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
-       }
-   }
-   cfgoptions->numelt=numelt;
-   return st;
+int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
+  const char *str;
+  int st;
+  int numelt;
+  numelt=config_setting_length(setting);
+  config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
+  st=0;
+
+  for (int i=0; i< numelt ; i++) {
+    str=config_setting_get_string_elem(setting,i);
+
+    if (str==NULL) {
+      printf("[LIBCONFIG] %s%i  not found in config file\n", cfgoptions->optname,i);
+    } else {
+      config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
+      sprintf(cfgoptions->strlistptr[i],"%s",str);
+      st++;
+      printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
+    }
+  }
+
+  cfgoptions->numelt=numelt;
+  return st;
 }
 
-int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath)
-{
-
-   cfgoptions->numelt=config_setting_length(setting);
-   
-   if (cfgoptions->numelt > 0) {
-       cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt));
-       for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
-            cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
-            printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
-       } /* for loop on array element... */
-   }
-   return cfgoptions->numelt;
+int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
+  cfgoptions->numelt=config_setting_length(setting);
+
+  if (cfgoptions->numelt > 0) {
+    cfgoptions->iptr=malloc(sizeof(int) * (cfgoptions->numelt));
+
+    for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
+      cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
+      printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
+    } /* for loop on array element... */
+  }
+
+  return cfgoptions->numelt;
 }
 
 
 
 
-int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
-{
+int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
   config_setting_t *setting;
   char *str;
   int i,u;
   long long int llu;
-  double dbl; 
+  double dbl;
   int rst;
   int status=0;
   int notfound;
@@ -104,211 +104,244 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
   int numdefvals=0;
   char cfgpath[512];  /* 512 should be enough for the sprintf below */
 
-  for(i=0;i<numoptions;i++) {
-
-     if (prefix != NULL) {
-         sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
-     } else {
-         sprintf(cfgpath,"%s",cfgoptions[i].optname);
-     }
-
-     if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) {
-         printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
-         continue;
-     }
-     notfound=0;
-     defval=0;
-     switch(cfgoptions[i].type)
-       {
-       	case TYPE_STRING:
-           if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
-              if ( cfgoptions[i].numelt > 0  && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
-                  fprintf(stderr,"[LIBCONFIG] %s:  %s exceeds maximum length of %i bytes, value truncated\n",
-                           cfgpath,str,cfgoptions[i].numelt); 
-                  str[strlen(str)-1] = 0;
-              }
-              if (cfgoptions[i].numelt == 0 ) {
-        //          config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
-                  config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
-                  sprintf( *(cfgoptions[i].strptr) , "%s", str);
-                  printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
-              } else {
-                 sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
-                 printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
-              }
-           } else {
-              defval=config_setdefault_string(&(cfgoptions[i]),prefix); 
-	   }
-       break;
-       	case TYPE_STRINGLIST:
-	   setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
-           if ( setting != NULL) {
-              read_strlist(&cfgoptions[i],setting,cfgpath);
-           } else {
-              defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
-	   }
-       break;
-       	case TYPE_UINT8:
-       	case TYPE_INT8:	
-       	case TYPE_UINT16:
-       	case TYPE_INT16:
-       	case TYPE_UINT32:
-       	case TYPE_INT32:
-       	case TYPE_MASK:	
-           if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
-              config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
-	      config_assign_int(&(cfgoptions[i]),cfgpath,u);
-           } else {
-              defval=config_setdefault_int(&(cfgoptions[i]),prefix);
-	   }	      
+  for(i=0; i<numoptions; i++) {
+    if (prefix != NULL) {
+      sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
+    } else {
+      sprintf(cfgpath,"%s",cfgoptions[i].optname);
+    }
+
+    if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) {
+      printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
+      continue;
+    }
+
+    notfound=0;
+    defval=0;
+
+    switch(cfgoptions[i].type) {
+      case TYPE_STRING:
+        if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
+          if ( cfgoptions[i].numelt > 0  && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
+            fprintf(stderr,"[LIBCONFIG] %s:  %s exceeds maximum length of %i bytes, value truncated\n",
+                    cfgpath,str,cfgoptions[i].numelt);
+            str[strlen(str)-1] = 0;
+          }
+
+          if (cfgoptions[i].numelt == 0 ) {
+            //          config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
+            config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
+            sprintf( *(cfgoptions[i].strptr) , "%s", str);
+            printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
+          } else {
+            sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
+            printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
+          }
+        } else {
+          defval=config_setdefault_string(&(cfgoptions[i]),prefix);
+        }
+
         break;
-       	case TYPE_UINT64:
-       	case TYPE_INT64:
-           if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
-              config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
-              if(cfgoptions[i].type==TYPE_UINT64) {
-                 *(cfgoptions[i].u64ptr) = (uint64_t)llu;
-                 printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
-              } else {
-                 *(cfgoptions[i].iptr) = llu;
-                 printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); 
-              }
-           } else {
-              defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
-	   }	      
-        break;        
-       	case TYPE_UINTARRAY:
-       	case TYPE_INTARRAY:
-	   setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
-           if ( setting != NULL) {
-              read_intarray(&cfgoptions[i],setting,cfgpath);
-           } else {
-              defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
-	   }    
+
+      case TYPE_STRINGLIST:
+        setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+        if ( setting != NULL) {
+          read_strlist(&cfgoptions[i],setting,cfgpath);
+        } else {
+          defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
+        }
+
         break;
-       	case TYPE_DOUBLE:
-           if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
-                 config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
-                 *(cfgoptions[i].dblptr) = dbl;
-                 printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
-           } else {
-              defval=config_setdefault_double(&(cfgoptions[i]),prefix);
-	   }	      
-        break;  
-       	case TYPE_IPV4ADDR:
-           if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
-              defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
-	   } else {
-              rst=config_assign_ipv4addr(cfgoptions, str);
-	      if (rst < 0) {
-		 fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
-                 fatalerror=1;
-              }
-           }  
+
+      case TYPE_UINT8:
+      case TYPE_INT8:
+      case TYPE_UINT16:
+      case TYPE_INT16:
+      case TYPE_UINT32:
+      case TYPE_INT32:
+      case TYPE_MASK:
+        if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
+          config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
+          config_assign_int(&(cfgoptions[i]),cfgpath,u);
+        } else {
+          defval=config_setdefault_int(&(cfgoptions[i]),prefix);
+        }
+
         break;
-       	case TYPE_LIST:
-	   setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
-           if ( setting) {
-              cfgoptions[i].numelt=config_setting_length(setting);
-           } else {
-              notfound=1;
-	   }
-       break;
-       default:
-            fprintf(stderr,"[LIBCONFIG] %s type %i  not supported\n", cfgpath,cfgoptions[i].type);
-            fatalerror=1;
-       break;
-       } /* switch on param type */
-    if( notfound == 1) {
-        printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile );
-        if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) {
+
+      case TYPE_UINT64:
+      case TYPE_INT64:
+        if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
+          config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
+
+          if(cfgoptions[i].type==TYPE_UINT64) {
+            *(cfgoptions[i].u64ptr) = (uint64_t)llu;
+            printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
+          } else {
+            *(cfgoptions[i].iptr) = llu;
+            printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
+          }
+        } else {
+          defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
+        }
+
+        break;
+
+      case TYPE_UINTARRAY:
+      case TYPE_INTARRAY:
+        setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+        if ( setting != NULL) {
+          read_intarray(&cfgoptions[i],setting,cfgpath);
+        } else {
+          defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
+        }
+
+        break;
+
+      case TYPE_DOUBLE:
+        if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
+          config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
+          *(cfgoptions[i].dblptr) = dbl;
+          printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
+        } else {
+          defval=config_setdefault_double(&(cfgoptions[i]),prefix);
+        }
+
+        break;
+
+      case TYPE_IPV4ADDR:
+        if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
+          defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
+        } else {
+          rst=config_assign_ipv4addr(cfgoptions, str);
+
+          if (rst < 0) {
+            fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
             fatalerror=1;
-            printf("  mandatory parameter missing\n");
+          }
+        }
+
+        break;
+
+      case TYPE_LIST:
+        setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
+
+        if ( setting) {
+          cfgoptions[i].numelt=config_setting_length(setting);
         } else {
-           printf("\n");
+          notfound=1;
         }
+
+        break;
+
+      default:
+        fprintf(stderr,"[LIBCONFIG] %s type %i  not supported\n", cfgpath,cfgoptions[i].type);
+        fatalerror=1;
+        break;
+    } /* switch on param type */
+
+    if( notfound == 1) {
+      printf("[LIBCONFIG] %s not found in %s ", cfgpath,libconfig_privdata.configfile );
+
+      if ( (cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) != 0) {
+        fatalerror=1;
+        printf("  mandatory parameter missing\n");
+      } else {
+        printf("\n");
+      }
     } else {
       if (defval == 1) {
-          numdefvals++;
-	  cfgoptions[i].paramflags = cfgoptions[i].paramflags |  PARAMFLAG_PARAMSETDEF;
+        numdefvals++;
+        cfgoptions[i].paramflags = cfgoptions[i].paramflags |  PARAMFLAG_PARAMSETDEF;
       } else {
-          cfgoptions[i].paramflags = cfgoptions[i].paramflags |  PARAMFLAG_PARAMSET;
+        cfgoptions[i].paramflags = cfgoptions[i].paramflags |  PARAMFLAG_PARAMSET;
       }
+
       status++;
     }
   } /* for loop on options */
+
   printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n",
-         ((prefix == NULL)?"(root)":prefix), 
+         ((prefix == NULL)?"(root)":prefix),
          status,numoptions,numdefvals );
+
   if (fatalerror == 1) {
-      fprintf(stderr,"[LIBCONFIG] fatal errors found when processing  %s \n", libconfig_privdata.configfile );
-      config_libconfig_end();
-      end_configmodule();
+    fprintf(stderr,"[LIBCONFIG] fatal errors found when processing  %s \n", libconfig_privdata.configfile );
+    config_libconfig_end();
+    end_configmodule();
   }
+
   return status;
 }
 
-int config_libconfig_getlist(paramlist_def_t *ParamList, 
-                                   paramdef_t *params, int numparams, char *prefix)
-{
-config_setting_t *setting;
-int i,j,status;
-char *listpath=NULL;
-char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
-
-    if (prefix != NULL)
-        {
-        i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname);
-        }
-    else
-        {
-        i=asprintf(&listpath ,"%s",ParamList->listname);
-        }
-    setting = config_lookup(&(libconfig_privdata.cfg), listpath);
-    if ( setting) {
-        status = ParamList->numelt = config_setting_length(setting);
-        printf_params("[LIBCONFIG] %i %s in config file %s \n", 
-               ParamList->numelt,listpath,libconfig_privdata.configfile );
+int config_libconfig_getlist(paramlist_def_t *ParamList,
+                             paramdef_t *params, int numparams, char *prefix) {
+  config_setting_t *setting;
+  int i,j,status;
+  char *listpath=NULL;
+  char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
+
+  if (prefix != NULL) {
+    i=asprintf(&listpath ,"%s.%s",prefix,ParamList->listname);
+  } else {
+    i=asprintf(&listpath ,"%s",ParamList->listname);
+  }
+
+  setting = config_lookup(&(libconfig_privdata.cfg), listpath);
+
+  if ( setting) {
+    status = ParamList->numelt = config_setting_length(setting);
+    printf_params("[LIBCONFIG] %i %s in config file %s \n",
+                  ParamList->numelt,listpath,libconfig_privdata.configfile );
+  } else {
+    printf("[LIBCONFIG] list %s not found in config file %s \n",
+           listpath,libconfig_privdata.configfile );
+    ParamList->numelt= 0;
+    status = -1;
+  }
+
+  if (ParamList->numelt > 0 && params != NULL) {
+    ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *));
+
+    if ( ParamList->paramarray != NULL) {
+      config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray);
+      config_get_if()->numptrs++;
     } else {
-        printf("[LIBCONFIG] list %s not found in config file %s \n", 
-               listpath,libconfig_privdata.configfile );
-        ParamList->numelt= 0;
-        status = -1;
+      fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+      exit(-1);
     }
-    if (ParamList->numelt > 0 && params != NULL) {
-        ParamList->paramarray = malloc(ParamList->numelt * sizeof(paramdef_t *));
-        if ( ParamList->paramarray != NULL) {
-             config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray); 
-             config_get_if()->numptrs++;
-        } else {
-             fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
-             exit(-1);
-        }
-        for (i=0 ; i < ParamList->numelt ; i++) {
-            ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t));
-            if ( ParamList->paramarray[i] != NULL) {
-                 config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]); 
-                 config_get_if()->numptrs++;
-            } else {
-                 fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
-                 exit(-1);
-            }
-            
-            memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
-            for (j=0;j<numparams;j++) {
-                ParamList->paramarray[i][j].strptr = NULL ;
-                } 
-            sprintf(cfgpath,"%s.[%i]",listpath,i);
-            config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
-        } /* for i... */
-    } /* ParamList->numelt > 0 && params != NULL */
-    if (listpath != NULL)
-        free(listpath);
-    return status;
+
+    for (i=0 ; i < ParamList->numelt ; i++) {
+      ParamList->paramarray[i] = malloc(numparams * sizeof(paramdef_t));
+
+      if ( ParamList->paramarray[i] != NULL) {
+        config_get_if()->ptrs[config_get_if()->numptrs] = (char *)(ParamList->paramarray[i]);
+        config_get_if()->numptrs++;
+      } else {
+        fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
+        exit(-1);
+      }
+
+      memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
+
+      for (j=0; j<numparams; j++) {
+        ParamList->paramarray[i][j].strptr = NULL ;
+      }
+
+      sprintf(cfgpath,"%s.[%i]",listpath,i);
+      config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
+    } /* for i... */
+  } /* ParamList->numelt > 0 && params != NULL */
+
+  if (listpath != NULL)
+    free(listpath);
+
+  return status;
 }
 
-int config_libconfig_init(char *cfgP[], int numP)
-{
+int config_libconfig_init(char *cfgP[], int numP) {
   config_init(&(libconfig_privdata.cfg));
   libconfig_privdata.configfile = strdup((char *)cfgP[0]);
   config_get_if()->numptrs=0;
@@ -317,24 +350,22 @@ int config_libconfig_init(char *cfgP[], int numP)
   /* Read the file. If there is an error, report it and exit. */
   if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
     fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__,
-                   libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
-                   config_error_text(&(libconfig_privdata.cfg)));
+            libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
+            config_error_text(&(libconfig_privdata.cfg)));
     config_destroy(&(libconfig_privdata.cfg));
     printf( "\n");
     return -1;
   }
-  
 
   return 0;
 }
 
 
-void config_libconfig_end(void )
-{
+void config_libconfig_end(void ) {
   config_destroy(&(libconfig_privdata.cfg));
+
   if ( libconfig_privdata.configfile != NULL ) {
-     free(libconfig_privdata.configfile);
-     libconfig_privdata.configfile=NULL;
-  } 
-  
+    free(libconfig_privdata.configfile);
+    libconfig_privdata.configfile=NULL;
+  }
 }
diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile
index 87a6e34c5d1e0ecd4636439d9eccf8aeacd26d38..0588c88a456c4d54965c73f4caee0e060d8b4852 100644
--- a/common/utils/T/Makefile
+++ b/common/utils/T/Makefile
@@ -19,7 +19,7 @@ T_IDs.h: $(GENIDS) T_messages.txt
 	./$(GENIDS) T_messages.txt T_IDs.h
 
 check_vcd:
-	gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
+	gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
 	./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
 	rm -f ./_check_vcd
 
diff --git a/common/utils/T/T.c b/common/utils/T/T.c
index fbd3f75a0c195fbb9d41e927fe6b3bf13150ee41..140da3068848c8aee4e3eedeef0ee084e0f52a81 100644
--- a/common/utils/T/T.c
+++ b/common/utils/T/T.c
@@ -19,7 +19,7 @@
 /* array used to activate/disactivate a log */
 static int T_IDs[T_NUMBER_OF_IDS];
 int *T_active = T_IDs;
-int T_stdout;
+int T_stdout = 1;
 
 static int T_socket;
 
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index b872b009e258408e799f6dfaaf0cc2697c1913f4..77e939affe4b7393aadb286b86c8b8551cc5d25f 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -22,9 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
-#ifdef CMAKER
 #include <platform_types.h>
-#endif
 
 #if defined(ENB_MODE)
 # define display_backtrace()
diff --git a/common/utils/time_utils.h b/common/utils/time_utils.h
deleted file mode 100644
index ee82c8cf95366cddec208bbc213d2dfcfbcf2ec6..0000000000000000000000000000000000000000
--- a/common/utils/time_utils.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _TIME_UTILS_H_
-#define _TIME_UTILS_H_
-
-#include <time.h>
-#include <stdint.h>
-
-static inline int64_t clock_difftime_ns(struct timespec start, struct timespec end)
-{
-  struct timespec temp;
-  int64_t temp_ns;
-
-  if ((end.tv_nsec-start.tv_nsec)<0) {
-    temp.tv_sec = end.tv_sec-start.tv_sec-1;
-    temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
-  } else {
-    temp.tv_sec = end.tv_sec-start.tv_sec;
-    temp.tv_nsec = end.tv_nsec-start.tv_nsec;
-  }
-  temp_ns = (int64_t)(temp.tv_sec) * (int64_t)1000000000 + (temp.tv_nsec);
-  return temp_ns;
-}
-
-#endif /* _TIME_UTILS_H_ */
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
index a8e5d665f6640f4daa03c2224b5b4cc121f3e000..25463a32890458efb5a99474ba6b7ccd34fa095b 100644
--- a/nfapi/oai_integration/nfapi_vnf.c
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -1110,7 +1110,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
   nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
 
   dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
+  dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
   int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
 
   dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols           = 1;
@@ -1129,7 +1129,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
   nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
 
   tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
+  tx_req->header.message_id = NFAPI_TX_REQUEST;
   //LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
 
   int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
@@ -1147,7 +1147,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
   nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
 
   hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
+  hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
   //LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
 
   int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
@@ -1166,7 +1166,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
   nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
 
   ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
+  ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
   //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
 
   //LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c
index d0a7fa6fd12140dd38ab66c1f866ec8d9abe3d09..0cacf8c66f1599f88cf74443488a4ef65169e63b 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf.c
@@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf)
 			address = inet_ntoa(addr->sin_addr);
 		}
 
-		NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info  %d Family:%s Address:%s\n", i++, family, address);
+		//NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info  %d Family:%s Address:%s\n", i++, family, address);
 
 		if (pnf->sctp)
 		{
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
index 8d94c23476b1f77f1e7c8a9610d109204a013f7b..81abed81a95b27935df7b19bb21ddb8b5c25f97d 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
@@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
 {
 	if(now_hr < sf_start_hr)
 	{
-		NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
+		//NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
 		return 0;
 	}
 	else
diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
index cea259c35b354d3179d178da2ce6faf3f9104f70..4b7acabec3637af74e3d95f8d9d805ea3337b118 100644
--- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c
+++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c
@@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
 
 			if(phy->in_sync == 0)
 			{
-				NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", 
+				/*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
 					ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
 					NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, 
 					phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
 					phy->zero_count,
-					phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");
+					phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
 
 				phy->sfn_sf = new_sfn_sf;
 			}
diff --git a/openair1/PHY/CODING/scrambler.h b/openair1/PHY/CODING/scrambler.h
deleted file mode 100644
index 3c1b1de0a71eb8b0198ea114dbb109f755d11005..0000000000000000000000000000000000000000
--- a/openair1/PHY/CODING/scrambler.h
+++ /dev/null
@@ -1,1047 +0,0 @@
-/*
- * 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.1  (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
- */
-
-unsigned char scrambling_sequence[1024] = {
-  208,
-  127,
-  52,
-  95,
-  204,
-  135,
-  48,
-  31,
-  248,
-  32,
-  208,
-  135,
-  192,
-  232,
-  63,
-  175,
-  4,
-  212,
-  119,
-  24,
-  169,
-  162,
-  101,
-  144,
-  75,
-  109,
-  75,
-  29,
-  91,
-  191,
-  165,
-  246,
-  177,
-  71,
-  16,
-  92,
-  68,
-  80,
-  132,
-  4,
-  248,
-  251,
-  32,
-  65,
-  125,
-  56,
-  94,
-  86,
-  152,
-  11,
-  201,
-  134,
-  39,
-  250,
-  19,
-  162,
-  25,
-  190,
-  62,
-  3,
-  190,
-  18,
-  188,
-  215,
-  97,
-  239,
-  72,
-  11,
-  0,
-  26,
-  57,
-  211,
-  146,
-  37,
-  205,
-  121,
-  204,
-  83,
-  13,
-  206,
-  53,
-  27,
-  214,
-  32,
-  54,
-  214,
-  82,
-  125,
-  226,
-  108,
-  169,
-  102,
-  247,
-  255,
-  32,
-  171,
-  201,
-  112,
-  20,
-  253,
-  65,
-  192,
-  38,
-  78,
-  114,
-  40,
-  95,
-  32,
-  70,
-  194,
-  242,
-  153,
-  207,
-  63,
-  61,
-  117,
-  122,
-  32,
-  73,
-  60,
-  160,
-  140,
-  99,
-  235,
-  118,
-  176,
-  75,
-  102,
-  254,
-  5,
-  67,
-  194,
-  122,
-  62,
-  226,
-  56,
-  69,
-  123,
-  213,
-  179,
-  119,
-  221,
-  23,
-  63,
-  26,
-  160,
-  233,
-  166,
-  179,
-  243,
-  169,
-  190,
-  183,
-  146,
-  169,
-  185,
-  216,
-  214,
-  158,
-  86,
-  139,
-  214,
-  143,
-  181,
-  0,
-  9,
-  147,
-  254,
-  105,
-  138,
-  213,
-  118,
-  14,
-  74,
-  153,
-  110,
-  41,
-  47,
-  172,
-  91,
-  216,
-  117,
-  156,
-  62,
-  56,
-  75,
-  113,
-  6,
-  123,
-  178,
-  118,
-  97,
-  82,
-  75,
-  96,
-  21,
-  148,
-  170,
-  120,
-  227,
-  0,
-  245,
-  25,
-  147,
-  243,
-  185,
-  203,
-  135,
-  48,
-  104,
-  89,
-  38,
-  71,
-  30,
-  74,
-  219,
-  130,
-  107,
-  75,
-  244,
-  138,
-  8,
-  8,
-  248,
-  175,
-  65,
-  234,
-  35,
-  125,
-  138,
-  0,
-  95,
-  23,
-  171,
-  177,
-  166,
-  196,
-  173,
-  235,
-  244,
-  124,
-  20,
-  22,
-  78,
-  32,
-  207,
-  173,
-  103,
-  232,
-  84,
-  18,
-  227,
-  246,
-  127,
-  136,
-  28,
-  188,
-  39,
-  132,
-  79,
-  14,
-  62,
-  80,
-  248,
-  171,
-  21,
-  160,
-  188,
-  110,
-  125,
-  55,
-  198,
-  139,
-  185,
-  28,
-  127,
-  239,
-  246,
-  223,
-  47,
-  55,
-  63,
-  63,
-  129,
-  253,
-  175,
-  122,
-  182,
-  139,
-  52,
-  163,
-  164,
-  177,
-  6,
-  187,
-  220,
-  159,
-  76,
-  36,
-  164,
-  108,
-  218,
-  189,
-  250,
-  148,
-  201,
-  45,
-  207,
-  174,
-  81,
-  195,
-  108,
-  96,
-  203,
-  132,
-  210,
-  34,
-  142,
-  247,
-  238,
-  139,
-  84,
-  84,
-  194,
-  168,
-  46,
-  9,
-  238,
-  29,
-  135,
-  115,
-  95,
-  12,
-  218,
-  18,
-  134,
-  110,
-  83,
-  110,
-  44,
-  80,
-  80,
-  216,
-  126,
-  160,
-  65,
-  142,
-  142,
-  209,
-  69,
-  234,
-  200,
-  184,
-  171,
-  248,
-  185,
-  148,
-  203,
-  90,
-  143,
-  231,
-  29,
-  47,
-  214,
-  151,
-  154,
-  137,
-  152,
-  228,
-  192,
-  182,
-  108,
-  200,
-  226,
-  204,
-  82,
-  170,
-  110,
-  197,
-  143,
-  169,
-  230,
-  75,
-  204,
-  177,
-  222,
-  142,
-  1,
-  104,
-  130,
-  224,
-  201,
-  29,
-  223,
-  246,
-  132,
-  173,
-  42,
-  33,
-  165,
-  147,
-  208,
-  124,
-  208,
-  198,
-  51,
-  78,
-  76,
-  216,
-  164,
-  250,
-  186,
-  214,
-  57,
-  52,
-  52,
-  199,
-  37,
-  3,
-  242,
-  120,
-  179,
-  26,
-  233,
-  51,
-  42,
-  11,
-  108,
-  26,
-  41,
-  192,
-  41,
-  221,
-  71,
-  16,
-  67,
-  131,
-  90,
-  226,
-  181,
-  0,
-  244,
-  183,
-  31,
-  78,
-  241,
-  221,
-  173,
-  248,
-  146,
-  23,
-  244,
-  102,
-  194,
-  201,
-  16,
-  25,
-  155,
-  110,
-  146,
-  54,
-  246,
-  40,
-  5,
-  78,
-  94,
-  47,
-  135,
-  60,
-  103,
-  29,
-  175,
-  142,
-  9,
-  213,
-  70,
-  159,
-  168,
-  176,
-  217,
-  91,
-  13,
-  1,
-  254,
-  104,
-  135,
-  20,
-  135,
-  147,
-  23,
-  141,
-  8,
-  115,
-  180,
-  201,
-  50,
-  246,
-  4,
-  12,
-  72,
-  59,
-  166,
-  22,
-  61,
-  77,
-  140,
-  183,
-  150,
-  255,
-  55,
-  31,
-  71,
-  215,
-  83,
-  75,
-  169,
-  137,
-  104,
-  237,
-  88,
-  118,
-  146,
-  247,
-  95,
-  182,
-  241,
-  29,
-  98,
-  243,
-  152,
-  52,
-  230,
-  114,
-  27,
-  247,
-  116,
-  78,
-  152,
-  202,
-  96,
-  15,
-  112,
-  196,
-  245,
-  148,
-  9,
-  228,
-  111,
-  131,
-  179,
-  198,
-  243,
-  35,
-  140,
-  234,
-  248,
-  8,
-  197,
-  218,
-  35,
-  246,
-  172,
-  207,
-  93,
-  62,
-  157,
-  196,
-  149,
-  199,
-  136,
-  30,
-  70,
-  13,
-  116,
-  63,
-  171,
-  207,
-  254,
-  51,
-  18,
-  126,
-  246,
-  195,
-  218,
-  222,
-  204,
-  105,
-  132,
-  150,
-  123,
-  136,
-  24,
-  23,
-  143,
-  162,
-  175,
-  185,
-  148,
-  104,
-  135,
-  118,
-  44,
-  126,
-  59,
-  67,
-  114,
-  157,
-  194,
-  201,
-  231,
-  40,
-  80,
-  42,
-  195,
-  50,
-  133,
-  186,
-  43,
-  134,
-  234,
-  170,
-  96,
-  177,
-  67,
-  61,
-  121,
-  31,
-  171,
-  120,
-  208,
-  74,
-  84,
-  33,
-  148,
-  199,
-  59,
-  171,
-  244,
-  243,
-  114,
-  92,
-  90,
-  99,
-  89,
-  181,
-  25,
-  224,
-  39,
-  149,
-  209,
-  40,
-  151,
-  1,
-  171,
-  106,
-  75,
-  126,
-  134,
-  35,
-  187,
-  12,
-  31,
-  114,
-  240,
-  229,
-  182,
-  48,
-  86,
-  192,
-  247,
-  109,
-  78,
-  111,
-  74,
-  207,
-  72,
-  232,
-  177,
-  126,
-  167,
-  213,
-  139,
-  124,
-  122,
-  18,
-  108,
-  35,
-  213,
-  86,
-  218,
-  226,
-  143,
-  169,
-  11,
-  165,
-  137,
-  241,
-  146,
-  115,
-  208,
-  178,
-  197,
-  0,
-  119,
-  147,
-  29,
-  144,
-  167,
-  236,
-  133,
-  233,
-  23,
-  140,
-  30,
-  186,
-  159,
-  76,
-  6,
-  150,
-  13,
-  72,
-  34,
-  240,
-  114,
-  192,
-  238,
-  72,
-  42,
-  177,
-  15,
-  33,
-  162,
-  170,
-  167,
-  64,
-  169,
-  78,
-  162,
-  226,
-  229,
-  191,
-  209,
-  140,
-  213,
-  161,
-  23,
-  147,
-  249,
-  103,
-  56,
-  153,
-  108,
-  105,
-  148,
-  177,
-  245,
-  168,
-  201,
-  101,
-  103,
-  5,
-  104,
-  90,
-  171,
-  155,
-  153,
-  121,
-  130,
-  35,
-  112,
-  242,
-  140,
-  206,
-  125,
-  225,
-  79,
-  154,
-  161,
-  143,
-  71,
-  45,
-  145,
-  15,
-  95,
-  105,
-  202,
-  158,
-  11,
-  119,
-  124,
-  66,
-  60,
-  86,
-  118,
-  120,
-  101,
-  209,
-  58,
-  211,
-  184,
-  42,
-  142,
-  66,
-  201,
-  147,
-  149,
-  26,
-  213,
-  168,
-  108,
-  93,
-  237,
-  168,
-  152,
-  128,
-  44,
-  87,
-  140,
-  248,
-  218,
-  189,
-  93,
-  25,
-  76,
-  249,
-  103,
-  187,
-  167,
-  31,
-  194,
-  133,
-  247,
-  148,
-  20,
-  169,
-  141,
-  166,
-  118,
-  102,
-  208,
-  187,
-  177,
-  71,
-  70,
-  182,
-  55,
-  205,
-  174,
-  20,
-  234,
-  146,
-  78,
-  115,
-  199,
-  104,
-  89,
-  254,
-  232,
-  246,
-  208,
-  127,
-  242,
-  221,
-  200,
-  198,
-  66,
-  153,
-  12,
-  25,
-  184,
-  78,
-  203,
-  45,
-  233,
-  51,
-  253,
-  169,
-  30,
-  5,
-  65,
-  188,
-  226,
-  167,
-  236,
-  17,
-  173,
-  193,
-  123,
-  249,
-  117,
-  107,
-  140,
-  56,
-  91,
-  180,
-  19,
-  79,
-  5,
-  204,
-  185,
-  109,
-  37,
-  187,
-  147,
-  197,
-  58,
-  100,
-  40,
-  11,
-  22,
-  248,
-  236,
-  189,
-  218,
-  3,
-  109,
-  243,
-  153,
-  247,
-  142,
-  35,
-  59,
-  228,
-  102,
-  130,
-  141,
-  200,
-  201,
-  101,
-  139,
-  129,
-  21,
-  246,
-  111,
-  143,
-  95,
-  249,
-  7,
-  196,
-  85,
-  133,
-  175,
-  59,
-  130,
-  214,
-  255,
-  36,
-  49,
-  209,
-  144,
-  168,
-  20,
-  126,
-  19,
-  198,
-  119,
-  221,
-  229,
-  245,
-  173,
-  218,
-  244,
-  14,
-  53,
-  221,
-  252,
-  107,
-  213,
-  65,
-  129,
-  23,
-  187,
-  196,
-  118,
-  77,
-  205,
-  9,
-  75,
-  179,
-  23,
-  176,
-  49,
-  41,
-  84,
-  163,
-  182,
-  156,
-  167,
-  247,
-  95,
-  212,
-  43,
-  183,
-  152,
-  63,
-  252,
-  67,
-  21,
-  224,
-  128,
-  201,
-  251,
-  136,
-  117,
-  214,
-  96,
-  226,
-  157,
-  79,
-  154,
-  98,
-  120,
-  65,
-  134,
-  130,
-  138,
-  197,
-  64,
-  171,
-  85,
-  144,
-  120,
-  179,
-  180
-};
diff --git a/openair1/PHY/INIT/init_extern.h b/openair1/PHY/INIT/init_extern.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair1/PHY/INIT/init_extern.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.1  (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
- */
-
diff --git a/openair1/PHY/INIT/init_vars.h b/openair1/PHY/INIT/init_vars.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair1/PHY/INIT/init_vars.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.1  (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
- */
-
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
deleted file mode 100644
index 516cb32999b505aa08f1e36c2c23a1d08c747288..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#include "PHY/types.h"
-#include "PHY/defs_UE.h"
-#include "PHY/phy_extern_ue.h"
-
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "openair2/LAYER2/MAC/mac_proto.h"
-
-#define DEBUG_PHY
-
-// Adjust location synchronization point to account for drift
-// The adjustment is performed once per frame based on the
-// last channel estimate of the receiver
-
-void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
-                      PHY_VARS_UE *ue,
-                      module_id_t eNB_id,
-					  uint8_t subframe,
-                      unsigned char clear,
-                      short coef)
-{
-
-  static int max_pos_fil = 0;
-  static int count_max_pos_ok = 0;
-  static int first_time = 1;
-  int temp = 0, i, aa, max_val = 0, max_pos = 0;
-  int diff;
-  short Re,Im,ncoef;
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_IN);
-
-  ncoef = 32767 - coef;
-
-#ifdef DEBUG_PHY
-  LOG_D(PHY,"AbsSubframe %d.%d: rx_offset (before) = %d\n",ue->proc.proc_rxtx[0].frame_rx%1024,subframe,ue->rx_offset);
-#endif //DEBUG_PHY
-
-
-  // we only use channel estimates from tx antenna 0 here
-  for (i = 0; i < frame_parms->nb_prefix_samples; i++) {
-    temp = 0;
-
-    for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
-      Re = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[(i<<1)];
-      Im = ((int16_t*)ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id][aa])[1+(i<<1)];
-      temp += (Re*Re/2) + (Im*Im/2);
-    }
-
-    if (temp > max_val) {
-      max_pos = i;
-      max_val = temp;
-    }
-  }
-
-  // filter position to reduce jitter
-  if (clear == 1)
-    max_pos_fil = max_pos;
-  else
-    max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15;
-
-  // do not filter to have proactive timing adjustment
-  max_pos_fil = max_pos;
-
-  if(subframe == 5)
-  {
-      diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
-
-#if BASIC_SIMULATOR
-      /* a hack without which the UE does not connect (to be fixed somehow) */
-      diff = 0;
-#endif
-
-      if ( abs(diff) < SYNCH_HYST )
-          ue->rx_offset = 0;
-      else
-          ue->rx_offset = diff;
-
-      if(abs(diff)<5)
-          count_max_pos_ok ++;
-      else
-          count_max_pos_ok = 0;
-
-      if(count_max_pos_ok > 10 && first_time == 1)
-      {
-          first_time = 0;
-          ue->time_sync_cell = 1;
-          if (ue->mac_enabled==1) {
-              LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
-              //mac_resynch();
-              dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
-              ue->UE_mode[0] = PRACH;
-          }
-          else {
-              ue->UE_mode[0] = PUSCH;
-          }
-      }
-
-      if ( ue->rx_offset < 0 )
-          ue->rx_offset += FRAME_LENGTH_COMPLEX_SAMPLES;
-
-      if ( ue->rx_offset >= FRAME_LENGTH_COMPLEX_SAMPLES )
-          ue->rx_offset -= FRAME_LENGTH_COMPLEX_SAMPLES;
-
-
-
-      #ifdef DEBUG_PHY
-      LOG_D(PHY,"AbsSubframe %d.%d: ThreadId %d diff =%i rx_offset (final) = %i : clear %d,max_pos = %d,max_pos_fil = %d (peak %d) max_val %d target_pos %d \n",
-              ue->proc.proc_rxtx[ue->current_thread_id[subframe]].frame_rx,
-              subframe,
-              ue->current_thread_id[subframe],
-              diff,
-              ue->rx_offset,
-              clear,
-              max_pos,
-              max_pos_fil,
-              temp,max_val,
-              (frame_parms->nb_prefix_samples>>3));
-      #endif //DEBUG_PHY
-
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH, VCD_FUNCTION_OUT);
-  }
-}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
index c912c8893482c1c00c47b73128a0e7de5b73a052..e8a0913e7386ec20027e0060116ca1331c03a1a5 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
@@ -36,7 +36,7 @@
 void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
                       PHY_VARS_UE *ue,
                       module_id_t eNB_id,
-					  uint8_t subframe,
+		      uint8_t subframe,
                       unsigned char clear,
                       short coef)
 {
@@ -96,6 +96,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
       else
           count_max_pos_ok = 0;
 
+
       if(count_max_pos_ok > 10 && first_time == 1)
       {
           first_time = 0;
@@ -103,7 +104,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
           if (ue->mac_enabled==1) {
               LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
               //mac_resynch();
-              dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
+              //dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
               ue->UE_mode[0] = PRACH;
           }
           else {
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_ESTIMATION/lte_estimation_extern.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.1  (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
- */
-
diff --git a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h b/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h
deleted file mode 100644
index 59959a90fd3b8203cb59a52c963a5e30229ba8da..0000000000000000000000000000000000000000
--- a/openair1/PHY/LTE_TRANSPORT/mcs_tbs_tools.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#define modOrder(I_MCS,I_TBS) ((I_MCS-I_TBS)*2+2) // Find modulation order from I_TBS and I_MCS
-
-/** \fn unsigned char I_TBS2I_MCS(unsigned char I_TBS);
-\brief This function maps I_tbs to I_mcs according to Table 7.1.7.1-1 in 3GPP TS 36.213 V8.6.0. Where there is two supported modulation orders for the same I_TBS then either high or low modulation is chosen by changing the equality of the two first comparisons in the if-else statement.
-\param I_TBS Index of Transport Block Size
-\return I_MCS given I_TBS
-*/
-unsigned char I_TBS2I_MCS(unsigned char I_TBS);
-
-/** \fn unsigned char SE2I_TBS(float SE,
-        unsigned char N_PRB,
-        unsigned char symbPerRB);
-\brief This function maps a requested throughput in number of bits to I_tbs. The throughput is calculated as a function of modulation order, RB allocation and number of symbols per RB. The mapping orginates in the "Transport block size table" (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0)
-\param SE Spectral Efficiency (before casting to integer, multiply by 1024, remember to divide result by 1024!)
-\param N_PRB Number of PhysicalResourceBlocks allocated \sa lte_frame_parms->N_RB_DL
-\param symbPerRB Number of symbols per resource block allocated to this channel
-\return I_TBS given an SE and an N_PRB
-*/
-unsigned char SE2I_TBS(float SE,
-                       unsigned char N_PRB,
-                       unsigned char symbPerRB);
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
index 4b475478b6a67e3d6c114e2c58c44102be9f281e..0c0d2c962d83fb7d0b216bba008db35d44a71576 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h
@@ -457,14 +457,6 @@ void generate_pcfich(uint8_t num_pdcch_symbols,
                      int32_t **txdataF,
                      uint8_t subframe);
 
-
-
-
-
-void init_transport_channels(uint8_t);
-
-
-
 void rx_ulsch(PHY_VARS_eNB *eNB,
               L1_rxtx_proc_t *proc,
               uint8_t UE_id);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
index 49b9e8b808b5fd0db93c0e0323d2ac68a4f4ab03..762db5f4164cfcef71b046bf60b921a81466a5ea 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
@@ -1438,8 +1438,6 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
 void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms);
 
 
-void init_transport_channels(uint8_t);
-
 void generate_RIV_tables(void);
 
 /*!
diff --git a/openair1/PHY/MODULATION/prach625Hz.h b/openair1/PHY/MODULATION/prach625Hz.h
deleted file mode 100644
index 38b63b3b053bb02d7e609137bcfcd0af78031d1c..0000000000000000000000000000000000000000
--- a/openair1/PHY/MODULATION/prach625Hz.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.1  (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
- */
-
-int16_t sig625_1_25MHz[2850*2];
-int16_t sig625_2_5MHz[5700*2];
-int16_t sig625_5MHz[11400*2];
-int16_t sig625_10MHz[22800*2];
-int16_t sig625_15MHz[34200*2];
-int16_t sig625_20MHz[45600*2];
diff --git a/openair1/PHY/Makefile.inc b/openair1/PHY/Makefile.inc
deleted file mode 100644
index 90094b31f8605946ba6c18f31eb070b4ff99f484..0000000000000000000000000000000000000000
--- a/openair1/PHY/Makefile.inc
+++ /dev/null
@@ -1,91 +0,0 @@
-PHY_OBJS =  $(TOP_DIR)/PHY/LTE_TRANSPORT/pss.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/sss.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_ue_spec.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_mbsfn.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_coding.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_modulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_demodulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_llr_computation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/power_control.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_decoding.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_scrambling.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dci_tools.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/uci_tools.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/lte_mcs.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pbch.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dci.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/phich.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pcfich.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pucch.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/prach.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pmch.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/group_hopping.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/srs_modulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/drs_modulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_modulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_demodulation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_coding.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/ulsch_decoding.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/rar_tools.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/print_stats.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/initial_sync.o
-#PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/lte_transport_init.o
-PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/ofdm_mod.o
-PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep.o
-PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep_mbsfn.o
-PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/slot_fep_ul.o
-PHY_OBJS += $(TOP_DIR)/PHY/MODULATION/ul_7_5_kHz.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/freq_equalization.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_time.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_timefreq.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_adjust_sync.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_est_freq_offset.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ue_measurements.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_eNB_measurements.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/adjust_gain.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_cell_spec.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_ue_spec.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold_mbsfn.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_mbsfn.o
-PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_ul_ref.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/lte_segmentation.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/ccoding_byte.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/ccoding_byte_lte.o
-#PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_sse.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/crc_byte.o
-#PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/lte_rate_matching.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/rate_matching.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/viterbi.o
-PHY_OBJS += $(TOP_DIR)/PHY/CODING/viterbi_lte.o
-PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_init.o
-PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_parms.o
-PHY_OBJS += $(TOP_DIR)/PHY/INIT/init_top.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/file_output.o
-#PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/fft.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/lte_dfts.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/log2_approx.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cmult_sv.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cmult_vv.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cadd_vv.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cdot_prod.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/signal_energy.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/dB_routines.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/sqrt.o
-ifdef SMBV
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/smbv.o
-endif
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/time_meas.o
-PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/lut.o
-#PHY_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o
-
diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h
index a303902b0795fce0965fcdb646da227d50ef9a96..5beb6e3ba0e524cfa39d232110b66bfa48ce26da 100644
--- a/openair1/PHY/defs_UE.h
+++ b/openair1/PHY/defs_UE.h
@@ -204,6 +204,12 @@ typedef struct {
 	/// condition variable for timer_thread;
 	pthread_cond_t cond_ticking;
 	//time_stats_t timer_stats;
+
+	// below 3 members is used for waiting each UE threads(multiple UEs test) in L2 FAPI simulator.
+	// This used in UE_phy_stub_single_thread_rxn_txnp4
+	pthread_mutex_t mutex_single_thread;
+	pthread_cond_t  cond_single_thread;
+	int             num_single_thread[NUMBER_OF_UE_MAX];
 } SF_ticking;
 
 typedef struct {
@@ -890,6 +896,7 @@ typedef struct {
 struct rx_tx_thread_data {
   PHY_VARS_UE    *UE;
   UE_rxtx_proc_t *proc;
+  uint16_t       ue_thread_id;
 };
 
 
diff --git a/openair1/SCHED/Makefile.inc b/openair1/SCHED/Makefile.inc
deleted file mode 100644
index 559d3dca32b2db60e50caa0f8fc349edf9499e1e..0000000000000000000000000000000000000000
--- a/openair1/SCHED/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o
-SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_ue.o
-SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_eNb.o
-SCHED_OBJS += $(TOP_DIR)/SCHED/pusch_pc.o
-SCHED_OBJS += $(TOP_DIR)/SCHED/pucch_pc.o
-SCHED_OBJS += $(TOP_DIR)/SCHED/srs_pc.o
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index 2af47fb2c011b38a0ae29bf7b7898527843e2025..d9c674406943bc34d47599cf352f9d8bdac4a960 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -1332,12 +1332,13 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
     prach_power = generate_prach(ue,eNB_id,subframe_tx,frame_tx);
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
     //      stop_meas(&ue->tx_prach);
-    LOG_D(PHY,"[UE  %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n",
-          ue->Mod_id,
-          get_PL(ue->Mod_id,ue->CC_id,eNB_id),
-          ue->tx_power_dBm[subframe_tx],
-          dB_fixed(prach_power),
-          ue->prach_vars[eNB_id]->amp);
+    LOG_I(PHY,"[UE  %d][RAPROC] PRACH PL %d dB, power %d dBm (max %d dBm), digital power %d dB (amp %d)\n",
+	  ue->Mod_id,
+	  get_PL(ue->Mod_id,ue->CC_id,eNB_id),
+	  ue->tx_power_dBm[subframe_tx],
+          ue->tx_power_max_dBm,
+	  dB_fixed(prach_power),
+	  ue->prach_vars[eNB_id]->amp);
 
     if (ue->mac_enabled==1) {
       Msg1_transmitted(ue->Mod_id,
@@ -2178,8 +2179,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
   }
 
   if (subframe_select(&ue->frame_parms,proc->subframe_tx) == SF_UL ||
-      ue->frame_parms.frame_type == FDD) {
-    if (ue->UE_mode[eNB_id] != PRACH ) {
+      ue->frame_parms.frame_type == FDD) {    
+    if (ue->UE_mode[eNB_id] > PRACH ) {
       // check cell srs subframe and ue srs subframe. This has an impact on pusch encoding
       isSubframeSRS = is_srs_occasion_common(&ue->frame_parms,proc->frame_tx,proc->subframe_tx);
       ue_compute_srs_occasion(ue,proc,eNB_id,isSubframeSRS);
@@ -2409,8 +2410,8 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
                           ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
     }
 
-    // if this is the first PBCH after initial synchronization, make L1 state = PRACH
-    if (ue->UE_mode[eNB_id]==NOT_SYNCHED) ue->UE_mode[eNB_id] = PRACH;
+    // if this is the first PBCH after initial synchronization and no timing correction is performed, make L1 state = PRACH
+    if (ue->UE_mode[eNB_id]==NOT_SYNCHED && ue->no_timing_correction == 1) ue->UE_mode[eNB_id] = PRACH;
 
     if (first_run) {
       first_run = 0;
@@ -4783,7 +4784,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
     if (msg_p != NULL) {
       switch (ITTI_MSG_ID(msg_p)) {
         case PHY_FIND_CELL_REQ:
-          LOG_I(PHY, "[UE %d] Received %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p));
+          LOG_E(PHY, "[UE %d] Received PLMN doesn't match SIM data, but not developped further processing %s\n", ITTI_MSG_INSTANCE (msg_p) - NB_eNB_INST, ITTI_MSG_NAME (msg_p));
           /* TODO process the message */
           break;
 
diff --git a/openair2/COMMON/intertask_interface_conf.h b/openair2/COMMON/intertask_interface_conf.h
deleted file mode 100644
index 9c108f87e08395753404665293f67ca282751f3f..0000000000000000000000000000000000000000
--- a/openair2/COMMON/intertask_interface_conf.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*
- * intertask_interface_conf.h
- *
- *  Created on: Oct 21, 2013
- *      Author: winckel
- */
-
-#ifndef INTERTASK_INTERFACE_CONF_H_
-#define INTERTASK_INTERFACE_CONF_H_
-
-/*******************************************************************************
- * Intertask Interface Constants
- ******************************************************************************/
-
-#define ITTI_PORT                (10006)
-
-/* This is the queue size for signal dumper */
-#define ITTI_QUEUE_MAX_ELEMENTS  (10 * 1000)
-#define ITTI_DUMP_MAX_CON        (5)    /* Max connections in parallel */
-
-#endif /* INTERTASK_INTERFACE_CONF_H_ */
diff --git a/openair2/COMMON/messages_types.h b/openair2/COMMON/messages_types.h
deleted file mode 100644
index 5e5fdadd2adb4e7e3316454a69e802197fde3c1c..0000000000000000000000000000000000000000
--- a/openair2/COMMON/messages_types.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*
- * messages_types.h
- *
- *  Created on: Oct 14, 2013
- *      Author: winckel
- */
-
-#ifndef MESSAGES_TYPES_H_
-#define MESSAGES_TYPES_H_
-
-#include "intertask_messages_types.h"
-#include "timer_messages_types.h"
-
-#include "phy_messages_types.h"
-#include "mac_messages_types.h"
-#include "rlc_messages_types.h"
-#include "pdcp_messages_types.h"
-#include "rrc_messages_types.h"
-#include "nas_messages_types.h"
-#if ENABLE_RAL
-#include "ral_messages_types.h"
-#endif
-#include "s1ap_messages_types.h"
-#include "x2ap_messages_types.h"
-#include "sctp_messages_types.h"
-#include "udp_messages_types.h"
-#include "gtpv1_u_messages_types.h"
-
-#endif /* MESSAGES_TYPES_H_ */
diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h
index b00e08588af444c807fd0edb346634f6e9209984..2b28b760a813fcfcf0a98e6ebff5d20779d7cddd 100644
--- a/openair2/COMMON/platform_constants.h
+++ b/openair2/COMMON/platform_constants.h
@@ -28,11 +28,7 @@
 
  ***************************************************************************/
 
-#ifdef CMAKER
 #include "LTE_asn_constant.h"
-#else
-#include "RRC/LTE/MESSAGES/asn1_constants.h"
-#endif
 
 #ifndef __PLATFORM_CONSTANTS_H__
 #    define __PLATFORM_CONSTANTS_H__
@@ -68,6 +64,16 @@
 #    define MAX_MODULES                NB_MODULES_MAX
 
 #ifndef UE_EXPANSION
+// TODO:L2 FAPI simulator.
+// UESIM_EXPANSION is used to be same value of MAX_MOBILES_PER_ENB
+// in eNB and UE.
+// now , if we use --mu option in UE, compiling error will occur.
+// This problem will be fixed in the future.
+# ifdef UESIM_EXPANSION
+#    define MAX_MOBILES_PER_ENB         256
+#    define MAX_MOBILES_PER_ENB_NB_IoT  256
+#    define MAX_eNB                      2
+# else
 # ifdef LARGE_SCALE
 #    define MAX_MOBILES_PER_ENB         128
 #    define MAX_MOBILES_PER_ENB_NB_IoT  128
@@ -77,6 +83,7 @@
 #    define MAX_MOBILES_PER_ENB_NB_IoT  16
 #    define MAX_eNB                      2
 # endif
+#endif
 #else
 #    define MAX_MOBILES_PER_ENB 256
 #    define MAX_MOBILES_PER_ENB_NB_IoT 256
diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index c1b554c216d255bd9429ad6db2366cfd17669a27..9a47580dbc785b0fae1009785bc63a3f0e59e2bf 100644
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -32,11 +32,7 @@
 #include "as_message.h"
 #include "rrc_types.h"
 #include "s1ap_messages_types.h"
-#ifdef CMAKER
   #include "LTE_SystemInformationBlockType2.h"
-#else
-  #include "RRC/LTE/MESSAGES/LTE_SystemInformationBlockType2.h"
-#endif
 #include "LTE_SL-OffsetIndicator-r12.h"
 #include "LTE_SubframeBitmapSL-r12.h"
 #include "LTE_SL-CP-Len-r12.h"
diff --git a/openair2/ENB_APP/Makefile.inc b/openair2/ENB_APP/Makefile.inc
deleted file mode 100644
index e018d676105f151594d2f6abfb230593a4b7680d..0000000000000000000000000000000000000000
--- a/openair2/ENB_APP/Makefile.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-ENB_APP_DIR = $(OPENAIR2_TOP)/ENB_APP
-
-ENB_APP_OBJS =  $(ENB_APP_DIR)/enb_app.o \
-                $(ENB_APP_DIR)/enb_config.o 
-ENB_APP_incl = \
-    -I$(ENB_APP_DIR) -I$(OPENAIR2_TOP)
-    
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index 1b47a112cf5556a62f28c0927c94c21365801916..f5cf3018288485afffd0c5118b00e0c2b24917bb 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -40,12 +40,8 @@
 #include "PHY/impl_defs_lte.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
-#ifdef CMAKER
 #include "LTE_SystemInformationBlockType2.h"
 #include "rrc_messages_types.h"
-#else
-#include "RRC/LTE/MESSAGES/LTE_SystemInformationBlockType2.h"
-#endif
 #include "RRC/LTE/rrc_defs.h"
 #include <intertask_interface.h>
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 825a6f255edd2a06c694fbc295ae7a76ba07ba4d..9ed785d0ff630874100ba283c95a49c8b21bf10f 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -1426,7 +1426,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 
 	    if (ra->state == MSG2)
 		generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
-	    else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
+		else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
 		generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
 	    else if (ra->state == WAITMSG4ACK)
 		check_Msg4_retransmission(module_idP, CC_id, frameP,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index 77f1c42b608e63ec8e15ae9761fb53348fa78cd4..a8009d4551f895b53234948826f30cd53296d376 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -594,6 +594,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
   LTE_eNB_UE_stats *eNB_UE_stats2 = NULL;
   UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2;
 #endif
+  memset(rballoc_sub[0],0,(MAX_NUM_CCs)*(N_RBG_MAX)*sizeof(unsigned char));
   memset(min_rb_unit,0,sizeof(min_rb_unit));
 
   for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 59a725fa52a3ba614697688757b0ecc61cd752b7..cfeadb68f00e87f1ae52e18337692384ba12f46d 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -61,6 +61,7 @@ extern uint16_t frame_cnt;
 #include "SCHED/sched_common.h"
 
 extern RAN_CONTEXT_t RC;
+extern uint8_t nfapi_mode;
 
 int choose(int n, int k) {
   int res = 1;
@@ -1332,6 +1333,7 @@ fill_nfapi_ulsch_harq_information(module_id_t                            module_
   */
 #endif
   harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index;
+  harq_information->harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
   AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
               "pucch_ConfigDedicated is null!\n");
 
@@ -3640,40 +3642,52 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
     LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]);
 
     switch (harq_indication_fdd->mode) {
-      case 0:   // Format 1a/b (10.1.2.1)
-        AssertFatal(numCC == 1,
-                    "numCC %d > 1, should not be using Format1a/b\n",
-                    numCC);
-
-        if (tmode[0] == 1 || tmode[0] == 2 || tmode[0] == 5 || tmode[0] == 6 || tmode[0] == 7) {  // NOTE: have to handle the case of TM9-10 with 1 antenna port
+      case 0:	// Format 1a/b (10.1.2.1)
+        AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n", numCC);
+        if (tmode[0] == 1 || tmode[0] == 2 || tmode[0] == 5 || tmode[0] == 6 || tmode[0] == 7) {	// NOTE: have to handle the case of TM9-10 with 1 antenna port
           // single ACK/NAK bit
-          AssertFatal(num_ack_nak == 1,
-                      "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n",
-                      num_ack_nak,frameP,subframeP);
-          AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
-                      "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
-                      harq_pid, UE_id, rnti);
-          AssertFatal(pdu[0] == 1 || pdu[0] == 2
-                      || pdu[0] == 4,
-                      "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
-                      pdu[0], harq_pid, UE_id, rnti);
-          LOG_D(MAC, "Received %d for harq_pid %d\n", pdu[0],
-                harq_pid);
+          AssertFatal(num_ack_nak == 1, "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n", num_ack_nak,frameP,subframeP);
+
+          // In case of nFAPI, sometimes timing of eNB and UE become different.
+          // So if nfapi_mode == 2(VNF) , this function don't check assertion to avoid process exit.
+          if (nfapi_mode != 2) {
+            AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
+                  harq_pid, 
+                  UE_id, 
+                  rnti);
+          } else {
+            if (sched_ctl->round[CC_idP][harq_pid] == 8) {
+              LOG_E(MAC,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", harq_pid, UE_id, rnti);
+              return;
+            }
+          }
+
+          AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
+                pdu[0],
+                harq_pid,
+                UE_id,
+                rnti);
+
+          LOG_D(MAC, "Received %d for harq_pid %d\n", pdu[0], harq_pid);
+
           RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
 
           for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
-            if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) &&
-                (ra[ra_i].crnti_harq_pid == harq_pid)) {
-              LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",pdu[0],rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
-
-              if(pdu[0] == 1) {
+            if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) &&  (ra[ra_i].crnti_harq_pid == harq_pid)) {
+              LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",
+                    pdu[0],
+                    rnti,
+                    sched_ctl->round[CC_idP][harq_pid],
+                    frameP,subframeP);
+
+              if (pdu[0] == 1) {
                 cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
               } else {
                 if(sched_ctl->round[CC_idP][harq_pid] == 7) {
                   cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
                 }
               }
-
+              
               break;
             }
           }
diff --git a/openair2/LAYER2/MAC/lte_transport_init.c b/openair2/LAYER2/MAC/lte_transport_init.c
deleted file mode 100644
index e1f21f21e44935e7bf071b9377e6e69548201506..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/MAC/lte_transport_init.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#define UL_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,24)
-#define BCCH_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,4)
-#define RA_RB_ALLOC mac_xface->computeRIV(mac_xface->frame_parms->N_RB_UL,0,4)
-#define DLSCH_RB_ALLOC 0x1fff
-#include "extern.h"
-
-
-void init_transport_channels(unsigned char transmission_mode)
-{
-
-    // init DCI structures for testing
-
-    UL_alloc_pdu.type = 0;
-    UL_alloc_pdu.hopping = 0;
-    UL_alloc_pdu.rballoc = UL_RB_ALLOC;
-    UL_alloc_pdu.mcs = 2;
-    UL_alloc_pdu.ndi = 1;
-    UL_alloc_pdu.TPC = 0;
-    UL_alloc_pdu.cqi_req = 1;
-
-    /*
-       BCCH_alloc_pdu.type               = 1;
-       BCCH_alloc_pdu.vrb_type           = 0;
-       BCCH_alloc_pdu.rballoc            = BCCH_RB_ALLOC;
-       BCCH_alloc_pdu.ndi      = 1;
-       BCCH_alloc_pdu.rv       = 1;
-       BCCH_alloc_pdu.mcs      = 1;
-       BCCH_alloc_pdu.harq_pid = 0;
-       BCCH_alloc_pdu.TPC      = 1;      // set to 3 PRB
-
-       // for FDD mode
-       BCCH_alloc_pdu_fdd.type               = 1;
-       BCCH_alloc_pdu_fdd.vrb_type           = 0;
-       BCCH_alloc_pdu_fdd.rballoc            = BCCH_RB_ALLOC;
-       BCCH_alloc_pdu_fdd.ndi      = 1;
-       BCCH_alloc_pdu_fdd.rv       = 1;
-       BCCH_alloc_pdu_fdd.mcs      = 1;
-       BCCH_alloc_pdu_fdd.harq_pid = 0;
-       BCCH_alloc_pdu_fdd.TPC      = 1;      // set to 3 PRB
-     */
-
-    DLSCH_alloc_pdu1A.type = 1;
-    DLSCH_alloc_pdu1A.vrb_type = 0;
-    DLSCH_alloc_pdu1A.rballoc = BCCH_RB_ALLOC;
-    DLSCH_alloc_pdu1A.ndi = 1;
-    DLSCH_alloc_pdu1A.rv = 1;
-    DLSCH_alloc_pdu1A.mcs = 2;
-    DLSCH_alloc_pdu1A.harq_pid = 0;
-    DLSCH_alloc_pdu1A.TPC = 1;	// set to 3 PRB
-
-    DLSCH_alloc_pdu1A_fdd.type = 1;
-    DLSCH_alloc_pdu1A_fdd.vrb_type = 0;
-    DLSCH_alloc_pdu1A_fdd.rballoc = BCCH_RB_ALLOC;
-    DLSCH_alloc_pdu1A_fdd.ndi = 1;
-    DLSCH_alloc_pdu1A_fdd.rv = 1;
-    DLSCH_alloc_pdu1A_fdd.mcs = 2;
-    DLSCH_alloc_pdu1A_fdd.harq_pid = 0;
-    DLSCH_alloc_pdu1A_fdd.TPC = 1;	// set to 3 PRB
-
-    RA_alloc_pdu.type = 1;
-    RA_alloc_pdu.vrb_type = 0;
-    RA_alloc_pdu.rballoc = RA_RB_ALLOC;
-    RA_alloc_pdu.ndi = 1;
-    RA_alloc_pdu.rv = 0;
-    RA_alloc_pdu.mcs = 0;
-    RA_alloc_pdu.harq_pid = 0;
-    RA_alloc_pdu.TPC = 1;
-
-    RA_alloc_pdu_fdd.type = 1;
-    RA_alloc_pdu_fdd.vrb_type = 0;
-    RA_alloc_pdu_fdd.rballoc = RA_RB_ALLOC;
-    RA_alloc_pdu_fdd.ndi = 1;
-    RA_alloc_pdu_fdd.rv = 1;
-    RA_alloc_pdu_fdd.mcs = 1;
-    RA_alloc_pdu_fdd.harq_pid = 0;
-    RA_alloc_pdu_fdd.TPC = 1;
-
-
-    DLSCH_alloc_pdu1.rballoc = 0xf;
-    DLSCH_alloc_pdu1.TPC = 0;
-    DLSCH_alloc_pdu1.dai = 0;
-    DLSCH_alloc_pdu1.harq_pid = 0;
-    DLSCH_alloc_pdu1.tb_swap = 0;
-    DLSCH_alloc_pdu1.mcs1 = 4;
-    DLSCH_alloc_pdu1.ndi1 = 1;
-    DLSCH_alloc_pdu1.rv1 = 0;
-
-    // Forget second codeword
-    if (transmission_mode == 6) {
-	DLSCH_alloc_pdu1.tpmi = 5;	// PUSCH_PRECODING0
-    } else {
-	DLSCH_alloc_pdu1.tpmi = 0;
-    }
-
-    DLSCH_alloc_pdu2.rah = 0;
-    DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
-    DLSCH_alloc_pdu2.TPC = 0;
-    DLSCH_alloc_pdu2.dai = 0;
-    DLSCH_alloc_pdu2.harq_pid = 0;
-    DLSCH_alloc_pdu2.tb_swap = 0;
-    DLSCH_alloc_pdu2.mcs1 = 4;
-    DLSCH_alloc_pdu2.ndi1 = 1;
-    DLSCH_alloc_pdu2.rv1 = 0;
-
-    // Forget second codeword
-    if (transmission_mode == 6) {
-	DLSCH_alloc_pdu2.tpmi = 5;	// PUSCH_PRECODING0
-    } else {
-	DLSCH_alloc_pdu2.tpmi = 0;
-    }
-}
diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h
index ca72882471f11122633b5dc76af58740f73ce757..fd9ffb6a87ebce7c297cb0c8b3fce8b25aee361d 100644
--- a/openair2/LAYER2/MAC/mac_extern.h
+++ b/openair2/LAYER2/MAC/mac_extern.h
@@ -64,7 +64,8 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES
 extern unsigned char NB_INST;
 #endif
 extern unsigned char NB_eNB_INST;
-extern unsigned char NB_UE_INST;
+extern uint16_t NB_UE_INST;
+extern uint16_t NB_THREAD_INST;
 extern unsigned char NB_RN_INST;
 extern unsigned short NODE_ID[1];
 
diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h
index 4090d954bc538b80152f7381c235b3c7d5c892c7..7126301a7c82292a399914bb455f713059912b39 100644
--- a/openair2/LAYER2/MAC/mac_vars.h
+++ b/openair2/LAYER2/MAC/mac_vars.h
@@ -95,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = {
 
 uint32_t RRC_CONNECTION_FLAG;
 
-UE_MAC_INST *UE_mac_inst;	//[NB_MODULE_MAX];
+UE_MAC_INST *UE_mac_inst = NULL;	//[NB_MODULE_MAX];
 MAC_RLC_XFACE *Mac_rlc_xface;
 
 /// Primary component carrier index of eNB
@@ -109,7 +109,8 @@ eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN
 
 #ifdef OPENAIR2
 unsigned char NB_eNB_INST = 0;
-unsigned char NB_UE_INST = 0;
+uint16_t NB_UE_INST = 0;
+uint16_t NB_THREAD_INST = 0;
 unsigned char NB_RN_INST = 0;
 unsigned char NB_INST = 0;
 #endif
diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c
index 95f25c7ff51b72648bf1c9d2a4e5d058bce2baa3..1168ed265abde1667da8f9e28f5395c96d093bc4 100644
--- a/openair2/LAYER2/MAC/main_ue.c
+++ b/openair2/LAYER2/MAC/main_ue.c
@@ -43,7 +43,8 @@
 
 
 #include "common/ran_context.h"
-
+extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
+extern uint8_t nfapi_mode;
 extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
 
 void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync)	//init as MR
@@ -103,6 +104,15 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer,
 	UE_mac_inst = NULL;
     }
 
+    // mutex below are used for multiple UE's L2 FAPI simulation.
+    if (nfapi_mode == 3){
+      pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL);
+      pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL);
+      pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL);
+      pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL);
+      pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL);
+      pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL);
+    }
 
     LOG_I(MAC, "[MAIN] calling RRC\n");
     openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 207815b12265be61b23be32c6e3e277581f79ed8..19765cff040b230f2190e93ff54f7de81c373bd7 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -69,6 +69,8 @@
 extern UL_IND_t *UL_INFO;
 
 extern uint8_t  nfapi_mode;
+extern int next_ra_frame;
+extern module_id_t next_Mod_id;
 
 /*
  *
@@ -2070,7 +2072,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
 		if (sdu_lengths[num_sdus]) {
 		    sdu_length_total += sdu_lengths[num_sdus];
 		    sdu_lcids[num_sdus] = lcid;
-		    LOG_D(MAC,
+		    LOG_I(MAC,
 			  "[UE %d] TX Multiplex RLC PDU TX Got %d bytes for LcId%d\n",
 			  module_idP, sdu_lengths[num_sdus], lcid);
 
@@ -2523,44 +2525,50 @@ ue_scheduler(const module_id_t module_idP,
 				   UE_mac_inst[module_idP].crnti, txFrameP,
 				   txSubframeP, eNB_indexP);
 #if defined(ENABLE_ITTI)
+    if(module_idP == 0){
+      do {
+	  // Checks if a message has been sent to MAC sub-task
+	  itti_poll_msg(TASK_MAC_UE, &msg_p);
 
-    do {
-	// Checks if a message has been sent to MAC sub-task
-	itti_poll_msg(TASK_MAC_UE, &msg_p);
+	    if (msg_p != NULL) {
 
-	if (msg_p != NULL) {
+	      switch (ITTI_MSG_ID(msg_p)) {
+	      case RRC_MAC_CCCH_DATA_REQ:
+		  LOG_I(MAC,
+		        "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
+		        ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p),
+		        RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
+		        RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
 
-	    switch (ITTI_MSG_ID(msg_p)) {
-	    case RRC_MAC_CCCH_DATA_REQ:
-		LOG_I(MAC,
-		      "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
-		      ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p),
-		      RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
-		      RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
+		  // TODO process CCCH data req.
+		  break;
 
-		// TODO process CCCH data req.
-		break;
 
+	      default:
+		  LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p));
+		  break;
+	      }
 
-	    default:
-		LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p));
-		break;
+	      result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
+	      AssertFatal(result == EXIT_SUCCESS,
+			  "Failed to free memory (%d)!\n", result);
 	    }
-
-	    result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
-	    AssertFatal(result == EXIT_SUCCESS,
-			"Failed to free memory (%d)!\n", result);
-	}
-    }
+      }
     while (msg_p != NULL);
-
+    }
 #endif
 
     //Mac_rlc_xface->frameP=frameP;
     //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
     //if (subframe%5 == 0)
     //LG#ifdef EXMIMO
-    pdcp_run(&ctxt);
+
+    // data to/from NETLINK is treated in pdcp_run.
+    // one socket is used in multiple UE's L2 FAPI simulator and
+    // only first UE need to do this.
+    if(module_idP == 0){
+      pdcp_run(&ctxt);
+    }
     //#endif
     UE_mac_inst[module_idP].txFrame = txFrameP;
     UE_mac_inst[module_idP].txSubframe = txSubframeP;
diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc
deleted file mode 100644
index 2f5cea7555462e485dcf00b0d1ec9dc10a98feb5..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/Makefile.inc
+++ /dev/null
@@ -1,118 +0,0 @@
-ifeq ($(OPENAIR2),1)
-EXTRA_CFLAGS += -DOPENAIR2
-endif
-EXTRA_CFLAGS += -DASSERT
-EXTRA_CFLAGS += -DNO_RRM
-
-COMMON_DIR = $(OPENAIR2_TOP)/COMMON
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v9.3.0
-RLC_AM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/AM_v9.3.0
-RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM_v9.3.0
-RLC_DIR = $(OPENAIR2_TOP)/LAYER2/RLC
-PDCP_DIR = $(OPENAIR2_TOP)/LAYER2/PDCP_v10.1.0
-PHY_INTERFACE_DIR = $(OPENAIR2_TOP)/PHY_INTERFACE
-RRC_DIR = $(OPENAIR2_TOP)/RRC/LITE
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-MAC_DIR = $(OPENAIR2_TOP)/LAYER2/MAC
-RRC_CELL_DIR = $(OPENAIR2_TOP)/RRC/CELLULAR
-
-SOURCES_L2 +=  $(OPENAIR2_TOP)/LAYER2/openair2_proc.c 
-
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_fifo.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_sequence_manager.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_primitives.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_util.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_security.c
-SOURCES_L2 +=  $(PDCP_DIR)/pdcp_netlink.c
-
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_init.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_timer_poll_retransmit.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_timer_reordering.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_timer_status_prohibit.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_segment.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_segments_holes.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_in_sdu.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_receiver.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_retransmit.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_windows.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_rx_list.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_reassembly.c
-SOURCES_L2 +=  $(RLC_AM_DIR)/rlc_am_status_report.c
-
-
-SOURCES_L2 +=  $(RLC_TM_DIR)/rlc_tm.c
-SOURCES_L2 +=  $(RLC_TM_DIR)/rlc_tm_init.c
-
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_fsm.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_control_primitives.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_segment.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_reassembly.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_receiver.c
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_dar.c
-
-SOURCES_L2 +=  $(RLC_DIR)/rlc_mac.c
-SOURCES_L2 +=  $(RLC_DIR)/rlc.c
-SOURCES_L2 +=  $(RLC_DIR)/rlc_rrc.c
-SOURCES_L2 +=  $(RLC_DIR)/rlc_mpls.c
-
-RRC_OBJS =  $(RRC_DIR)/rrc_UE.o
-ifeq ($(ENABLE_RAL),1)
-RRC_OBJS +=  $(RRC_DIR)/rrc_UE_ral.o
-RRC_OBJS +=  $(RRC_DIR)/rrc_eNB_ral.o
-endif
-
-RRC_OBJS += $(RRC_DIR)/rrc_eNB.o
-RRC_OBJS += $(RRC_DIR)/rrc_eNB_UE_context.o
-RRC_OBJS += $(RRC_DIR)/rrc_eNB_S1AP.o
-ifdef USE_MME
-RRC_OBJS += $(RRC_DIR)/rrc_eNB_GTPV1U.o
-endif
-RRC_OBJS += $(RRC_DIR)/rrc_common.o
-RRC_OBJS += $(RRC_DIR)/L2_interface.o
-
-MAC_OBJS =  $(MAC_DIR)/lte_transport_init.o
-MAC_OBJS += $(MAC_DIR)/main.o
-MAC_OBJS += $(MAC_DIR)/ue_procedures.o
-MAC_OBJS += $(MAC_DIR)/ra_procedures.o
-MAC_OBJS += $(MAC_DIR)/l1_helpers.o
-MAC_OBJS += $(MAC_DIR)/rar_tools.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_dlsch.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_ulsch.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_mch.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_bch.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_primitives.o
-MAC_OBJS += $(MAC_DIR)/eNB_scheduler_RA.o
-MAC_OBJS += $(MAC_DIR)/pre_processor.o
-MAC_OBJS += $(MAC_DIR)/config.o
-
-L2_INTERFACE_OBJS = $(L2_INTERFACE_DIR)/openair_rrc_L2_interface.o
-
-L2_OBJS=$(addsuffix .o,$(basename $(SOURCES_L2))) $(PHY_INTERFACE_OBJS) $(MAC_OBJS) $(L2_INTERFACE_OBJS)
-
-L2_incl =  -I$(OPENAIR2_TOP)
-L2_incl =  -I$(OPENAIR_DIR)/common/utils/msc
-L2_incl += -I$(COMMON_DIR)
-L2_incl += -I$(RLC_DIR)
-L2_incl += -I$(RLC_AM_DIR)
-L2_incl += -I$(RLC_UM_DIR)
-L2_incl += -I$(RLC_TM_DIR)
-L2_incl += -I$(PDCP_DIR)
-L2_incl += -I$(OPENAIR3)/MESH
-L2_incl += -I$(OPENAIR2_TOP)/RRC/LITE/MESSAGES
-L2_incl += -I$(OPENAIR3)/MESH/RRM
-
-ifeq ($(rrc_cellular),1)
-  include $(RRC_CELL_DIR)/Makefile.inc
-  L2_OBJS += $(RRC_CELLULAR_OBJS)
-  L2_incl += -I$(OPENAIR2_TOP)/RRC/CELLULAR
-  EXTRA_CFLAGS += -DRRC_CELLULAR -DCELLULAR
-else
-  L2_OBJS += $(RRC_OBJS)
-  L2_incl += -I$(OPENAIR2_TOP)/RRC/LITE
-endif
-
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 6167e1e6ca1b4b6a63037b7b5b45a9cd927c323f..b21a5c24220b565f002cd448ce73dfac3e5971ea 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -49,7 +49,7 @@
 #include "platform_constants.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "msc.h"
-
+#include "targets/COMMON/openairinterface5g_limits.h"
 #if defined(ENABLE_SECURITY)
 # include "UTIL/OSA/osa_defs.h"
 #endif
@@ -64,9 +64,12 @@
 #endif
 
 extern int otg_enabled;
-
+#if defined(ENABLE_USE_MME)
+extern uint8_t nfapi_mode;
+#endif
 #include "common/ran_context.h"
 extern RAN_CONTEXT_t RC;
+hash_table_t  *pdcp_coll_p = NULL;
 
 #ifdef MBMS_MULTICAST_OUT
 # include <sys/types.h>
@@ -182,6 +185,7 @@ boolean_t pdcp_data_req(
                                 (unsigned char*)&pdcp_pdu_p->data[0],
                                 sdu_buffer_sizeP);
 #endif
+      LOG_D(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP);
       rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p
 #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
                                 ,NULL, NULL
@@ -366,6 +370,7 @@ boolean_t pdcp_data_req(
     LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size,
                 "[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP);
 
+    LOG_D(PDCP, "Before rlc_data_req 2, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP);
     rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p
 #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
                              ,sourceL2Id
@@ -471,6 +476,7 @@ pdcp_data_ind(
   LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
               "[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
 
+
 #if T_TRACER
   if (ctxt_pP->enb_flag != ENB_FLAG_NO)
     T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP));
@@ -795,18 +801,30 @@ pdcp_data_ind(
          * for the UE compiled in noS1 mode, we need 0
          * TODO: be sure of this
          */
-        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = 1;
+        if (nfapi_mode == 3) {
+#ifdef UESIM_EXPANSION
+          ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = 0;
+#else
+          ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id;
+#endif
+        } else {
+          ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = 1;
+        }
 #endif
       } else {
         ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB);
+        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id;
       }
-      ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id;
+      // new_sdu_p->data->inst is set again in UE case so move to above.
+      //Panos: Commented this out because it cancels the assignment in #if defined(ENABLE_USE_MME) case
+      //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id;
 
 #ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
       static uint32_t pdcp_inst = 0;
       ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = pdcp_inst++;
       LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size);
 #endif
+      //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; //pdcp_inst++;
 
       memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \
              &sdu_buffer_pP->data[payload_offset], \
@@ -962,7 +980,7 @@ pdcp_run (
           RRC_DCCH_DATA_REQ (msg_p).frame, 
 	  0,
 	  RRC_DCCH_DATA_REQ (msg_p).eNB_index);
-        LOG_I(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
+        LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
               PROTOCOL_CTXT_ARGS(&ctxt),
               ITTI_MSG_NAME (msg_p),
               ITTI_MSG_ORIGIN_NAME(msg_p),
@@ -972,6 +990,7 @@ pdcp_run (
               RRC_DCCH_DATA_REQ (msg_p).confirmp,
               RRC_DCCH_DATA_REQ (msg_p).mode);
 
+        LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %d \n", RRC_DCCH_DATA_REQ (msg_p).rb_id);
         result = pdcp_data_req (&ctxt,
                                 SRB_FLAG_YES,
                                 RRC_DCCH_DATA_REQ (msg_p).rb_id,
@@ -2014,7 +2033,7 @@ void pdcp_layer_init(void)
    * Initialize SDU list
    */
   list_init(&pdcp_sdu_list, NULL);
-  pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * 16, NULL, pdcp_free);
+  pdcp_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free);
   AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed");
 
   for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) {
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index bc3bdac828828cce47915f50165b47bae83f41ce..69157b639837bf146ef29b8306f997597314809b 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -542,7 +542,7 @@ sdu_size_t             pdcp_input_sdu_remaining_size_to_read;
     (((hash_key_t)(sESSION_ID)) << 37) | \
     (((hash_key_t)(0x0000000000000001))  << 63))
 
-hash_table_t  *pdcp_coll_p;
+extern hash_table_t  *pdcp_coll_p;
 
 #endif
 /*@}*/
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 7cab8cb40e0d0cdd472d4b32398270cb9ecb34d2..906fbaba5a4f626cb2457c89f9687138f88b36b0 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -82,10 +82,13 @@ extern struct msghdr nas_msg_tx;
 extern struct msghdr nas_msg_rx;
 
 unsigned char pdcp_read_state_g = 0;
+extern uint8_t nfapi_mode;
+#ifdef UESIM_EXPANSION
+extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
+#endif
 #endif
 
 extern Packet_OTG_List_t *otg_pdcp_buffer;
-
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
 #  include "gtpv1u_eNB_task.h"
 #  include "gtpv1u_eNB_defs.h"
@@ -168,7 +171,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const  ctxt_pP)
             ((pdcp_data_ind_header_t*) sdu_p->data)->inst,
             ((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
 #else
-      ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
+      // Raphael: was suppressed by Raymond --> should be suppressed?
+      // value of sdu_p->data->inst is set in pdcp_data_ind
+      // it's necessary to set 1 in case of UE with S1.
+      //if (ctxt_pP->enb_flag){
+      //  ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
+      //}
 #endif
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
@@ -195,7 +203,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const  ctxt_pP)
 
 #endif /* defined(ENABLE_USE_MME) */
 #ifdef PDCP_DEBUG
-      LOG_D(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n",
+      LOG_I(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n",
             ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst,
             ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id);
 #endif //PDCP_DEBUG
@@ -719,11 +727,11 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
          if (!ctxt.enb_flag) {
             if (rab_id != 0) {
                if (rab_id == UE_IP_DEFAULT_RAB_ID) {
-                  LOG_I(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
+                  LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n",
                         ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                   key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                   h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
-                  LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+                  LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
                         (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
                } else {
                   rab_id = rab_id % LTE_maxDRB;
@@ -927,7 +935,15 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
             rab_id      = pdcp_read_header_g.rb_id % LTE_maxDRB;
             ctxt.rnti          = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / LTE_maxDRB];
           } else {
-            ctxt.module_id = 0;
+            if (nfapi_mode == 3) {
+#ifdef UESIM_EXPANSION
+              ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
+#else
+              ctxt.module_id = pdcp_read_header_g.inst;
+#endif
+            } else {
+              ctxt.module_id = 0;
+            }
             rab_id      = pdcp_read_header_g.rb_id % LTE_maxDRB;
             ctxt.rnti          = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
           }
@@ -1072,7 +1088,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                                           pdcp_read_header_g.rb_id,
                                           rab_id,
                                           pdcp_read_header_g.data_size);
-
+                        if(nfapi_mode == 3){
+                        pdcp_data_req(
+                              &ctxt,
+                              SRB_FLAG_NO,
+                              rab_id,
+                              RLC_MUI_UNDEFINED,
+                              RLC_SDU_CONFIRM_NO,
+                              pdcp_read_header_g.data_size,
+                              (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+                              PDCP_TRANSMISSION_MODE_DATA
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+                              ,NULL
+                              ,NULL
+#endif
+                              );
+                        }else{
                         pdcp_data_req(
                               &ctxt,
                               SRB_FLAG_NO,
@@ -1087,6 +1118,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                               ,&pdcp_read_header_g.destinationL2Id
 #endif
                               );
+                        }
                      } else {
                         MSC_LOG_RX_DISCARDED_MESSAGE(
                               (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
@@ -1130,7 +1162,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                                        pdcp_read_header_g.rb_id,
                                        DEFAULT_RAB_ID,
                                        pdcp_read_header_g.data_size);
-
+                     if(nfapi_mode == 3){
+                     pdcp_data_req (
+                           &ctxt,
+                           SRB_FLAG_NO,
+                           DEFAULT_RAB_ID,
+                           RLC_MUI_UNDEFINED,
+                           RLC_SDU_CONFIRM_NO,
+                           pdcp_read_header_g.data_size,
+                           (unsigned char *)NLMSG_DATA(nas_nlh_rx),
+                           PDCP_TRANSMISSION_MODE_DATA
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+                           ,NULL
+                           ,NULL
+#endif
+                               );
+                     }else{
                      pdcp_data_req (
                            &ctxt,
                            SRB_FLAG_NO,
@@ -1145,6 +1192,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                            ,&pdcp_read_header_g.destinationL2Id
 #endif
                            );
+                     }
                   }
                }
 
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h
deleted file mode 100644
index 4690bba42e5b91f4721d727b38d41da928e0c55a..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_proto_extern.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.1  (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
- */
-
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/Makefile b/openair2/LAYER2/RLC/UM_v9.3.0/Makefile
deleted file mode 100644
index 2d56c809cb98d638b7ba36997f7d69912e33b110..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-CFLAGS +=  -I$(RLC_DIR)
-CFLAGS +=  -I$(RLC_UM_DIR)
-CFLAGS +=  -I$(RLC_AM_DIR)
-CFLAGS +=  -I$(COMMON_DIR)
-CFLAGS +=  -I$(TRACE_DIR)
-CFLAGS +=  -I$(LISTS_DIR)
-CFLAGS +=  -I$(MEM_DIR)
-
-DEBUG_FLAGS += -O2
-
-OBJ = rlc_um.o rlc_um_segment.o 
-
-
-############################################################
-#
-# The following should be identical in all Makefiles
-#
-#define the target object files
-
-ifdef TARGETDIR
-	TARGETOBJ = $(addprefix ${TARGETDIR}/, ${OBJ})
-	TARGETLIB = ${TARGETDIR}/Lib.a
-endif
-
-include $(TARGETOBJ:.o=.d)
-
-# Look for source files in the parent directory
-%.o: ../%.c %.d
-	$(CCC) -c ${DEBUG_FLAGS} ${CFLAGS} ${INCLUDE} -o $@ $<
-
-# Rule to remake and keep the .d dependency Makefiles
-# Note that the sed command includes adding the TARGETDIR
-#  and that ! is used for s delimiter
-%.d: ../%.c
-	$(SHELL) -ec '$(CCC) -MM $(CFLAGS) $< \
-	| sed '\''s!\($(*F)\)\.o[ :]*!$(TARGETDIR)/\1.o $@ : !g'\'' > $@ ;\
-	[ -s $@ ] || rm -f $@'
-.PRECIOUS: %.d
-
-all: ${TARGETLIB}
-
-${TARGETLIB}: ${TARGETOBJ}
-	ar -rv ${TARGETLIB} ${TARGETOBJ}
-
-clean:
-	rm -f ${TARGETDIR}/*.o ${TARGETDIR}/*.a
-
-clean_dep:
-	rm -f ${TARGETDIR}/*.d
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index e56877d6016dc238b69b34730102d971c914b1c6..428f3c19c714e4000f7e8cc349479fa8440c03f0 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -34,7 +34,7 @@
 #include "common/utils/LOG/log.h"
 #include "UTIL/OCG/OCG_vars.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
-
+#include "targets/COMMON/openairinterface5g_limits.h"
 #include "assertions.h"
 
 extern boolean_t pdcp_data_ind(
@@ -403,11 +403,18 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t* const ctxt_pP,
     key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
   }
   if (sourceL2Id && destinationL2Id){
-     key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
+	  LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
+	      key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
+
+	      //Thinh's line originally uncommented
+	      //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
+
+
      //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
   } else
 #endif
   {
+	  LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
     key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
   }
 
@@ -649,7 +656,7 @@ rlc_module_init (void)
   rlc_rrc_data_ind  = NULL;
   rlc_rrc_data_conf = NULL;
 
-  rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * 16, NULL, rb_free_rlc_union);
+  rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union);
   //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
   if(rlc_coll_p == NULL) {
     LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index da90a58a59e617aaf8f13008016364118bc44969..d4ec487c853e9e270fcbb1c518bae6a5d8e79486 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -254,6 +254,7 @@ void mac_rlc_data_ind     (
   srb_flag_t             srb_flag        = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
   protocol_ctxt_t     ctxt;
 
+
   PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index);
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN);
diff --git a/openair2/LAYER2/register.h b/openair2/LAYER2/register.h
deleted file mode 100644
index 8a4aeb5b12336011cbc80aff0a6f547a411b49c4..0000000000000000000000000000000000000000
--- a/openair2/LAYER2/register.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*________________________rrc_register.h________________________
-
- Authors : Hicham Anouar, Raymond Knopp
- Company : EURECOM
- Emails  : anouar@eurecom.fr,  knopp@eurecom.fr
-________________________________________________________________*/
-
-#ifndef __MAC_RRC_REGISTER_H__
-#    define __MAC_RRC_REGISTER_H__
-#include "COMMON/mac_rrc_primitives.h"
-/** @defgroup _mac_impl_register RRC Registration interface
- * @ingroup _mac_impl_
- *@{
- */
-MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE* RRC_xface);
-int mac_rrc_unregister(RRC_XFACE *RRC_xface);
-#endif
diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h
index e23188d357006d2bebf16f58c5650cbea5d39266..f3f30f92244148cc0ee8f571306e66e4b9f9cb2f 100644
--- a/openair2/NETWORK_DRIVER/MESH/local.h
+++ b/openair2/NETWORK_DRIVER/MESH/local.h
@@ -64,6 +64,8 @@
 #include "rrc_nas_primitives.h"
 #include "COMMON/platform_types.h"
 
+#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
+
 struct rb_entity {
   nasRadioBearerId_t rab_id;
   nasSapId_t sapi;
@@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s {
   sdu_size_t          data_size;
   signed int          inst;
   ip_traffic_type_t   traffic_type;
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+  uint32_t sourceL2Id;
+  uint32_t destinationL2Id;
+#endif
 } pdcp_data_req_header_t;
 
 typedef struct pdcp_data_ind_header_s {
@@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s {
   sdu_size_t          data_size;
   signed int          inst;
   ip_traffic_type_t   dummy_traffic_type;
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+  uint32_t sourceL2Id;
+  uint32_t destinationL2Id;
+#endif
 } pdcp_data_ind_header_t;
 
 extern struct net_device *nasdev[NB_INSTANCES_MAX];
diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c
index 87d8ca01edfe1af115b36b37180739b743650509..1f0545270828579ca49903ea2aa9989d7898224e 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/common.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/common.c
@@ -304,7 +304,16 @@ ue_ip_common_ip2wireless(
     if (dst_addr) {
       printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, dst_addr[0],dst_addr[1],dst_addr[2],dst_addr[3]);
     }
-
+    // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start
+#ifdef UESIM_EXPANSION
+    if ((src_addr[3] - 2)> instP) {
+        pdcph.inst = src_addr[3] - 2;
+        printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst);
+        instP = src_addr[3] - 2;
+        priv_p=netdev_priv(ue_ip_dev[instP]);
+    }
+#endif
+    // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator end
     //get Ipv4 address and pass to PCDP header
     printk("[UE_IP_DRV] source Id: 0x%08x\n",pdcph.sourceL2Id );
     printk("[UE_IP_DRV] destinationL2Id Id: 0x%08x\n",pdcph.destinationL2Id );
diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c
index 47c820fe775330dd0aa9de35052667f31e4b0266..4f295543dca310e933694d9b296a7f2c0b7ce87b 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/device.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/device.c
@@ -394,7 +394,7 @@ int init_module (void)
 
   for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) {
     printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst);
-    sprintf(devicename,"oip%d",inst);
+    sprintf(devicename,"oip%d",inst+1);
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
     ue_ip_dev[inst]  = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init);
 #else
diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h
index 26c9a60476b35ece534d996b3cb9bdab2eda9f24..b6ede7d598a05f1e06e802fb0d52b46a96510b50 100644
--- a/openair2/PHY_INTERFACE/IF_Module.h
+++ b/openair2/PHY_INTERFACE/IF_Module.h
@@ -128,6 +128,17 @@ typedef struct IF_Module_s{
   pthread_mutex_t if_mutex;
 }IF_Module_t;
 
+// These mutex is used for multiple UEs L2 FAPI simulator.
+// Each UEs set these value in UL and UL_INFO is shared in all UE's thread.
+typedef struct {
+  pthread_mutex_t rx_mutex;
+  pthread_mutex_t crc_mutex;
+  pthread_mutex_t sr_mutex;
+  pthread_mutex_t harq_mutex;
+  pthread_mutex_t cqi_mutex;
+  pthread_mutex_t rach_mutex;
+}FILL_UL_INFO_MUTEX_t;
+
 /*Initial */
 IF_Module_t *IF_Module_init(int Mod_id);
 void IF_Module_kill(int Mod_id);
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c
index 18e2fa4cb742a03820ba376fc0cd78894ce149f0..0c961d9fbbb99a4f6b938c88137f0e7533887f0e 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.c
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.c
@@ -25,7 +25,11 @@ extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
 void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
 
 
-
+UL_IND_t *UL_INFO = NULL;
+nfapi_tx_request_pdu_t* tx_request_pdu_list = NULL;
+nfapi_dl_config_request_t* dl_config_req = NULL;
+nfapi_ul_config_request_t* ul_config_req = NULL;
+nfapi_hi_dci0_request_t* hi_dci0_req = NULL;
 
 //extern uint8_t nfapi_pnf;
 //UL_IND_t *UL_INFO;
@@ -47,7 +51,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
 	  int timing_advance_update;
 
 
-	  pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	  // pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	  // change for mutiple UE's simulation.
+	  pthread_mutex_lock(&fill_ul_mutex.rx_mutex);
 
 
 	  UL_INFO->rx_ind.sfn_sf                    = frame<<4| subframe;
@@ -65,7 +71,11 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
 	  //pdu->rx_indication_rel8.length         = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
 	  pdu->rx_indication_rel8.length         = buflen;
 	  pdu->rx_indication_rel8.offset         = 1;   // DJP - I dont understand - but broken unless 1 ????  0;  // filled in at the end of the UL_INFO formation
-	  pdu->data                              = ulsch_buffer;
+
+	  // ulsch_buffer is necessary to keep its value. 
+	  //pdu->data                              = ulsch_buffer;
+	  pdu->data = malloc(buflen);
+	  memcpy(pdu->data,ulsch_buffer,buflen);
 	  // estimate timing advance for MAC
 	  //sync_pos                               = lte_est_timing_advance_pusch(eNB,UE_id);
 	  timing_advance_update                  = 0;  // Don't know what to put here
@@ -80,7 +90,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
 
 	  UL_INFO->rx_ind.rx_indication_body.number_of_pdus++;
 	  UL_INFO->rx_ind.sfn_sf = frame<<4 | subframe;
-	  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	  // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	  // change for mutiple UE's simulation.
+	  pthread_mutex_unlock(&fill_ul_mutex.rx_mutex);
 
 
 }
@@ -88,7 +100,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
 void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti) {
 
 
-  pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_lock(&fill_ul_mutex.sr_mutex);
 
   nfapi_sr_indication_t       *sr_ind = &UL_INFO->sr_ind;
   nfapi_sr_indication_body_t  *sr_ind_body =    &sr_ind->sr_indication_body;
@@ -122,13 +136,17 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I
 
   //UL_INFO->rx_ind.rx_indication_body.number_of_pdus++;
   sr_ind_body->number_of_srs++;
-  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_unlock(&fill_ul_mutex.sr_mutex);
 }
 
 
 void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t crc_flag, int index, uint16_t rnti) {
 
-  pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_lock(&fill_ul_mutex.crc_mutex);
 
   // REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE!
   nfapi_crc_indication_pdu_t *pdu =   &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs];
@@ -151,14 +169,21 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_
 
   LOG_D(PHY, "%s() rnti:%04x pdus:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
 
-  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_unlock(&fill_ul_mutex.crc_mutex);
 }
 
 void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI) {
 
 	LOG_D(MAC, "fill_rach_indication_UE_MAC 1 \n");
-	pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
-	UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
+
+	// change for mutiple UE's simulation.
+	// pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	pthread_mutex_lock(&fill_ul_mutex.rach_mutex);
+	
+	// memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4.
+	// UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
 
 	    UL_INFO->rach_ind.rach_indication_body.number_of_preambles                 = 1;
 
@@ -195,16 +220,22 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
 	          // with that branch.
 	          oai_nfapi_rach_ind(&UL_INFO->rach_ind);
 	          free(UL_INFO->rach_ind.rach_indication_body.preamble_list);
-	          free(UL_INFO);
+
+	         // memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4.
+	          //free(UL_INFO);
 
 	        //}
-	      pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	      // change for mutiple UE's simulation.
+	      // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	      pthread_mutex_unlock(&fill_ul_mutex.rach_mutex);
 
 }
 
 void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subframe, UL_IND_t *UL_INFO, uint16_t rnti) {
 
-	pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	// change for mutiple UE's simulation.
+	//pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+	pthread_mutex_lock(&fill_ul_mutex.cqi_mutex);
 	nfapi_cqi_indication_pdu_t *pdu         = &UL_INFO->cqi_ind.cqi_pdu_list[UL_INFO->cqi_ind.number_of_cqis];
 	nfapi_cqi_indication_raw_pdu_t *raw_pdu = &UL_INFO->cqi_ind.cqi_raw_pdu_list[UL_INFO->cqi_ind.number_of_cqis];
 
@@ -233,14 +264,18 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram
 
 
   UL_INFO->cqi_ind.number_of_cqis++;
-  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
-
+  // change for mutiple UE's simulation.
+  //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex);
 }
 
 void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IND_t *UL_INFO, nfapi_ul_config_ulsch_harq_information *harq_information, uint16_t rnti)
 {
 
-  pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_lock(&fill_ul_mutex.harq_mutex);
+
   nfapi_harq_indication_pdu_t *pdu =   &UL_INFO->harq_ind.harq_indication_body.harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs];
   int i;
 
@@ -271,8 +306,9 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN
     }
 
   UL_INFO->harq_ind.harq_indication_body.number_of_harqs++;
-  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
-}
+  // change for mutiple UE's simulation.
+  //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);}
 
 
 void fill_uci_harq_indication_UE_MAC(int Mod_id,
@@ -285,7 +321,10 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
 			      uint16_t tdd_multiplexing_mask*/) {
 
 
-  pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_lock(&fill_ul_mutex.harq_mutex);
+
   nfapi_harq_indication_t *ind       = &UL_INFO->harq_ind;
   nfapi_harq_indication_body_t *body = &ind->harq_indication_body;
   nfapi_harq_indication_pdu_t *pdu =   &body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs];
@@ -311,6 +350,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
   else if (SNRtimes10 >  635) pdu->ul_cqi_information.ul_cqi=255;
   else                        pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5;
   pdu->ul_cqi_information.channel = 0;
+  if(harq_information->harq_information_rel9_fdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG){
       if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) &&
           (harq_information->harq_information_rel9_fdd.harq_size == 1)) {
 
@@ -332,12 +372,31 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
       pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX)
 
     }
-    else AssertFatal(1==0,"only format 1a/b for now, received \n");
+  }else if(harq_information->harq_information_rel10_tdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG ){
+      if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 0) &&
+          (harq_information->harq_information_rel10_tdd.harq_size == 1)) {
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
+        pdu->harq_indication_tdd_rel13.mode = 0;
+        pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
+        pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
+
+      }  else if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 1) &&
+                  (harq_information->harq_information_rel10_tdd.harq_size == 2)) {
+        pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
+        pdu->harq_indication_tdd_rel13.mode = 0;
+        pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
+        pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
+        pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = 1;
+
+      }
+  } else AssertFatal(1==0,"only format 1a/b for now, received \n");
 
 
   UL_INFO->harq_ind.harq_indication_body.number_of_harqs++;
   LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d\n", UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
-  pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  // change for mutiple UE's simulation.
+  //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
+  pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);
 
 }
 
@@ -622,7 +681,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
 				//if(tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data!= NULL && tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_length >0){
 				*/
 
-				if(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1){
+				// to avoid unexpected error , add check pdu_index is more than 0.
+				if((dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index >= 0) &&(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1)){
 				//if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){
 
 					LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems);
diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h
index 9060951b26068a974ed92c7b21e25772054ac96b..21fb8518fad866e88c1d78f21aecd232657916c4 100644
--- a/openair2/PHY_INTERFACE/phy_stub_UE.h
+++ b/openair2/PHY_INTERFACE/phy_stub_UE.h
@@ -17,19 +17,23 @@
 //#include "openair1/PHY/defs.h"
 //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
 
-UL_IND_t *UL_INFO;
-
-nfapi_tx_request_pdu_t* tx_request_pdu_list;
+// this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
+FILL_UL_INFO_MUTEX_t fill_ul_mutex;
+//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
+extern UL_IND_t *UL_INFO;
+extern nfapi_tx_request_pdu_t* tx_request_pdu_list;
 // New
 /// Pointers to config_request types. Used from nfapi callback functions.
-nfapi_dl_config_request_t* dl_config_req;
-nfapi_ul_config_request_t* ul_config_req;
-nfapi_hi_dci0_request_t* hi_dci0_req;
+//below 3 difinitions move to phy_stub_UE.c to add initialization when difinition.
+extern nfapi_dl_config_request_t* dl_config_req;
+extern nfapi_ul_config_request_t* ul_config_req;
+extern nfapi_hi_dci0_request_t* hi_dci0_req;
 
 int	tx_req_num_elems;
 
-int next_ra_frame;
-module_id_t next_Mod_id;
+//below 2 difinitions move to lte-ue.c to add initialization when difinition.
+//int next_ra_frame;
+//module_id_t next_Mod_id;
 eth_params_t         stub_eth_params;
 
 
diff --git a/openair2/RRC/LTE/MESSAGES/Makefile.inc b/openair2/RRC/LTE/MESSAGES/Makefile.inc
deleted file mode 100644
index aa17ad51ca9a50d77011378c2da83e2374baa11b..0000000000000000000000000000000000000000
--- a/openair2/RRC/LTE/MESSAGES/Makefile.inc
+++ /dev/null
@@ -1,91 +0,0 @@
-
-current_release_asn1_module=$(strip $(notdir $(wildcard $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-*)))
-
-ifdef CBA
-    COMMON_CFLAGS += -DRel10
-    COMMON_CFLAGS += -DCBA
-    ifneq ($(current_release_asn1_module), .lock-rel10-cba)
-        tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-                rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\
-                cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\
-                rm EUTRA-RRC-Definitions.asn ;\
-                ln -s EUTRA-RRC-Definitions-a20-lola.asn EUTRA-RRC-Definitions.asn ; \
-                cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\
-                rm -f $(ASN1_MSG_OBJS1) ;\
-                rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\
-                rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\
-                rm -f $(L2_OBJS) ;\
-                rm -f *.o ;\
-                rm -f oaisim ;\
-                rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\
-                touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10-cba ;\
-                /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\
-                cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-                awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated  )
-    endif
-
-else ifdef Rel10
-   COMMON_CFLAGS += -DRel10
-   ifneq  ($(current_release_asn1_module), .lock-rel10)
-      tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-              rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\
-              cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\
-              rm EUTRA-RRC-Definitions.asn ;\
-              ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ;\
-              cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\
-              rm -f $(ASN1_MSG_OBJS1) ;\
-              rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\
-              rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\
-              rm -f $(L2_OBJS) ;\
-              rm -f *.o ;\
-              rm -f oaisim ;\
-              rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\
-              touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10 ;\
-              /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\
-              cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-              awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated  )
-   endif
-
-else # default is rel 8
-   COMMON_CFLAGS += -DRel8
-   ifneq  ($(current_release_asn1_module), .lock-rel8)
-       tmp3:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-               rm -f ${ASN_MODULE_SOURCES} $(ASN_MODULE_HEADERS) *.o *.d ;\
-               cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ;\
-               rm EUTRA-RRC-Definitions.asn ;\
-               ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ;\
-               cd $(OPENAIR_TARGETS)/SIMU/USER/ ;\
-               rm -f $(ASN1_MSG_OBJS1) ;\
-               rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ;\
-               rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample ;\
-               rm -f $(L2_OBJS);\
-               rm -f *.o ;\
-               rm -f oaisim ;\
-               rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-* ;\
-               touch $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8 ;\
-               /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\
-               cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-               awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated  )
-    endif
-
-endif
-
-tmp:=$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ;\
-       if [ ! -s Makefile.am.sample ] ; then \
-           /bin/bash $(OPENAIR_TARGETS)/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash ;\
-       fi ;\
-       if [ ! -s Makefile.inc.generated ] ; then  \
-           awk '/converter-sample.c/ {exit} // {print}' Makefile.am.sample > Makefile.inc.generated ;\
-       fi )
-
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
-
-ASN_CONVERTER_SOURCES+=asn1_msg.c
- 
-#COMMON_CFLAGS += -DEMIT_ASN_DEBUG=1
-
-EXTRA_CFLAGS += -I. -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES 
-
-ASN1_MODULE_OBJS=${ASN_MODULE_SOURCES:.c=.o}
-ASN1_CONVERTER_OBJS=${ASN_CONVERTER_SOURCES:.c=.o} 
-ASN1_MSG_OBJS=$(ASN1_MODULE_OBJS) $(ASN1_CONVERTER_OBJS)
diff --git a/openair2/RRC/LTE/rrc_2_rrm_msg.c b/openair2/RRC/LTE/rrc_2_rrm_msg.c
deleted file mode 100644
index 87a0a3557b57a7ce4f636024e7d031f9352423f7..0000000000000000000000000000000000000000
--- a/openair2/RRC/LTE/rrc_2_rrm_msg.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*!
-*******************************************************************************
-
-\file       rrc_2_rrm_msg.c
-
-\brief     data formating for sending message over socket between RRC and RRM
-
-\author     BURLOT Pascal
-
-\date       16/07/08
-
-\par     Historique:
-        P.BURLOT 2009-01-20
-            bug fix (memeory leak)
-      Macro changed :
-      RRM_CALLOC() by RRM_CALLOC2() in msg_rrc_sensing_meas_ind()
-
-*******************************************************************************
-*/
-#ifdef RRC_EMUL
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include "L3_rrc_defs.h"
-#include "rrm_sock.h"
-#include "L3_rrc_interface.h"
-#include "rrc_rrm_msg.h"
-#include "rrm_util.h"
-
-#else
-
-#include "defs.h"
-
-#endif
-
-#ifdef TRACE
-//! Macro creant la chaine a partir du nom de la variable
-#define STRINGIZER(x) #x
-//! Tableau pour le mode trace faisant la translation entre le numero et le nom du message
-const char *Str_msg_rrc_rrm[NB_MSG_RRC_RRM] = {
-  STRINGIZER(RRM_RB_ESTABLISH_REQ     ),
-  STRINGIZER(RRC_RB_ESTABLISH_RESP    ),
-  STRINGIZER(RRC_RB_ESTABLISH_CFM     ),
-  STRINGIZER(RRM_RB_MODIFY_REQ        ),
-  STRINGIZER(RRC_RB_MODIFY_RESP       ),
-  STRINGIZER(RRC_RB_MODIFY_CFM        ),
-  STRINGIZER(RRM_RB_RELEASE_REQ       ),
-  STRINGIZER(RRC_RB_RELEASE_RESP      ),
-  STRINGIZER(RRC_MR_ATTACH_IND        ),
-  STRINGIZER(RRM_SENSING_MEAS_REQ     ),
-  STRINGIZER(RRC_SENSING_MEAS_RESP    ),
-  STRINGIZER(RRC_CX_ESTABLISH_IND     ),
-  STRINGIZER(RRC_PHY_SYNCH_TO_MR_IND  ),
-  STRINGIZER(RRC_PHY_SYNCH_TO_CH_IND  ),
-  STRINGIZER(RRCI_CX_ESTABLISH_RESP   ),
-  STRINGIZER(RRC_SENSING_MEAS_IND     ),
-  STRINGIZER(RRM_SENSING_MEAS_RESP    ),
-  STRINGIZER(RRC_RB_MEAS_IND          ),
-  STRINGIZER(RRM_RB_MEAS_RESP         ),
-  STRINGIZER(RRM_INIT_CH_REQ          ),
-  STRINGIZER(RRCI_INIT_MR_REQ         )
-} ;
-#endif
-
-/*!
-*******************************************************************************
-\brief  This function initialize the message header
-\return any return value
-*/
-static void init_rrc_msg_head(
-  msg_head_t    *msg_head , //!< message header to initialize
-  Instance_t     inst     , //!< Instance ID
-  MSG_RRC_RRM_T  msg_type , //!< type of message to initialize
-  unsigned int   size     , //!< size of message
-  Transaction_t  Trans_id   //!< transaction id associated to this message
-)
-{
-  if ( msg_head != NULL ) {
-    msg_head->start    = START_MSG ;
-    msg_head->msg_type = 0xFF & msg_type ;
-    msg_head->inst     = inst  ;
-    msg_head->Trans_id = Trans_id  ;
-    msg_head->size     = size;
-  }
-}
-
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message generique de reponse pour les
-          fonctions :
-            - rrc_rb_establish_resp(),rrc_rb_modify_resp(),rrc_rb_modify_resp(),
-            - rrc_rb_release_resp() et rrc_sensing_meas_resp() .
-\return message formate
-*/
-msg_t mesg;
-msg_t *msg_rrc_generic_resp(
-  Instance_t    inst     , //!< Instance ID
-  MSG_RRC_RRM_T msg_type , //!< type of message
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  init_rrc_msg_head(&(mesg.head),inst, msg_type, 0 , Trans_id);
-  mesg.data = NULL ;
-
-  return &mesg ;
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_rb_establish_resp().
-\return message formate
-*/
-msg_t *msg_rrc_rb_establish_resp(
-  Instance_t    inst     , //!< Instance ID
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  return msg_rrc_generic_resp( inst, RRC_RB_ESTABLISH_RESP, Trans_id) ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_rb_establish_cfm().
-\return message formate
-*/
-rrc_rb_establish_cfm_t P_rb_est_cfm ;//= RRM_CALLOC(rrc_rb_establish_cfm_t , 1 ) ;
-msg_t *msg_rrc_rb_establish_cfm(
-  Instance_t    inst     , //!< Instance ID
-  RB_ID         Rb_id    , //!< Radio Bearer ID used by RRC
-  RB_TYPE       RB_type  , //!< Radio Bearer Type
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  //  msg_t mesg;
-
-  init_rrc_msg_head(&(mesg.head),inst,RRC_RB_ESTABLISH_CFM, sizeof( rrc_rb_establish_cfm_t ) ,Trans_id);
-  P_rb_est_cfm.Rb_id        = Rb_id ;
-  P_rb_est_cfm.RB_type      = RB_type ;
-  mesg.data = (char *) &P_rb_est_cfm ;
-  return &mesg ;
-
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_rb_modify_resp().
-\return message formate
-*/
-msg_t *msg_rrc_rb_modify_resp(
-  Instance_t    inst     , //!< Instance ID
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  return msg_rrc_generic_resp( inst,RRC_RB_MODIFY_RESP, Trans_id) ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_rb_modify_cfm().
-\return message formate
-*/
-rrc_rb_modify_cfm_t P_rb_md_cfm;
-msg_t *msg_rrc_rb_modify_cfm(
-  Instance_t    inst     , //!< Instance ID
-  RB_ID         Rb_id    , //!< Radio Bearer ID used by RRC
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  // msg_t mesg;
-  init_rrc_msg_head(&(mesg.head),inst,RRC_RB_MODIFY_CFM, sizeof( rrc_rb_modify_cfm_t ) ,Trans_id);
-  P_rb_md_cfm.Rb_id        = Rb_id ;
-  mesg.data = (char *) &P_rb_md_cfm ;
-  return &mesg ;
-
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-          rrc_rb_release_resp().
-\return message formate
-*/
-msg_t *msg_rrc_rb_release_resp(
-  Instance_t    inst     , //!< Instance ID
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  return msg_rrc_generic_resp( inst,RRC_RB_RELEASE_RESP, Trans_id) ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_MR_attach_ind().
-\return message formate
-*/
-rrc_MR_attach_ind_t P_att_ind;
-msg_t * msg_rrc_MR_attach_ind(
-  Instance_t    inst     , //!< Instance ID
-  L2_ID         L2_id
-)
-{
-  // msg_t mesg;
-  init_rrc_msg_head(&(mesg.head),inst,RRC_MR_ATTACH_IND, sizeof( rrc_MR_attach_ind_t ) ,0);
-  memcpy( P_att_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) )  ;
-  mesg.data = (char *) &P_att_ind ;
-  return &mesg ;
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_sensing_meas_resp().
-\return message formate
-*/
-msg_t *msg_rrc_sensing_meas_resp(
-  Instance_t    inst     , //!< Instance ID
-  Transaction_t Trans_id   //!< Transaction ID
-)
-{
-  return msg_rrc_generic_resp( inst,RRC_SENSING_MEAS_RESP, Trans_id) ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_cx_establish_ind().
-\return message formate
-*/
-rrc_cx_establish_ind_t P_cx_est_ind;
-msg_t * msg_rrc_cx_establish_ind(
-  Instance_t     inst      , //!< Instance ID
-  L2_ID          L2_id     , //!< Layer 2 (MAC) ID
-  Transaction_t  Trans_id  , //!< Transaction ID
-  unsigned char *L3_info   , //!< Optional L3 Information
-  L3_INFO_T      L3_info_t , //!< Type of L3 Information
-  RB_ID          DTCH_B_id , //!< RBID of broadcast IP service (MR only)
-  RB_ID          DTCH_id     //!< RBID of default IP service (MR only)
-)
-{
-  //msg_t mesg;
-  init_rrc_msg_head(&(mesg.head),inst,RRC_CX_ESTABLISH_IND, sizeof( rrc_cx_establish_ind_t ) ,Trans_id);
-  memcpy( P_cx_est_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) )  ;
-  P_cx_est_ind.DTCH_B_id    = DTCH_B_id ;
-  P_cx_est_ind.DTCH_id      = DTCH_id   ;
-  P_cx_est_ind.L3_info_t    = L3_info_t ;
-
-  if ( L3_info_t == IPv4_ADDR ) {
-    memcpy( P_cx_est_ind.L3_info, L3_info, 4 );
-  } else if ( L3_info_t == IPv6_ADDR ) {
-    memcpy( P_cx_est_ind.L3_info, L3_info, 16 );
-  }
-
-  mesg.data = (char *) &P_cx_est_ind ;
-  return &mesg ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_phy_synch_to_MR_ind().
-\return message formate
-*/
-rrc_phy_synch_to_MR_ind_t P_snc_mr;
-msg_t * msg_rrc_phy_synch_to_MR_ind(
-  Instance_t     inst  , //!< Instance ID
-  L2_ID          L2_id
-)
-{
-  //msg_t smsg;
-  init_rrc_msg_head(&(mesg.head),inst,RRC_PHY_SYNCH_TO_MR_IND, sizeof( rrc_phy_synch_to_MR_ind_t ) ,0);
-  memcpy(&P_snc_mr.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID));
-  mesg.data = (char *)&P_snc_mr ;
-  msg("[msg_rrc_phy_synch_to_MR_ind] from Inst :%d\n",mesg.head.inst);
-  return &mesg ;
-}
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-          rrc_phy_synch_to_CH_ind().
-\return message formate
-*/
-rrc_phy_synch_to_CH_ind_t P_snc_ch;
-msg_t * msg_rrc_phy_synch_to_CH_ind(
-  Instance_t   inst      , //!< Instance ID
-  unsigned int Ch_index  , //!< Clusterhead index
-  L2_ID        L2_id
-)
-{
-  //  msg_t smsg;
-  init_rrc_msg_head(&(mesg.head),inst, RRC_PHY_SYNCH_TO_CH_IND, sizeof( rrc_phy_synch_to_CH_ind_t ) ,0);
-  P_snc_ch.Ch_index     = Ch_index  ;
-  memcpy(&P_snc_ch.L2_id,(L2_ID*)&L2_id,sizeof(L2_ID));
-  mesg.data = (char *) &P_snc_ch;
-  msg("[msg_rrc_phy_synch_to_CH_ind] from Inst :%d\n",mesg.head.inst);
-  return &mesg ;
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-          rrc_sensing_meas_ind().
-\return message formate
-*/
-rrc_sensing_meas_ind_t P_sens_ind;
-msg_t * msg_rrc_sensing_meas_ind(
-  Instance_t      inst         , //!< Instance ID
-  L2_ID           L2_id        , //!< Layer 2 ID (MAC) of sensing node
-  unsigned int    NB_meas      , //!< Layer 2 ID (MAC) of sensing node
-  SENSING_MEAS_T *Sensing_meas , //!< Sensing Information
-  Transaction_t   Trans_id       //!< Transaction ID
-)
-{
-
-  //  msg_t mesg;
-  unsigned int size = sizeof( rrc_sensing_meas_ind_t ) + (NB_meas-1) * sizeof(SENSING_MEAS_T) ;
-  // Note : (NB_meas-1) car la première est incorporé dans  rrc_sensing_meas_ind_t
-  init_rrc_msg_head(&(mesg.head),inst, RRC_SENSING_MEAS_IND, size ,Trans_id);
-  memcpy( P_sens_ind.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) )  ;
-
-  if ( NB_meas > 0 ) {
-    memcpy( P_sens_ind.Sensing_meas , Sensing_meas, NB_meas * sizeof(SENSING_MEAS_T) )  ;
-  }
-
-  P_sens_ind.NB_meas      = NB_meas   ;
-  mesg.data = (char *) &P_sens_ind ;
-  return &mesg ;
-}
-
-/*!
-*******************************************************************************
-\brief  La fonction formate en un message les parametres de la fonction
-        rrc_rb_meas_ind().
-\return message formate
-*/
-rrc_rb_meas_ind_t P_rb_meas;
-msg_t * msg_rrc_rb_meas_ind(
-  Instance_t      inst         , //!< Instance ID
-  RB_ID           Rb_id        , //!< Radio Bearer ID
-  L2_ID           L2_id        , //!< Layer 2 (MAC) IDs for link
-  MEAS_MODE       Meas_mode    , //!< Measurement mode (periodic or event-driven)
-  MAC_RLC_MEAS_T *Mac_rlc_meas , //!< MAC/RLC measurements
-  Transaction_t   Trans_id       //!< Transaction ID
-)
-{
-  //msg_t mesg;
-  init_rrc_msg_head(&(mesg.head),inst, RRC_RB_MEAS_IND, sizeof( rrc_rb_meas_ind_t ) ,Trans_id);
-  memcpy( P_rb_meas.L2_id.L2_id, L2_id.L2_id, sizeof(L2_ID) )  ;
-  memcpy( &(P_rb_meas.Mac_rlc_meas), Mac_rlc_meas, sizeof(L2_ID) )  ;
-  P_rb_meas.Rb_id        = Rb_id     ;
-  P_rb_meas.Meas_mode    = Meas_mode ;
-  mesg.data = (char *) &P_rb_meas;
-  return &mesg ;
-
-}
-
-
-
-/*****************************************************************************/
-rrc_init_scan_req_t P_init_scan;
-msg_t * msg_rrc_init_scan_req(
-  Instance_t      inst         , //!< Instance ID
-  L2_ID           L2_id        , //!< Layer 2 (MAC) IDs for link
-  unsigned int Interv
-)
-{
-  //msg_t mesg;
-  msg("RRCI: inst %d sendind rrc_init_scan_req from FC %d %d\n",inst,L2_id.L2_id[0],L2_id.L2_id[7]);
-  init_rrc_msg_head(&(mesg.head),inst, RRC_INIT_SCAN_REQ, sizeof( rrc_init_scan_req_t ) ,0);
-  memcpy( &P_init_scan.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) )  ;
-  P_init_scan.interv=Interv;
-
-  return &mesg ;
-
-}
-
-
-
-/*****************************************************************************/
-
-rrc_update_sens_t P_update_sens;
-msg_t * msg_rrc_update_sens(
-  Instance_t      inst         , //!< Instance ID
-  Sens_ch_t *Sens,
-  L2_ID L2_id,
-  unsigned char NB_info
-)
-{
-  //msg_t mesg;
-  init_rrc_msg_head(&(mesg.head),inst, RRC_UPDATE_SENS, sizeof( rrc_update_sens_t ) ,0);
-  memcpy( &P_update_sens.L2_id.L2_id[0], &L2_id.L2_id[0], sizeof(L2_ID) )  ;
-  memcpy( &P_update_sens.Sens_meas[0], (rrc_update_sens_t *)Sens, NB_info*sizeof(Sens_ch_t) )  ;
-  P_update_sens.NB_info=NB_info;
-  return &mesg ;
-
-}
-
-
-
-/*****************************************************************************/
-
-rrc_end_scan_req_t P_end_scan;
-msg_t * msg_rrc_end_scan_req(
-  Instance_t      inst         , //!< Instance ID
-  unsigned char CH_index
-)
-{
-
-  //msg_t mesg;
-  msg("RRC: send END_SCAN_REQ, INST %d\n",inst);
-  init_rrc_msg_head(&(mesg.head),inst, RRC_END_SCAN_REQ, sizeof( rrc_end_scan_req_t ) ,0);
-  P_update_sens.L2_id.L2_id[0]=CH_index;
-  return &mesg ;
-
-}
-
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 5a35f7aafe3e0b338a31d05b3a462e608670c064..65150d32ab61b37dff69748a9db98079829e0aef 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -3301,6 +3301,7 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
       msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ);
 
       itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p);
+      LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n"); 
     }
   }
 #endif
@@ -4718,7 +4719,6 @@ void *rrc_ue_task( void *args_p )
       break;
 
     case MESSAGE_TEST:
-      LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
       break;
 
       /* MAC messages */
@@ -5113,6 +5113,7 @@ void *rrc_ue_task( void *args_p )
       break; // PHY_FIND_CELL_IND
 
     case PHY_MEAS_REPORT_IND: {
+      LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
       MessageDef *message_p;
       message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND);
 
@@ -5130,6 +5131,7 @@ void *rrc_ue_task( void *args_p )
     }
 
     case RRC_RAL_CONFIGURE_THRESHOLD_REQ:
+      LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
       rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p);
       break;
 
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index f9e51e2f08e585a14c61cc91af460a27b6bd17ec..cbce50734172c2ca49d771d3f07c568eb3f85d3a 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -115,9 +115,6 @@ extern RAN_CONTEXT_t RC;
 #endif
 extern eNB_MAC_INST                *eNB_mac_inst;
 extern UE_MAC_INST                 *UE_mac_inst;
-#ifdef BIGPHYSAREA
-  extern void                        *bigphys_malloc(int);
-#endif
 
 extern uint16_t                     two_tier_hexagonal_cellIds[7];
 
diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h
index 90017dc80c6485045be2ef82c695301eea293057..e3b9ecb00be2dd745c31ad0d1beb468c99c55fad 100644
--- a/openair2/RRC/LTE/rrc_extern.h
+++ b/openair2/RRC/LTE/rrc_extern.h
@@ -51,9 +51,8 @@ extern LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
 extern unsigned char NB_INST;
 #endif
 extern unsigned char NB_eNB_INST;
-extern unsigned char NB_UE_INST;
+extern uint16_t NB_UE_INST;
 extern unsigned short NODE_ID[1];
-extern void* bigphys_malloc(int);
 #endif
 
 
diff --git a/openair2/RRC/LTE/rrc_vars.h b/openair2/RRC/LTE/rrc_vars.h
index e328ce13599597bbfdd2774822c9078d0a47f205..512d421168d80c2808726eff0c8129c88fbfaaae 100644
--- a/openair2/RRC/LTE/rrc_vars.h
+++ b/openair2/RRC/LTE/rrc_vars.h
@@ -38,7 +38,7 @@
 
 UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
 pthread_mutex_t ue_pf_po_mutex;
-UE_RRC_INST *UE_rrc_inst;
+UE_RRC_INST *UE_rrc_inst = NULL;
 #include "LAYER2/MAC/mac_extern.h"
 #define MAX_U32 0xFFFFFFFF
 
diff --git a/openair2/RRC/NAS/Makefile.inc b/openair2/RRC/NAS/Makefile.inc
deleted file mode 100644
index ea1a8a7a813ede23899803438439d620c13c8505..0000000000000000000000000000000000000000
--- a/openair2/RRC/NAS/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifeq ($(NAS_FLAG),1) 
-NAS_OBJS  = $(OPENAIR2_TOP)/RRC/NAS/nas_config.o
-NAS_OBJS += $(OPENAIR2_TOP)/RRC/NAS/rb_config.o
-#endif
diff --git a/openair2/UTIL/BIGPHYS/bigphys.c b/openair2/UTIL/BIGPHYS/bigphys.c
deleted file mode 100644
index 219a0c8d1b42eb99fb54abcefbc1bd65d73e45fb..0000000000000000000000000000000000000000
--- a/openair2/UTIL/BIGPHYS/bigphys.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#include "defs.h"
-#include "linux/module.h"
-
-#ifdef BIGPHYSAREA
-#ifdef ARCH_64
-char *bigphys_ptr,*bigphys_current;
-#else //ARCH_64
-unsigned int bigphys_ptr,bigphys_current;
-#endif //ARCH_64
-
-// return pointer to memory in big physical area aligned to 16 bytes
-
-void* bigphys_malloc(int n)
-{
-
-
-
-  int n2 = n + ((16-(n%16))%16);
-#ifdef ARCH_64
-  char *bigphys_old;
-#else
-  unsigned int bigphys_old;
-#endif
-
-  printk("[BIGPHYSAREA] Calling bigphys_malloc for %d (%d) bytes\n",n,n2);
-
-#ifdef ARCH_64
-  printk("[BIGPHYSAREA] Allocated Memory @ %p\n",bigphys_current);
-#endif
-  bigphys_old = bigphys_current;
-  bigphys_current += n2;
-
-#ifdef ARCH_64
-  printk("[BIGPHYSAREA] Allocated Memory top now @ %p\n",bigphys_current);
-  return ((void *)(bigphys_old));
-#else //ARCH_64
-  //printk("[BIGPHYSAREA] Allocated Memory %d\n",bigphys_current-bigphys_ptr);
-  return ((void *)(bigphys_old));
-#endif //ARCH_64
-}
-
-EXPORT_SYMBOL(bigphys_malloc);
-#endif
-
-
-
diff --git a/openair2/UTIL/BIGPHYS/defs.h b/openair2/UTIL/BIGPHYS/defs.h
deleted file mode 100644
index 69368a6d727f94fb9dfe16a90e6433bf6cd79382..0000000000000000000000000000000000000000
--- a/openair2/UTIL/BIGPHYS/defs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.1  (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
- */
-
-void* bigphys_malloc(int);
diff --git a/openair2/UTIL/Makefile.inc b/openair2/UTIL/Makefile.inc
deleted file mode 100644
index fac8d7e9a17885e0f03f321217b69fa547f4ab78..0000000000000000000000000000000000000000
--- a/openair2/UTIL/Makefile.inc
+++ /dev/null
@@ -1,108 +0,0 @@
-MEM_DIR = $(OPENAIR2_TOP)/UTIL/MEM
-LIST_DIR = $(OPENAIR2_TOP)/UTIL/LISTS
-FIFO_DIR = $(OPENAIR2_TOP)/UTIL/FIFO
-MATH_DIR = $(OPENAIR2_TOP)/UTIL/MATH
-TIMER_DIR = $(OPENAIR2_TOP)/UTIL/TIMER
-LOG_DIR=$(OPENAIR2_TOP)/UTIL/LOG
-OCG_DIR=$(OPENAIR2_TOP)/UTIL/OCG
-OPT_DIR=$(OPENAIR2_TOP)/UTIL/OPT
-OMG_DIR=$(OPENAIR2_TOP)/UTIL/OMG
-OTG_DIR=$(OPENAIR2_TOP)/UTIL/OTG
-CLI_DIR=$(OPENAIR2_TOP)/UTIL/CLI
-OMV_DIR=$(OPENAIR2_TOP)/UTIL/OMV
-LFDS_DIR=$(OPENAIR2_TOP)/UTIL/LFDS/liblfds6.1.1/liblfds611
-OSA_DIR=$(OPENAIR2_TOP)/UTIL/OSA
-
-LIST_OBJ =  $(LIST_DIR)/list.o
-
-FIFO_OBJ =  $(FIFO_DIR)/pad_list.o
-
-LIST_OBJ +=  $(LIST_DIR)/list2.o
-
-TIMER_OBJ +=  $(TIMER_DIR)/umts_timer.o
-
-MEM_OBJ +=  $(MEM_DIR)/mem_block.o
-
-LOG_OBJS =  $(LOG_DIR)/log.o
-LOG_OBJS +=  $(LOG_DIR)/vcd_signal_dumper.o
-
-OCG_OBJS  =  $(OCG_DIR)/OCG.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_create_dir.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_detect_file.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_generate_report.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_parse_filename.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_parse_XML.o
-OCG_OBJS +=  $(OCG_DIR)/OCG_save_XML.o
-
-ifdef SECU
-OSA_OBJS  = $(OSA_DIR)/osa_key_deriver.o
-OSA_OBJS += $(OSA_DIR)/osa_stream_eia.o
-OSA_OBJS += $(OSA_DIR)/osa_stream_eea.o
-OSA_OBJS += $(OSA_DIR)/osa_snow3g.o
-OSA_OBJS += $(OSA_DIR)/osa_rijndael.o
-endif
-
-OPT_OBJS =  $(OPT_DIR)/probe.o
-
-OMG_OBJS =  $(OMG_DIR)/omg.o
-OMG_OBJS +=  $(OMG_DIR)/common.o
-OMG_OBJS +=  $(OMG_DIR)/job.o
-OMG_OBJS +=  $(OMG_DIR)/static.o
-OMG_OBJS +=  $(OMG_DIR)/rwp.o
-OMG_OBJS +=  $(OMG_DIR)/rwalk.o
-#OMG_OBJS +=  $(OMG_DIR)/omg_hashtable.o
-OMG_OBJS +=  $(OMG_DIR)/mobility_parser.o
-OMG_OBJS +=  $(OMG_DIR)/trace.o
-OMG_OBJS +=  $(OMG_DIR)/sumo.o
-OMG_OBJS +=  $(OMG_DIR)/id_manager.o
-OMG_OBJS +=  $(OMG_DIR)/client_traci_OMG.o
-OMG_OBJS +=  $(OMG_DIR)/storage_traci_OMG.o
-OMG_OBJS +=  $(OMG_DIR)/socket_traci_OMG.o
-OMG_OBJS +=  $(OMG_DIR)/steadystaterwp.o
-OMG_OBJS +=  $(OMG_DIR)/grid.o
-OMG_OBJS +=  $(OMG_DIR)/trace_hashtable.o
-
-
-OTG_OBJS =  $(OTG_DIR)/otg_tx.o
-OTG_OBJS +=  $(OTG_DIR)/otg.o
-OTG_OBJS +=  $(OTG_DIR)/otg_rx.o
-OTG_OBJS +=  $(OTG_DIR)/otg_kpi.o
-OTG_OBJS +=  $(OTG_DIR)/otg_form.o
-OTG_OBJS +=  $(OTG_DIR)/otg_models.o
-
-MATH_OBJS  =  $(MATH_DIR)/oml.o
-
-CLI_OBJ  =  $(CLI_DIR)/cli_server.o
-CLI_OBJ  +=  $(CLI_DIR)/cli.o
-CLI_OBJ  +=  $(CLI_DIR)/cli_cmd.o
-
-UTIL_OBJ =              \
-    $(OSA_OBJS)         \
-    $(FIFO_OBJ)         \
-    $(LIST_OBJ)         \
-    $(TIMER_OBJ)        \
-    $(MEM_OBJ)          \
-    $(LOG_OBJS)         \
-    $(OCG_OBJS)         \
-    $(MATH_OBJS)        \
-    $(OTG_OBJS)         \
-    $(CLI_OBJ)          \
-    $(OMG_OBJS)         \
-    $(OPT_OBJS)
-
-UTIL_incl = \
-    -I$(OPENAIR2_TOP)/UTIL      \
-    -I$(OSA_DIR)                \
-    -I$(LFDS_DIR)/inc           \
-    -I$(MEM_DIR)                \
-    -I$(LIST_DIR)               \
-    -I$(FIFO_DIR)               \
-    -I$(OCG_DIR)                \
-    -I$(LOG_DIR)                \
-    -I$(MATH_DIR)               \
-    -I$(TIMER_DIR)              \
-    -I$(OMG_DIR)                \
-    -I$(OTG_DIR)                \
-    -I$(CLI_DIR)                \
-    -I$(OPT_DIR)                \
-    -I$(OMV_DIR)
diff --git a/openair2/UTIL/TIMER/umts_timer.c b/openair2/UTIL/TIMER/umts_timer.c
deleted file mode 100644
index 1691fac363865c4b77ccfc9a9a22e9ef6bee2008..0000000000000000000000000000000000000000
--- a/openair2/UTIL/TIMER/umts_timer.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/***************************************************************************
-                          umts_timer.c  -  description
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
-
-
- ***************************************************************************/
-//#include "rtos_header.h"
-#include "platform_types.h"
-
-#include "list.h"
-#include "umts_timer_struct.h"
-#include "mem_block.h"
-#include "openair_defs.h"
-//-----------------------------------------------------------------------------
-void
-umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP)
-{
-  //-----------------------------------------------------------------------------
-  struct timer_unit *timer;
-  mem_block_t      *mem_unit;
-  uint8_t              time_out = 255;
-  mem_unit = atimer_listP->head;
-
-  // do it simple now.
-  while ((mem_unit) && (time_out)) {
-    timer = (struct timer_unit *) (mem_unit->data);
-
-    if ((current_frame_tick_millisecondsP - timer->frame_tick_start) >= timer->frame_time_out) {
-
-      mem_unit = list2_remove_head (atimer_listP);
-      (*(timer->proc)) (timer->protocol, timer->timer_id);
-      free_mem_block (mem_unit, __func__);
-
-      mem_unit = atimer_listP->head;
-    } else {
-      time_out = 0;
-    }
-  }
-}
-
-//-----------------------------------------------------------------------------
-void
-umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP)
-{
-  //-----------------------------------------------------------------------------
-  mem_block_t      *mem_unit;
-  mem_unit = atimer_listP->head;
-
-  while ((mem_unit)) {
-    if (((struct timer_unit *) (mem_unit->data))->timer_id == timer_idP) {
-      list2_remove_element (mem_unit, atimer_listP);
-      free_mem_block (mem_unit, __func__);
-      return;
-    }
-
-    mem_unit = mem_unit->next;
-  }
-}
-
-//-----------------------------------------------------------------------------
-mem_block_t      *
-umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP, uint32_t current_frame_tick_millisecondsP)
-{
-  //-----------------------------------------------------------------------------
-  struct mem_block_t *mb;
-  struct timer_unit *timer;
-  mem_block_t      *mem_unit;
-  int32_t             remaining_time;
-  uint8_t              inserted = 0;
-
-  mb = get_free_mem_block (sizeof (struct timer_unit), __func__);
-  if(mb==NULL) return NULL;
-  ((struct timer_unit *) (mb->data))->proc = procP;
-  ((struct timer_unit *) (mb->data))->protocol = protocolP;
-  ((struct timer_unit *) (mb->data))->timer_id = timer_idP;
-  ((struct timer_unit *) (mb->data))->frame_time_out = frame_time_outP;
-  ((struct timer_unit *) (mb->data))->frame_tick_start = current_frame_tick_millisecondsP;
-
-  // insert the timer in list in ascending order
-  mem_unit = atimer_listP->head;
-
-  while ((mem_unit) && (!inserted)) {
-    timer = (struct timer_unit *) (mem_unit->data);
-
-    remaining_time = timer->frame_time_out - current_frame_tick_millisecondsP + timer->frame_tick_start;
-
-    // not timed out
-    if ((remaining_time > 0) && (frame_time_outP < remaining_time)) {
-      inserted = 255;
-
-      if (mem_unit == atimer_listP->head) {
-#ifdef DEBUG_TIMER
-        msg ("[TIMER][CREATION] added timer_id %p at head time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP);
-#endif
-        list2_add_head (mb, atimer_listP);
-      } else {
-#ifdef DEBUG_TIMER
-        msg ("[TIMER][CREATION] inserted timer_id %p  time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP);
-#endif
-        mb->previous = mem_unit->previous;
-        mb->next = mem_unit;
-        mem_unit->previous->next = mb;
-        mem_unit->previous = mb;
-      }
-    } else {
-      mem_unit = mem_unit->next;
-    }
-  }
-
-  if (!inserted) {
-#ifdef DEBUG_TIMER
-    msg ("[TIMER][CREATION] added timer_id %p at tail time out %d current time %d proc %p \n", timer_idP, frame_time_outP, current_frame_tick_millisecondsP, *procP);
-#endif
-    list2_add_tail (mb, atimer_listP);
-  }
-
-  return mb;
-}
-
-//-----------------------------------------------------------------------------
-void
-umts_stop_all_timers (list2_t * atimer_listP)
-{
-  //-----------------------------------------------------------------------------
-  list2_free (atimer_listP);
-}
-
-//-----------------------------------------------------------------------------
-void
-umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void *))
-{
-  //-----------------------------------------------------------------------------
-  struct timer_unit *timer;
-  mem_block_t      *mem_unit;
-  mem_block_t      *mem_unit_to_delete;
-  mem_unit = atimer_listP->head;
-
-  while ((mem_unit)) {
-    timer = (struct timer_unit *) (mem_unit->data);
-
-    if (timer->proc != procP) {
-      mem_unit_to_delete = mem_unit;
-      mem_unit = mem_unit->next;
-      list2_remove_element (mem_unit_to_delete, atimer_listP);
-      free_mem_block (mem_unit_to_delete, __func__);
-    } else {
-      mem_unit = mem_unit->next;
-    }
-  }
-}
diff --git a/openair2/UTIL/TIMER/umts_timer.h b/openair2/UTIL/TIMER/umts_timer.h
deleted file mode 100644
index 077b55cf0c6bf3b5b249e861a7bfaa5046352993..0000000000000000000000000000000000000000
--- a/openair2/UTIL/TIMER/umts_timer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/***************************************************************************
-                          umts_timer.h  -  description
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
-
- ***************************************************************************/
-#ifndef __UMTS_TIMER_H__
-#    define __UMTS_TIMER_H__
-
-
-#    include "platform_types.h"
-#    include "lists_proto_extern.h"
-#    include "mem_mngt_proto_extern.h"
-
-#    define UMTS_TIMER_NOT_STARTED  0x00
-#    define UMTS_TIMER_STARTED      0x01
-#    define UMTS_TIMER_TIMED_OUT    0x02
-
-
-void            umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP);
-mem_block      *umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP, uint32_t current_frame_tick_millisecondsP);
-
-struct timer_unit {
-
-  void            (*proc) (void *, void *);     // proc executed when time_out
-  void           *protocol;     // arg should be a pointer on a allocated protocol entity private struct including its variables
-  void           *timer_id;     // arg should be a value or a pointer identifying the timer
-  // Example: rlc_am_sdu_discard_time_out(rlc_am, sdu)
-  uint32_t             frame_time_out;
-  uint32_t             frame_tick_start;
-};
-#endif
diff --git a/openair2/UTIL/TIMER/umts_timer_proto_extern.h b/openair2/UTIL/TIMER/umts_timer_proto_extern.h
deleted file mode 100644
index b43b347e465360e1ded7332c41d1e9372e6e2533..0000000000000000000000000000000000000000
--- a/openair2/UTIL/TIMER/umts_timer_proto_extern.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/***************************************************************************
-                          umts_timer_proto_extern.h  -  description
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
-
- ***************************************************************************/
-#ifndef __UMTS_TIMER_PROTO_EXTERN_H__
-#    define __UMTS_TIMER_PROTO_EXTERN_H__
-
-#    include "platform_types.h"
-#    include "list.h"
-#    include "mem_block.h"
-
-extern void     umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_millisecondsP);
-extern void     umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP);
-extern mem_block_t *umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), void *protocolP, void *timer_idP, uint32_t frame_time_outP,
-    uint32_t current_frame_tick_millisecondsP);
-extern void     umts_stop_all_timers (list2_t * atimer_listP);
-extern void     umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void *));
-#endif
diff --git a/openair2/UTIL/TIMER/umts_timer_struct.h b/openair2/UTIL/TIMER/umts_timer_struct.h
deleted file mode 100644
index c4886c7f80241eac6e83cad74db6b98939f8f52f..0000000000000000000000000000000000000000
--- a/openair2/UTIL/TIMER/umts_timer_struct.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/***************************************************************************
-                          umts_timer_struct.h  -  description
-                             -------------------
-  AUTHOR  : Lionel GAUTHIER
-  COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
-
-
-
- ***************************************************************************/
-#ifndef __UMTS_TIMER_STRUCT_H__
-#    define __UMTS_TIMER_STRUCT_H__
-
-#    include "platform_types.h"
-
-struct timer_unit {
-
-  void            (*proc) (void *, void *);     // proc executed when time_out
-  void           *protocol;     // arg should be a pointer on a allocated protocol entity private struct including its variables
-  void           *timer_id;     // arg should be a value or a pointer identifying the timer
-  // Example: rlc_am_sdu_discard_time_out(rlc_am, sdu)
-  uint32_t             frame_time_out;
-  uint32_t             frame_tick_start;
-};
-#endif
diff --git a/openair2/X2AP/Makefile.inc b/openair2/X2AP/Makefile.inc
deleted file mode 100755
index a301a9934e924736868412284605a76a4946b668..0000000000000000000000000000000000000000
--- a/openair2/X2AP/Makefile.inc
+++ /dev/null
@@ -1,107 +0,0 @@
-
-ASN1MESSAGESDIR=$(X2AP_DIR)/MESSAGES
-ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
-
-#//ifeq ($(USE_MME), R10)
-#//	ASN1RELDIR=R10.7
-#//else
-#//ASN1RELDIR=R11.2
-#//endif
-
-# TEMP
-ASN1RELDIR=R11.2
-
-
-include $(ASN1DIR)/$(ASN1RELDIR)/Makefile.inc
-
-libx2ap_OBJECTS = \
-	x2ap.o        \
-	x2ap_common.o \
-	$(addprefix MESSAGES/ASN1/$(ASN1RELDIR)/, $(X2AP_ASN_MODULE_SOURCES))
-
-
-
-# pull in dependency info for *existing* .o files
--include $(OUTDIR)/*.d
-
-CFLAGS =            \
-	-Wall           \
-	-DENB_MODE      \
-	-DENABLE_USE_MME    \
-	-I.        \
-	-I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \
-	-I$(ASN1MESSAGESDIR) \
-	-I$(OUTDIR)     \
-	-I../UTILS      \
-	$(ADD_CFLAGS)       \
-	$(X2AP_CFLAGS)      \
-	-Wuninitialized     \
-	-Werror=implicit-function-declaration
-
-X2AP_GENERATED =    \
-	$(OUTDIR)/x2ap_encoder.o    \
-	$(OUTDIR)/x2ap_decoder.o    \
-	$(OUTDIR)/x2ap_xer_print.o
-
-$(OUTDIR)/%.o : %.c
-	@echo "Compiling $<"
-	@echo "Compiling $<  with CFLAGS= $(CFLAGS)"
-	@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
-	@$(CC) -c $(CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $< > $(basename $@).d
-	@mv -f $(basename $@).d $(basename $@).d.tmp
-	@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
-	@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
-	@rm -f $(basename $@).d.tmp
-
-$(X2AP_GENERATED): %.o : %.c
-	@echo "Compiling $<"
-	@echo "Compiling $<  with CFLAGS= $(CFLAGS)"
-	@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
-	@$(CC) -c $(CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $< > $(basename $@).d
-	@mv -f $(basename $@).d $(basename $@).d.tmp
-	@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
-	@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
-	@rm -f $(basename $@).d.tmp
-
-
-$(OUTDIR)/x2ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
-	@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
-	@python $(ASN1DIR)/asn1tostruct.py -f$< -o$(OUTDIR) 
-	@echo Timestamp > $@
-
-#ProtocolExtensionContainer
-#$(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn 
-
-$(OUTDIR)/x2ap_asn1regen.stamp:  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-CommonDataTypes.asn  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-IEs.asn  $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn   
-	@echo "Timestamp DIR " $(ASN1DIR) " DIRREL " $(ASN1RELDIR)
-#	(cd $(ASN1DIR)/$(ASN1RELDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^)
-	(cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names -fskeletons-copy $^)
-	@echo "Timestamp X2AP_CFLAGS: " $(X2AP_CFLAGS)
-	@echo Timestamp > $@	
-
-$(OUTDIR)/libx2ap.a: $(OUTDIR)/x2ap_ieregen.stamp $(OUTDIR)/x2ap_asn1regen.stamp $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS))
-	@echo Creating X2AP archive
-	@echo libx2ap_OBJECTS $(libx2ap_OBJECTS)
-	@$(AR) rcs $@ $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS))
-
-clean:
-	@$(RM_F_V) $(OUTDIR)/*.o
-	@$(RM_F_V) $(OUTDIR)/*.d
-	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES))
-	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.d))
-	@$(RM_F_V) $(OUTDIR)/libx2ap.a
-	@$(RM_F_V) $(OUTDIR)/x2ap_asn1regen.stamp
-	@$(RM_F_V) $(OUTDIR)/x2ap_ieregen.stamp
-	@$(RM_F_V) $(OUTDIR)/x2ap_decoder.c $(OUTDIR)/x2ap_encoder.c
-	@$(RM_F_V) $(OUTDIR)/x2ap_xer_print.c $(OUTDIR)/x2ap_ies_defs.h
-
-cleanall: clean
-	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.c))
-	@$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.h))
-
-showcflags:
-	@echo x2ap cflags: $(CFLAGS)
diff --git a/openair3/COMMON/as_message.h b/openair3/COMMON/as_message.h
deleted file mode 100644
index 30810a325eace63c944b947bfb8c0a6487094e80..0000000000000000000000000000000000000000
--- a/openair3/COMMON/as_message.h
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * Copyright (c) 2015, EURECOM (www.eurecom.fr)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- *    list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of the FreeBSD Project.
- */
-
-
-/*****************************************************************************
-
-Source      as_message.h
-
-Version     0.1
-
-Date        2012/10/18
-
-Product     NAS stack
-
-Subsystem   Application Programming Interface
-
-Author      Frederic Maurel
-
-Description Defines the messages supported by the Access Stratum sublayer
-        protocol (usually RRC and S1AP for E-UTRAN) and functions used
-        to encode and decode
-
-*****************************************************************************/
-#ifndef __AS_MESSAGE_H__
-#define __AS_MESSAGE_H__
-
-#include "commonDef.h"
-#include "networkDef.h"
-
-/****************************************************************************/
-/*********************  G L O B A L    C O N S T A N T S  *******************/
-/****************************************************************************/
-
-/*
- * --------------------------------------------------------------------------
- *              Access Stratum message types
- * --------------------------------------------------------------------------
- */
-#define AS_REQUEST  0x0100
-#define AS_RESPONSE 0x0200
-#define AS_INDICATION   0x0400
-#define AS_CONFIRM  0x0800
-
-/*
- * --------------------------------------------------------------------------
- *          Access Stratum message identifiers
- * --------------------------------------------------------------------------
- */
-
-/* Broadcast information */
-#define AS_BROADCAST_INFO       0x01
-#define AS_BROADCAST_INFO_IND       (AS_BROADCAST_INFO | AS_INDICATION)
-
-/* Cell information relevant for cell selection processing */
-#define AS_CELL_INFO            0x02
-#define AS_CELL_INFO_REQ        (AS_CELL_INFO | AS_REQUEST)
-#define AS_CELL_INFO_CNF        (AS_CELL_INFO | AS_CONFIRM)
-#define AS_CELL_INFO_IND        (AS_CELL_INFO | AS_INDICATION)
-
-/* Paging information */
-#define AS_PAGING           0x03
-#define AS_PAGING_REQ           (AS_PAGING | AS_REQUEST)
-#define AS_PAGING_IND           (AS_PAGING | AS_INDICATION)
-
-/* NAS signalling connection establishment */
-#define AS_NAS_ESTABLISH        0x04
-#define AS_NAS_ESTABLISH_REQ        (AS_NAS_ESTABLISH | AS_REQUEST)
-#define AS_NAS_ESTABLISH_IND        (AS_NAS_ESTABLISH | AS_INDICATION)
-#define AS_NAS_ESTABLISH_RSP        (AS_NAS_ESTABLISH | AS_RESPONSE)
-#define AS_NAS_ESTABLISH_CNF        (AS_NAS_ESTABLISH | AS_CONFIRM)
-
-/* NAS signalling connection release */
-#define AS_NAS_RELEASE          0x05
-#define AS_NAS_RELEASE_REQ      (AS_NAS_RELEASE | AS_REQUEST)
-#define AS_NAS_RELEASE_IND      (AS_NAS_RELEASE | AS_INDICATION)
-
-/* Uplink information transfer */
-#define AS_UL_INFO_TRANSFER     0x06
-#define AS_UL_INFO_TRANSFER_REQ     (AS_UL_INFO_TRANSFER | AS_REQUEST)
-#define AS_UL_INFO_TRANSFER_CNF     (AS_UL_INFO_TRANSFER | AS_CONFIRM)
-#define AS_UL_INFO_TRANSFER_IND     (AS_UL_INFO_TRANSFER | AS_INDICATION)
-
-/* Downlink information transfer */
-#define AS_DL_INFO_TRANSFER     0x07
-#define AS_DL_INFO_TRANSFER_REQ     (AS_DL_INFO_TRANSFER | AS_REQUEST)
-#define AS_DL_INFO_TRANSFER_CNF     (AS_DL_INFO_TRANSFER | AS_CONFIRM)
-#define AS_DL_INFO_TRANSFER_IND     (AS_DL_INFO_TRANSFER | AS_INDICATION)
-
-/* Radio Access Bearer establishment */
-#define AS_RAB_ESTABLISH        0x08
-#define AS_RAB_ESTABLISH_REQ        (AS_RAB_ESTABLISH | AS_REQUEST)
-#define AS_RAB_ESTABLISH_IND        (AS_RAB_ESTABLISH | AS_INDICATION)
-#define AS_RAB_ESTABLISH_RSP        (AS_RAB_ESTABLISH | AS_RESPONSE)
-#define AS_RAB_ESTABLISH_CNF        (AS_RAB_ESTABLISH | AS_CONFIRM)
-
-/* Radio Access Bearer release */
-#define AS_RAB_RELEASE          0x09
-#define AS_RAB_RELEASE_REQ      (AS_RAB_RELEASE | AS_REQUEST)
-#define AS_RAB_RELEASE_IND      (AS_RAB_RELEASE | AS_INDICATION)
-
-/* NAS Cause */
-#define EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED (8)
-#define EPS_SERVICES_NOT_ALLOWED                      (7)
-#define PLMN_NOT_ALLOWED                              (11)
-#define TRACKING_AREA_NOT_ALLOWED                     (12)
-#define ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA     (13)
-#define EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN         (14)
-#define NO_SUITABLE_CELLS_IN_TRACKING_AREA            (15)
-#define NETWORK_FAILURE                               (17)
-#define ESM_FAILURE                                   (19)
-
-typedef enum nas_cause_s {
-  NAS_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED,
-  NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED                  = EPS_SERVICES_NOT_ALLOWED,
-  NAS_CAUSE_PLMN_NOT_ALLOWED                          = PLMN_NOT_ALLOWED,
-  NAS_CAUSE_TRACKING_AREA_NOT_ALLOWED                 = TRACKING_AREA_NOT_ALLOWED,
-  NAS_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA = ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA,
-  NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN     = EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
-  NAS_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA        = NO_SUITABLE_CELLS_IN_TRACKING_AREA,
-  NAS_CAUSE_NETWORK_FAILURE                           = NETWORK_FAILURE,
-  NAS_CAUSE_ESM_FAILURE                               = ESM_FAILURE
-} nas_cause_t;
-
-/*
- * --------------------------------------------------------------------------
- *          Access Stratum message global parameters
- * --------------------------------------------------------------------------
- */
-
-/* Error code */
-typedef enum nas_error_code_s {
-  AS_SUCCESS = 1, /* Success code, transaction is going on    */
-  AS_TERMINATED_NAS,  /* Transaction terminated by NAS        */
-  AS_TERMINATED_AS,   /* Transaction terminated by AS         */
-  AS_FAILURE      /* Failure code                 */
-} nas_error_code_t;
-
-/* Core network domain */
-typedef enum core_network_s {
-  AS_PS = 1,      /* Packet-Switched  */
-  AS_CS       /* Circuit-Switched */
-} core_network_t;
-
-/* SAE Temporary Mobile Subscriber Identity */
-typedef struct as_stmsi_s {
-  uint8_t MMEcode;    /* MME code that allocated the GUTI     */
-  uint32_t m_tmsi;    /* M-Temporary Mobile Subscriber Identity   */
-} as_stmsi_t;
-
-/* Dedicated NAS information */
-typedef struct as_nas_info_s {
-  uint32_t length;    /* Length of the NAS information data       */
-  Byte_t* data;   /* Dedicated NAS information data container */
-} as_nas_info_t;
-
-/* Radio Access Bearer identity */
-typedef uint8_t as_rab_id_t;
-
-/****************************************************************************/
-/************************  G L O B A L    T Y P E S  ************************/
-/****************************************************************************/
-
-/*
- * --------------------------------------------------------------------------
- *              Broadcast information
- * --------------------------------------------------------------------------
- */
-
-/*
- * AS->NAS - Broadcast information indication
- * AS may asynchronously report to NAS available PLMNs within specific
- * location area
- */
-typedef struct broadcast_info_ind_s {
-#define PLMN_LIST_MAX_SIZE  6
-  PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */
-  ci_t cellID;    /* Identity of the cell serving the listed PLMNs */
-  tac_t tac;      /* Code of the tracking area the cell belongs to */
-} broadcast_info_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *     Cell information relevant for cell selection processing
- * --------------------------------------------------------------------------
- */
-
-/* Radio access technologies supported by the network */
-#define AS_GSM              (1 << NET_ACCESS_GSM)
-#define AS_COMPACT          (1 << NET_ACCESS_COMPACT)
-#define AS_UTRAN            (1 << NET_ACCESS_UTRAN)
-#define AS_EGPRS            (1 << NET_ACCESS_EGPRS)
-#define AS_HSDPA            (1 << NET_ACCESS_HSDPA)
-#define AS_HSUPA            (1 << NET_ACCESS_HSUPA)
-#define AS_HSDUPA           (1 << NET_ACCESS_HSDUPA)
-#define AS_EUTRAN           (1 << NET_ACCESS_EUTRAN)
-
-/*
- * NAS->AS - Cell Information request
- * NAS request AS to search for a suitable cell belonging to the selected
- * PLMN to camp on.
- */
-typedef struct cell_info_req_s {
-  plmn_t plmnID;  /* Selected PLMN identity           */
-  Byte_t rat;     /* Bitmap - set of radio access technologies    */
-} cell_info_req_t;
-
-/*
- * AS->NAS - Cell Information confirm
- * AS search for a suitable cell and respond to NAS. If found, the cell
- * is selected to camp on.
- */
-typedef struct cell_info_cnf_s {
-  uint8_t errCode;    /* Error code                     */
-  ci_t cellID;    /* Identity of the cell serving the selected PLMN */
-  tac_t tac;      /* Code of the tracking area the cell belongs to  */
-  AcT_t rat;      /* Radio access technology supported by the cell  */
-  uint8_t rsrq;   /* Reference signal received quality         */
-  uint8_t rsrp;   /* Reference signal received power       */
-} cell_info_cnf_t;
-
-/*
- * AS->NAS - Cell Information indication
- * AS may change cell selection if a more suitable cell is found.
- */
-typedef struct cell_info_ind_s {
-  ci_t cellID;    /* Identity of the new serving cell      */
-  tac_t tac;      /* Code of the tracking area the cell belongs to */
-} cell_info_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *              Paging information
- * --------------------------------------------------------------------------
- */
-
-/* Paging cause */
-typedef enum paging_cause_s {
-  AS_CONNECTION_ESTABLISH,    /* Establish NAS signalling connection  */
-  AS_EPS_ATTACH,      /* Perform local detach and initiate EPS
-                 * attach procedure         */
-  AS_CS_FALLBACK      /* Inititate CS fallback procedure  */
-} paging_cause_t;
-
-/*
- * NAS->AS - Paging Information request
- * NAS requests the AS that NAS signalling messages or user data is pending
- * to be sent.
- */
-typedef struct paging_req_s {
-  as_stmsi_t s_tmsi;  /* UE identity                  */
-  uint8_t CN_domain;  /* Core network domain              */
-} paging_req_t;
-
-/*
- * AS->NAS - Paging Information indication
- * AS reports to the NAS that appropriate procedure has to be initiated.
- */
-typedef struct paging_ind_s {
-  paging_cause_t cause;  /* Paging cause                 */
-} paging_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *          NAS signalling connection establishment
- * --------------------------------------------------------------------------
- */
-
-/* Cause of RRC connection establishment */
-typedef enum as_cause_s {
-  AS_CAUSE_UNKNOWN    = 0,
-  AS_CAUSE_EMERGENCY  = NET_ESTABLISH_CAUSE_EMERGENCY,
-  AS_CAUSE_HIGH_PRIO  = NET_ESTABLISH_CAUSE_HIGH_PRIO,
-  AS_CAUSE_MT_ACCESS  = NET_ESTABLISH_CAUSE_MT_ACCESS,
-  AS_CAUSE_MO_SIGNAL  = NET_ESTABLISH_CAUSE_MO_SIGNAL,
-  AS_CAUSE_MO_DATA    = NET_ESTABLISH_CAUSE_MO_DATA,
-  AS_CAUSE_V1020      = NET_ESTABLISH_CAUSE_V1020
-} as_cause_t;
-
-/* Type of the call associated to the RRC connection establishment */
-typedef enum as_call_type_s {
-  AS_TYPE_ORIGINATING_SIGNAL  = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL,
-  AS_TYPE_EMERGENCY_CALLS     = NET_ESTABLISH_TYPE_EMERGENCY_CALLS,
-  AS_TYPE_ORIGINATING_CALLS   = NET_ESTABLISH_TYPE_ORIGINATING_CALLS,
-  AS_TYPE_TERMINATING_CALLS   = NET_ESTABLISH_TYPE_TERMINATING_CALLS,
-  AS_TYPE_MO_CS_FALLBACK      = NET_ESTABLISH_TYPE_MO_CS_FALLBACK
-} as_call_type_t;
-
-/*
- * NAS->AS - NAS signalling connection establishment request
- * NAS requests the AS to perform the RRC connection establishment procedure
- * to transfer initial NAS message to the network while UE is in IDLE mode.
- */
-typedef struct nas_establish_req_s {
-  as_cause_t      cause;          /* RRC connection establishment cause   */
-  as_call_type_t  type;           /* RRC associated call type             */
-  as_stmsi_t      s_tmsi;         /* UE identity                          */
-  plmn_t          plmnID;         /* Selected PLMN identity               */
-  as_nas_info_t   initialNasMsg;  /* Initial NAS message to transfer      */
-} nas_establish_req_t;
-
-/*
- * AS->NAS - NAS signalling connection establishment indication
- * AS transfers the initial NAS message to the NAS.
- */
-typedef struct nas_establish_ind_s {
-  uint32_t      UEid;          /* UE lower layer identifier               */
-  tac_t         tac;           /* Code of the tracking area the initiating
-                                  * UE belongs to                           */
-  as_cause_t    asCause;       /* Establishment cause                     */
-  as_nas_info_t initialNasMsg; /* Initial NAS message to transfer         */
-} nas_establish_ind_t;
-
-/*
- * NAS->AS - NAS signalling connection establishment response
- * NAS responds to the AS that initial answer message has to be provided to
- * the UE.
- */
-typedef struct nas_establish_rsp_s {
-  uint32_t         UEid;         /* UE lower layer identifier   */
-  as_stmsi_t       s_tmsi;       /* UE identity                 */
-  nas_error_code_t errCode;      /* Transaction status          */
-  as_nas_info_t    nasMsg;       /* NAS message to transfer     */
-  uint32_t         nas_ul_count; /* UL NAS COUNT                */
-  uint16_t         selected_encryption_algorithm;
-  uint16_t         selected_integrity_algorithm;
-} nas_establish_rsp_t;
-
-/*
- * AS->NAS - NAS signalling connection establishment confirm
- * AS transfers the initial answer message to the NAS.
- */
-typedef struct nas_establish_cnf_s {
-  uint32_t         UEid;            /* UE lower layer identifier   */
-  nas_error_code_t errCode;         /* Transaction status          */
-  as_nas_info_t    nasMsg;          /* NAS message to transfer     */
-  uint32_t         ul_nas_count;
-  uint16_t         selected_encryption_algorithm;
-  uint16_t         selected_integrity_algorithm;
-} nas_establish_cnf_t;
-
-/*
- * --------------------------------------------------------------------------
- *          NAS signalling connection release
- * --------------------------------------------------------------------------
- */
-
-/* Release cause */
-typedef enum release_cause_s {
-  AS_AUTHENTICATION_FAILURE = 1,  /* Authentication procedure failed   */
-  AS_DETACH                       /* Detach requested                  */
-} release_cause_t;
-
-/*
- * NAS->AS - NAS signalling connection release request
- * NAS requests the termination of the connection with the UE.
- */
-typedef struct nas_release_req_s {
-  uint32_t UEid;          /* UE lower layer identifier    */
-  as_stmsi_t s_tmsi;      /* UE identity                  */
-  release_cause_t cause;  /* Release cause                */
-} nas_release_req_t;
-
-/*
- * AS->NAS - NAS signalling connection release indication
- * AS reports that connection has been terminated by the network.
- */
-typedef struct nas_release_ind_s {
-  release_cause_t cause;      /* Release cause            */
-} nas_release_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *              NAS information transfer
- * --------------------------------------------------------------------------
- */
-
-/*
- * NAS->AS - Uplink data transfer request
- * NAS requests the AS to transfer uplink information to the NAS that
- * operates at the network side.
- */
-typedef struct ul_info_transfer_req_s {
-  uint32_t UEid;      /* UE lower layer identifier        */
-  as_stmsi_t s_tmsi;      /* UE identity              */
-  as_nas_info_t nasMsg;   /* Uplink NAS message           */
-} ul_info_transfer_req_t;
-
-/*
- * AS->NAS - Uplink data transfer confirm
- * AS immediately notifies the NAS whether uplink information has been
- * successfully sent to the network or not.
- */
-typedef struct ul_info_transfer_cnf_s {
-  uint32_t         UEid;      /* UE lower layer identifier        */
-  nas_error_code_t errCode;   /* Transaction status               */
-} ul_info_transfer_cnf_t;
-
-/*
- * AS->NAS - Uplink data transfer indication
- * AS delivers the uplink information message to the NAS that operates
- * at the network side.
- */
-typedef struct ul_info_transfer_ind_s {
-  uint32_t UEid;          /* UE lower layer identifier        */
-  as_nas_info_t nasMsg;   /* Uplink NAS message           */
-} ul_info_transfer_ind_t;
-
-/*
- * NAS->AS - Downlink data transfer request
- * NAS requests the AS to transfer downlink information to the NAS that
- * operates at the UE side.
- */
-typedef ul_info_transfer_req_t dl_info_transfer_req_t;
-
-/*
- * AS->NAS - Downlink data transfer confirm
- * AS immediately notifies the NAS whether downlink information has been
- * successfully sent to the network or not.
- */
-typedef ul_info_transfer_cnf_t dl_info_transfer_cnf_t;
-
-/*
- * AS->NAS - Downlink data transfer indication
- * AS delivers the downlink information message to the NAS that operates
- * at the UE side.
- */
-typedef ul_info_transfer_ind_t dl_info_transfer_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *          Radio Access Bearer establishment
- * --------------------------------------------------------------------------
- */
-
-/* TODO: Quality of Service parameters */
-typedef struct {} as_qos_t;
-
-/*
- * NAS->AS - Radio access bearer establishment request
- * NAS requests the AS to allocate transmission resources to radio access
- * bearer initialized at the network side.
- */
-typedef struct rab_establish_req_s {
-  as_stmsi_t s_tmsi;      /* UE identity                      */
-  as_rab_id_t rabID;      /* Radio access bearer identity     */
-  as_qos_t QoS;           /* Requested Quality of Service     */
-} rab_establish_req_t;
-
-/*
- * AS->NAS - Radio access bearer establishment indication
- * AS notifies the NAS that specific radio access bearer has to be setup.
- */
-typedef struct rab_establish_ind_s {
-  as_rab_id_t rabID;      /* Radio access bearer identity     */
-} rab_establish_ind_t;
-
-/*
- * NAS->AS - Radio access bearer establishment response
- * NAS responds to AS whether the specified radio access bearer has been
- * successfully setup or not.
- */
-typedef struct rab_establish_rsp_s {
-  as_stmsi_t       s_tmsi;        /* UE identity                      */
-  as_rab_id_t      rabID;         /* Radio access bearer identity     */
-  nas_error_code_t errCode;       /* Transaction status               */
-} rab_establish_rsp_t;
-
-/*
- * AS->NAS - Radio access bearer establishment confirm
- * AS notifies NAS whether the specified radio access bearer has been
- * successfully setup at the UE side or not.
- */
-typedef struct rab_establish_cnf_s {
-  as_rab_id_t rabID;          /* Radio access bearer identity     */
-  nas_error_code_t errCode;   /* Transaction status               */
-} rab_establish_cnf_t;
-
-/*
- * --------------------------------------------------------------------------
- *              Radio Access Bearer release
- * --------------------------------------------------------------------------
- */
-
-/*
- * NAS->AS - Radio access bearer release request
- * NAS requests the AS to release transmission resources previously allocated
- * to specific radio access bearer at the network side.
- */
-typedef struct rab_release_req_s {
-  as_stmsi_t s_tmsi;      /* UE identity                      */
-  as_rab_id_t rabID;      /* Radio access bearer identity     */
-} rab_release_req_t;
-
-/*
- * AS->NAS - Radio access bearer release indication
- * AS notifies NAS that specific radio access bearer has been released.
- */
-typedef struct rab_release_ind_s {
-  as_rab_id_t rabID;      /* Radio access bearer identity     */
-} rab_release_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *  Structure of the AS messages handled by the network sublayer
- * --------------------------------------------------------------------------
- */
-typedef struct as_message_s {
-  uint16_t msgID;
-  union {
-    broadcast_info_ind_t broadcast_info_ind;
-    cell_info_req_t cell_info_req;
-    cell_info_cnf_t cell_info_cnf;
-    cell_info_ind_t cell_info_ind;
-    paging_req_t paging_req;
-    paging_ind_t paging_ind;
-    nas_establish_req_t nas_establish_req;
-    nas_establish_ind_t nas_establish_ind;
-    nas_establish_rsp_t nas_establish_rsp;
-    nas_establish_cnf_t nas_establish_cnf;
-    nas_release_req_t nas_release_req;
-    nas_release_ind_t nas_release_ind;
-    ul_info_transfer_req_t ul_info_transfer_req;
-    ul_info_transfer_cnf_t ul_info_transfer_cnf;
-    ul_info_transfer_ind_t ul_info_transfer_ind;
-    dl_info_transfer_req_t dl_info_transfer_req;
-    dl_info_transfer_cnf_t dl_info_transfer_cnf;
-    dl_info_transfer_ind_t dl_info_transfer_ind;
-    rab_establish_req_t rab_establish_req;
-    rab_establish_ind_t rab_establish_ind;
-    rab_establish_rsp_t rab_establish_rsp;
-    rab_establish_cnf_t rab_establish_cnf;
-    rab_release_req_t rab_release_req;
-    rab_release_ind_t rab_release_ind;
-  } __attribute__((__packed__)) msg;
-} as_message_t;
-
-/****************************************************************************/
-/********************  G L O B A L    V A R I A B L E S  ********************/
-/****************************************************************************/
-
-/****************************************************************************/
-/******************  E X P O R T E D    F U N C T I O N S  ******************/
-/****************************************************************************/
-
-int as_message_decode(const char* buffer, as_message_t* msg, int length);
-
-int as_message_encode(char* buffer, as_message_t* msg, int length);
-
-/* Implemented in the network_api.c body file */
-int as_message_send(as_message_t* as_msg);
-
-#endif /* __AS_MESSAGE_H__*/
diff --git a/openair3/COMMON/gtpv1_u_messages_def.h b/openair3/COMMON/gtpv1_u_messages_def.h
deleted file mode 100644
index 4308853515aac828a59e3fec050507d80a48adde..0000000000000000000000000000000000000000
--- a/openair3/COMMON/gtpv1_u_messages_def.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.1  (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
- */
-
-MESSAGE_DEF(GTPV1U_CREATE_TUNNEL_REQ,   MESSAGE_PRIORITY_MED, Gtpv1uCreateTunnelReq,  gtpv1uCreateTunnelReq)
-MESSAGE_DEF(GTPV1U_CREATE_TUNNEL_RESP,  MESSAGE_PRIORITY_MED, Gtpv1uCreateTunnelResp, gtpv1uCreateTunnelResp)
-MESSAGE_DEF(GTPV1U_UPDATE_TUNNEL_REQ,   MESSAGE_PRIORITY_MED, Gtpv1uUpdateTunnelReq,  gtpv1uUpdateTunnelReq)
-MESSAGE_DEF(GTPV1U_UPDATE_TUNNEL_RESP,  MESSAGE_PRIORITY_MED, Gtpv1uUpdateTunnelResp, gtpv1uUpdateTunnelResp)
-MESSAGE_DEF(GTPV1U_DELETE_TUNNEL_REQ,   MESSAGE_PRIORITY_MED, Gtpv1uDeleteTunnelReq,  gtpv1uDeleteTunnelReq)
-MESSAGE_DEF(GTPV1U_DELETE_TUNNEL_RESP,  MESSAGE_PRIORITY_MED, Gtpv1uDeleteTunnelResp, gtpv1uDeleteTunnelResp)
-MESSAGE_DEF(GTPV1U_TUNNEL_DATA_IND,     MESSAGE_PRIORITY_MED, Gtpv1uTunnelDataInd,    gtpv1uTunnelDataInd)
-MESSAGE_DEF(GTPV1U_TUNNEL_DATA_REQ,     MESSAGE_PRIORITY_MED, Gtpv1uTunnelDataReq,    gtpv1uTunnelDataReq)
diff --git a/openair3/COMMON/gtpv1_u_messages_types.h b/openair3/COMMON/gtpv1_u_messages_types.h
deleted file mode 100644
index 594325647b255092af0274c2d41bdbffc9a7d3b6..0000000000000000000000000000000000000000
--- a/openair3/COMMON/gtpv1_u_messages_types.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#ifndef GTPV1_U_MESSAGES_TYPES_H_
-#define GTPV1_U_MESSAGES_TYPES_H_
-
-#include "../SGW-LITE/sgw_lite_ie_defs.h"
-
-typedef struct {
-  Teid_t           context_teid;               ///< Tunnel Endpoint Identifier
-  ebi_t            eps_bearer_id;
-} Gtpv1uCreateTunnelReq;
-
-typedef struct {
-  uint8_t  status;           ///< Status of S1U endpoint creation (Failed = 0xFF or Success = 0x0)
-  Teid_t   context_teid;     ///< local SGW S11 Tunnel Endpoint Identifier
-  Teid_t   S1u_teid;         ///< Tunnel Endpoint Identifier
-  ebi_t    eps_bearer_id;
-} Gtpv1uCreateTunnelResp;
-
-typedef struct {
-  Teid_t           context_teid;     ///< S11 Tunnel Endpoint Identifier
-  Teid_t           sgw_S1u_teid;     ///< SGW S1U local Tunnel Endpoint Identifier
-  Teid_t           enb_S1u_teid;     ///< eNB S1U Tunnel Endpoint Identifier
-  ip_address_t     enb_ip_address_for_S1u;
-  ebi_t            eps_bearer_id;
-} Gtpv1uUpdateTunnelReq;
-
-typedef struct {
-  uint8_t          status;           ///< Status (Failed = 0xFF or Success = 0x0)
-  Teid_t           context_teid;     ///< S11 Tunnel Endpoint Identifier
-  Teid_t           sgw_S1u_teid;     ///< SGW S1U local Tunnel Endpoint Identifier
-  Teid_t           enb_S1u_teid;     ///< eNB S1U Tunnel Endpoint Identifier
-  ebi_t            eps_bearer_id;
-} Gtpv1uUpdateTunnelResp;
-
-typedef struct {
-  Teid_t           context_teid;   ///< local SGW S11 Tunnel Endpoint Identifier
-  Teid_t           S1u_teid;       ///< local S1U Tunnel Endpoint Identifier to be deleted
-} Gtpv1uDeleteTunnelReq;
-
-typedef struct {
-  uint8_t  status;           ///< Status of S1U endpoint deleteion (Failed = 0xFF or Success = 0x0)
-  Teid_t   context_teid;     ///< local SGW S11 Tunnel Endpoint Identifier
-  Teid_t   S1u_teid;         ///< local S1U Tunnel Endpoint Identifier to be deleted
-} Gtpv1uDeleteTunnelResp;
-
-typedef struct {
-  uint8_t  *buffer;
-  uint32_t  length;
-  uint32_t  offset;                       ///< start of message offset in buffer
-  Teid_t    local_S1u_teid;               ///< Tunnel Endpoint Identifier
-} Gtpv1uTunnelDataInd;
-
-typedef struct {
-  uint8_t  *buffer;
-  uint32_t  length;
-  uint32_t  offset;                       ///< start of message offset in buffer
-  Teid_t    local_S1u_teid;               ///< Tunnel Endpoint Identifier
-  Teid_t    S1u_enb_teid;                 ///< Tunnel Endpoint Identifier
-} Gtpv1uTunnelDataReq;
-
-#endif /* GTPV1_U_MESSAGES_TYPES_H_ */
diff --git a/openair3/COMMON/messages_def.h b/openair3/COMMON/messages_def.h
deleted file mode 100644
index 1c1cdbaf0f0dc32476c35e3e51f416de52899bdc..0000000000000000000000000000000000000000
--- a/openair3/COMMON/messages_def.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.1  (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
- */
-
-// These messages files are mandatory and must always be placed in first position
-#include "intertask_messages_def.h"
-#include "timer_messages_def.h"
-
-// Messages files used between tasks
-#include "gtpv1_u_messages_def.h"
-#include "ip_forward_messages_def.h"
-#include "nas_messages_def.h"
-#include "s11_messages_def.h"
-#include "s1ap_messages_def.h"
-#include "s6a_messages_def.h"
-#include "sctp_messages_def.h"
-#include "sgw_lite_def.h"
-#include "udp_messages_def.h"
-#include "mme_app_messages_def.h"
diff --git a/openair3/COMMON/nas_messages_def.h b/openair3/COMMON/nas_messages_def.h
deleted file mode 100644
index 9bdcde4fdf06293338e7ef8659776b2a0fffaec1..0000000000000000000000000000000000000000
--- a/openair3/COMMON/nas_messages_def.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.1  (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
- */
-
-//WARNING: Do not include this header directly. Use intertask_interface.h instead.
-
-// Messages for NAS logging
-MESSAGE_DEF(NAS_DL_EMM_RAW_MSG,                 MESSAGE_PRIORITY_MED,   nas_raw_msg_t,              nas_dl_emm_raw_msg)
-MESSAGE_DEF(NAS_UL_EMM_RAW_MSG,                 MESSAGE_PRIORITY_MED,   nas_raw_msg_t,              nas_ul_emm_raw_msg)
-
-MESSAGE_DEF(NAS_DL_EMM_PLAIN_MSG,               MESSAGE_PRIORITY_MED,   nas_emm_plain_msg_t,        nas_dl_emm_plain_msg)
-MESSAGE_DEF(NAS_UL_EMM_PLAIN_MSG,               MESSAGE_PRIORITY_MED,   nas_emm_plain_msg_t,        nas_ul_emm_plain_msg)
-MESSAGE_DEF(NAS_DL_EMM_PROTECTED_MSG,           MESSAGE_PRIORITY_MED,   nas_emm_protected_msg_t,    nas_dl_emm_protected_msg)
-MESSAGE_DEF(NAS_UL_EMM_PROTECTED_MSG,           MESSAGE_PRIORITY_MED,   nas_emm_protected_msg_t,    nas_ul_emm_protected_msg)
-
-MESSAGE_DEF(NAS_DL_ESM_RAW_MSG,                 MESSAGE_PRIORITY_MED,   nas_raw_msg_t,              nas_dl_esm_raw_msg)
-MESSAGE_DEF(NAS_UL_ESM_RAW_MSG,                 MESSAGE_PRIORITY_MED,   nas_raw_msg_t,              nas_ul_esm_raw_msg)
-
-MESSAGE_DEF(NAS_DL_ESM_PLAIN_MSG,               MESSAGE_PRIORITY_MED,   nas_esm_plain_msg_t,        nas_dl_esm_plain_msg)
-MESSAGE_DEF(NAS_UL_ESM_PLAIN_MSG,               MESSAGE_PRIORITY_MED,   nas_esm_plain_msg_t,        nas_ul_esm_plain_msg)
-MESSAGE_DEF(NAS_DL_ESM_PROTECTED_MSG,           MESSAGE_PRIORITY_MED,   nas_esm_protected_msg_t,    nas_dl_esm_protected_msg)
-MESSAGE_DEF(NAS_UL_ESM_PROTECTED_MSG,           MESSAGE_PRIORITY_MED,   nas_esm_protected_msg_t,    nas_ul_esm_protected_msg)
-
-/* */
-MESSAGE_DEF(NAS_PAGING_IND,                     MESSAGE_PRIORITY_MED,   nas_paging_ind_t,           nas_paging_ind)
-MESSAGE_DEF(NAS_PDN_CONNECTIVITY_REQ,           MESSAGE_PRIORITY_MED,   nas_pdn_connectivity_req_t, nas_pdn_connectivity_req)
-MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_IND,   MESSAGE_PRIORITY_MED,   nas_conn_est_ind_t,         nas_conn_est_ind)
-MESSAGE_DEF(NAS_CONNECTION_ESTABLISHMENT_CNF,   MESSAGE_PRIORITY_MED,   nas_conn_est_cnf_t,         nas_conn_est_cnf)
-MESSAGE_DEF(NAS_CONNECTION_RELEASE_IND,         MESSAGE_PRIORITY_MED,   nas_conn_rel_ind_t,         nas_conn_rel_ind)
-MESSAGE_DEF(NAS_UPLINK_DATA_IND,                MESSAGE_PRIORITY_MED,   nas_ul_data_ind_t,          nas_ul_data_ind)
-MESSAGE_DEF(NAS_DOWNLINK_DATA_REQ,              MESSAGE_PRIORITY_MED,   nas_dl_data_req_t,          nas_dl_data_req)
-MESSAGE_DEF(NAS_DOWNLINK_DATA_CNF,              MESSAGE_PRIORITY_MED,   nas_dl_data_cnf_t,          nas_dl_data_cnf)
-MESSAGE_DEF(NAS_DOWNLINK_DATA_REJ,              MESSAGE_PRIORITY_MED,   nas_dl_data_rej_t,          nas_dl_data_rej)
-MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_REQ,          MESSAGE_PRIORITY_MED,   nas_rab_est_req_t,          nas_rab_est_req)
-MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_RESP,         MESSAGE_PRIORITY_MED,   nas_rab_est_rsp_t,          nas_rab_est_rsp)
-MESSAGE_DEF(NAS_RAB_RELEASE_REQ,                MESSAGE_PRIORITY_MED,   nas_rab_rel_req_t,          nas_rab_rel_req)
-
-/* NAS layer -> MME app messages */
-MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_REQ,       MESSAGE_PRIORITY_MED,   nas_auth_param_req_t,       nas_auth_param_req)
-
-/* MME app -> NAS layer messages */
-MESSAGE_DEF(NAS_PDN_CONNECTIVITY_RSP,           MESSAGE_PRIORITY_MED,   nas_pdn_connectivity_rsp_t,  nas_pdn_connectivity_rsp)
-MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL,          MESSAGE_PRIORITY_MED,   nas_pdn_connectivity_fail_t, nas_pdn_connectivity_fail)
-MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP,       MESSAGE_PRIORITY_MED,   nas_auth_param_rsp_t,        nas_auth_param_rsp)
-MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL,      MESSAGE_PRIORITY_MED,   nas_auth_param_fail_t,       nas_auth_param_fail)
-
diff --git a/openair3/COMMON/nas_messages_types.h b/openair3/COMMON/nas_messages_types.h
deleted file mode 100644
index 81a44fa4f4c42fe476822ca3d1f879f5468c4f6c..0000000000000000000000000000000000000000
--- a/openair3/COMMON/nas_messages_types.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#include "as_message.h"
-#include "nas_message.h"
-
-#ifndef NAS_MESSAGES_TYPES_H_
-#define NAS_MESSAGES_TYPES_H_
-
-#define NAS_DL_EMM_RAW_MSG(mSGpTR)                  (mSGpTR)->ittiMsg.nas_dl_emm_raw_msg
-#define NAS_UL_EMM_RAW_MSG(mSGpTR)                  (mSGpTR)->ittiMsg.nas_ul_emm_raw_msg
-
-#define NAS_DL_EMM_PROTECTED_MSG(mSGpTR)            (mSGpTR)->ittiMsg.nas_dl_emm_protected_msg
-#define NAS_UL_EMM_PROTECTED_MSG(mSGpTR)            (mSGpTR)->ittiMsg.nas_ul_emm_protected_msg
-#define NAS_DL_EMM_PLAIN_MSG(mSGpTR)                (mSGpTR)->ittiMsg.nas_dl_emm_plain_msg
-#define NAS_UL_EMM_PLAIN_MSG(mSGpTR)                (mSGpTR)->ittiMsg.nas_ul_emm_plain_msg
-
-#define NAS_DL_ESM_RAW_MSG(mSGpTR)                  (mSGpTR)->ittiMsg.nas_dl_esm_raw_msg
-#define NAS_UL_ESM_RAW_MSG(mSGpTR)                  (mSGpTR)->ittiMsg.nas_ul_esm_raw_msg
-
-#define NAS_DL_ESM_PROTECTED_MSG(mSGpTR)            (mSGpTR)->ittiMsg.nas_dl_esm_protected_msg
-#define NAS_UL_ESM_PROTECTED_MSG(mSGpTR)            (mSGpTR)->ittiMsg.nas_ul_esm_protected_msg
-#define NAS_DL_ESM_PLAIN_MSG(mSGpTR)                (mSGpTR)->ittiMsg.nas_dl_esm_plain_msg
-#define NAS_UL_ESM_PLAIN_MSG(mSGpTR)                (mSGpTR)->ittiMsg.nas_ul_esm_plain_msg
-
-#define NAS_UL_DATA_IND(mSGpTR)                     (mSGpTR)->ittiMsg.nas_ul_data_ind
-#define NAS_DL_DATA_REQ(mSGpTR)                     (mSGpTR)->ittiMsg.nas_dl_data_req
-#define NAS_DL_DATA_CNF(mSGpTR)                     (mSGpTR)->ittiMsg.nas_dl_data_cnf
-#define NAS_DL_DATA_REJ(mSGpTR)                     (mSGpTR)->ittiMsg.nas_dl_data_rej
-#define NAS_PDN_CONNECTIVITY_REQ(mSGpTR)            (mSGpTR)->ittiMsg.nas_pdn_connectivity_req
-#define NAS_PDN_CONNECTIVITY_RSP(mSGpTR)            (mSGpTR)->ittiMsg.nas_pdn_connectivity_rsp
-#define NAS_PDN_CONNECTIVITY_FAIL(mSGpTR)           (mSGpTR)->ittiMsg.nas_pdn_connectivity_fail
-#define NAS_CONN_EST_IND(mSGpTR)                    (mSGpTR)->ittiMsg.nas_conn_est_ind
-#define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR)    (mSGpTR)->ittiMsg.nas_conn_est_cnf
-#define NAS_BEARER_PARAM(mSGpTR)                    (mSGpTR)->ittiMsg.nas_bearer_param
-#define NAS_AUTHENTICATION_REQ(mSGpTR)              (mSGpTR)->ittiMsg.nas_auth_req
-#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR)        (mSGpTR)->ittiMsg.nas_auth_param_req
-#define NAS_AUTHENTICATION_PARAM_RSP(mSGpTR)        (mSGpTR)->ittiMsg.nas_auth_param_rsp
-#define NAS_AUTHENTICATION_PARAM_FAIL(mSGpTR)       (mSGpTR)->ittiMsg.nas_auth_param_fail
-
-#define NAS_DATA_LENGHT_MAX     256
-
-
-
-typedef enum {
-  EMM_MSG_HEADER = 1,
-  EMM_MSG_ATTACH_REQUEST,
-  EMM_MSG_ATTACH_ACCEPT,
-  EMM_MSG_ATTACH_COMPLETE,
-  EMM_MSG_ATTACH_REJECT,
-  EMM_MSG_DETACH_REQUEST,
-  EMM_MSG_DETACH_ACCEPT,
-  EMM_MSG_TRACKING_AREA_UPDATE_REQUEST,
-  EMM_MSG_TRACKING_AREA_UPDATE_ACCEPT,
-  EMM_MSG_TRACKING_AREA_UPDATE_COMPLETE,
-  EMM_MSG_TRACKING_AREA_UPDATE_REJECT,
-  EMM_MSG_EXTENDED_SERVICE_REQUEST,
-  EMM_MSG_SERVICE_REQUEST,
-  EMM_MSG_SERVICE_REJECT,
-  EMM_MSG_GUTI_REALLOCATION_COMMAND,
-  EMM_MSG_GUTI_REALLOCATION_COMPLETE,
-  EMM_MSG_AUTHENTICATION_REQUEST,
-  EMM_MSG_AUTHENTICATION_RESPONSE,
-  EMM_MSG_AUTHENTICATION_REJECT,
-  EMM_MSG_AUTHENTICATION_FAILURE,
-  EMM_MSG_IDENTITY_REQUEST,
-  EMM_MSG_IDENTITY_RESPONSE,
-  EMM_MSG_SECURITY_MODE_COMMAND,
-  EMM_MSG_SECURITY_MODE_COMPLETE,
-  EMM_MSG_SECURITY_MODE_REJECT,
-  EMM_MSG_EMM_STATUS,
-  EMM_MSG_EMM_INFORMATION,
-  EMM_MSG_DOWNLINK_NAS_TRANSPORT,
-  EMM_MSG_UPLINK_NAS_TRANSPORT,
-  EMM_MSG_CS_SERVICE_NOTIFICATION,
-} emm_message_ids_t;
-
-
-
-typedef enum {
-  ESM_MSG_HEADER = 1,
-  ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
-  ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT,
-  ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT,
-  ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST,
-  ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT,
-  ESM_MSG_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT,
-  ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_REQUEST,
-  ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_ACCEPT,
-  ESM_MSG_MODIFY_EPS_BEARER_CONTEXT_REJECT,
-  ESM_MSG_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST,
-  ESM_MSG_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT,
-  ESM_MSG_PDN_CONNECTIVITY_REQUEST,
-  ESM_MSG_PDN_CONNECTIVITY_REJECT,
-  ESM_MSG_PDN_DISCONNECT_REQUEST,
-  ESM_MSG_PDN_DISCONNECT_REJECT,
-  ESM_MSG_BEARER_RESOURCE_ALLOCATION_REQUEST,
-  ESM_MSG_BEARER_RESOURCE_ALLOCATION_REJECT,
-  ESM_MSG_BEARER_RESOURCE_MODIFICATION_REQUEST,
-  ESM_MSG_BEARER_RESOURCE_MODIFICATION_REJECT,
-  ESM_MSG_ESM_INFORMATION_REQUEST,
-  ESM_MSG_ESM_INFORMATION_RESPONSE,
-  ESM_MSG_ESM_STATUS,
-} esm_message_ids_t;
-
-
-
-typedef struct nas_raw_msg_s {
-  uint32_t                        lenght;
-  uint8_t                         data[NAS_DATA_LENGHT_MAX];
-} nas_raw_msg_t;
-
-
-
-typedef struct nas_emm_plain_msg_s {
-  emm_message_ids_t               present;
-  EMM_msg                         choice;
-
-} nas_emm_plain_msg_t;
-
-
-
-typedef struct nas_emm_protected_msg_s {
-  nas_message_security_header_t   header;
-  emm_message_ids_t               present;
-  EMM_msg                         choice;
-} nas_emm_protected_msg_t;
-
-
-typedef struct nas_esm_plain_msg_s {
-  esm_message_ids_t               present;
-  ESM_msg                         choice;
-
-} nas_esm_plain_msg_t;
-
-
-typedef struct nas_esm_protected_msg_s {
-  nas_message_security_header_t   header;
-  esm_message_ids_t               present;
-  ESM_msg                         choice;
-} nas_esm_protected_msg_t;
-
-
-typedef struct nas_paging_ind_s {
-
-} nas_paging_ind_t;
-
-
-typedef struct nas_pdn_connectivity_req_s {
-  int                    pti;   // nas ref  Identity of the procedure transaction executed to activate the PDN connection entry
-  unsigned               ue_id; // nas ref
-  char                   imsi[16];
-  uint8_t                imsi_length;
-  network_qos_t          qos;
-  pco_flat_t             pco;
-  OctetString            apn;
-  OctetString            pdn_addr;
-  int                    pdn_type;
-  void                  *proc_data;
-  int                    request_type;
-} nas_pdn_connectivity_req_t;
-
-
-typedef struct nas_pdn_connectivity_rsp_s {
-  int                     pti;   // nas ref  Identity of the procedure transaction executed to activate the PDN connection entry
-  unsigned                ue_id; // nas ref
-  network_qos_t           qos;
-  pco_flat_t              pco;
-  OctetString             apn;
-  OctetString             pdn_addr;
-  int                     pdn_type;
-  void                   *proc_data;
-  int                     request_type;
-
-  unsigned                eNB_ue_s1ap_id:24;
-  uint32_t                mme_ue_s1ap_id;
-
-  /* Key eNB */
-  //uint8_t                 keNB[32];
-
-  ambr_t                  ambr;
-  ambr_t                  apn_ambr;
-
-  /* EPS bearer ID */
-  unsigned                ebi:4;
-
-  /* QoS */
-  qci_t                   qci;
-  priority_level_t        prio_level;
-  pre_emp_vulnerability_t pre_emp_vulnerability;
-  pre_emp_capability_t    pre_emp_capability;
-
-  /* S-GW TEID for user-plane */
-  Teid_t                  sgw_s1u_teid;
-  /* S-GW IP address for User-Plane */
-  ip_address_t            sgw_s1u_address;
-} nas_pdn_connectivity_rsp_t;
-
-
-typedef struct nas_pdn_connectivity_fail_s {
-  unsigned                ue_id; // nas ref
-} nas_pdn_connectivity_fail_t;
-
-
-typedef struct nas_conn_est_ind_s {
-  nas_establish_ind_t nas;
-
-  /* Transparent message from s1ap to be forwarded to MME_APP or
-   * to S1AP if connection establishment is rejected by NAS.
-   */
-  s1ap_initial_ue_message_t transparent;
-} nas_conn_est_ind_t;
-
-
-typedef nas_establish_rsp_t nas_conn_est_rej_t;
-
-
-typedef nas_establish_cnf_t nas_conn_est_cnf_t;
-
-
-typedef struct nas_conn_rel_ind_s {
-
-} nas_conn_rel_ind_t;
-
-typedef ul_info_transfer_ind_t nas_ul_data_ind_t;
-typedef dl_info_transfer_req_t nas_dl_data_req_t;
-typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t;
-
-
-typedef struct nas_dl_data_rej_s {
-	uint32_t UEid;          /* UE lower layer identifier        */
-	  as_nas_info_t nasMsg;   /* Uplink NAS message           */
-} nas_dl_data_rej_t;
-
-typedef struct nas_rab_est_req_s {
-
-} nas_rab_est_req_t;
-
-
-typedef struct nas_rab_est_rsp_s {
-
-} nas_rab_est_rsp_t;
-
-
-typedef struct nas_rab_rel_req_s {
-
-} nas_rab_rel_req_t;
-
-
-typedef struct nas_attach_req_s {
-  /* TODO: Set the correct size */
-  char apn[100];
-  char imsi[16];
-#define INITIAL_REQUEST (0x1)
-  unsigned initial:1;
-  s1ap_initial_ue_message_t transparent;
-} nas_attach_req_t;
-
-
-typedef struct nas_auth_req_s {
-  /* UE imsi */
-  char imsi[16];
-
-#define NAS_FAILURE_OK  0x0
-#define NAS_FAILURE_IND 0x1
-  unsigned failure:1;
-  int cause;
-} nas_auth_req_t;
-
-
-typedef struct nas_auth_resp_s {
-  char imsi[16];
-} nas_auth_resp_t;
-
-typedef struct nas_auth_param_req_s {
-  /* UE identifier */
-  uint32_t ue_id;
-
-  /* Imsi of the UE (In case of initial request) */
-  char     imsi[16];
-  uint8_t  imsi_length;
-
-  /* Indicates whether the procedure corresponds to a new connection or not */
-  uint8_t  initial_req:1;
-
-  uint8_t  re_synchronization:1;
-  uint8_t  auts[14];
-} nas_auth_param_req_t;
-
-
-typedef struct nas_auth_param_rsp_s {
-  /* UE identifier */
-  uint32_t ue_id;
-
-  /* For future use: nb of vectors provided */
-  uint8_t nb_vectors;
-
-  /* Consider only one E-UTRAN vector for the moment... */
-  eutran_vector_t vector;
-} nas_auth_param_rsp_t;
-
-typedef struct nas_auth_param_fail_s {
-  /* UE identifier */
-  uint32_t    ue_id;
-
-  /* S6A mapped to NAS cause */
-  nas_cause_t cause;
-} nas_auth_param_fail_t;
-
-
-#endif /* NAS_MESSAGES_TYPES_H_ */
diff --git a/openair3/COMMON/s1ap_messages_def.h b/openair3/COMMON/s1ap_messages_def.h
deleted file mode 100644
index ffb9aa4236f5fdab4f711db12e4c5580953b433e..0000000000000000000000000000000000000000
--- a/openair3/COMMON/s1ap_messages_def.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.1  (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
- */
-
-//WARNING: Do not include this header directly. Use intertask_interface.h instead.
-
-/* Messages for S1AP logging */
-MESSAGE_DEF(S1AP_UPLINK_NAS_LOG            , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_uplink_nas_log)
-MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG     , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_capability_ind_log)
-MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_context_setup_log)
-MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG  , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_nas_non_delivery_ind_log)
-MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG          , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_downlink_nas_log)
-MESSAGE_DEF(S1AP_S1_SETUP_LOG              , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_s1_setup_log)
-MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_ue_message_log)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_req_log)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                  , s1ap_ue_context_release_command_log)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_log)
-MESSAGE_DEF(S1AP_ERROR_INDICATION_LOG      , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_error_indication_log)
-
-MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND       , MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t                , s1ap_ue_cap_ind)
-MESSAGE_DEF(S1AP_ENB_DEREGISTERED_IND      , MESSAGE_PRIORITY_MED, s1ap_eNB_deregistered_ind_t      , s1ap_eNB_deregistered_ind)
-MESSAGE_DEF(S1AP_DEREGISTER_UE_REQ         , MESSAGE_PRIORITY_MED, s1ap_deregister_ue_req_t         , s1ap_deregister_ue_req)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ    , MESSAGE_PRIORITY_MED, s1ap_ue_context_release_req_t    , s1ap_ue_context_release_req)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_context_release_command_t, s1ap_ue_context_release_command)
-MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, s1ap_ue_context_release_complete_t, s1ap_ue_context_release_complete)
diff --git a/openair3/COMMON/s1ap_messages_types.h b/openair3/COMMON/s1ap_messages_types.h
deleted file mode 100644
index e6c3bba504ae2c8f679b34710732561db7c79d52..0000000000000000000000000000000000000000
--- a/openair3/COMMON/s1ap_messages_types.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#ifndef S1AP_MESSAGES_TYPES_H_
-#define S1AP_MESSAGES_TYPES_H_
-
-#define S1AP_ENB_DEREGISTERED_IND(mSGpTR)   (mSGpTR)->ittiMsg.s1ap_eNB_deregistered_ind
-#define S1AP_DEREGISTER_UE_REQ(mSGpTR)      (mSGpTR)->ittiMsg.s1ap_deregister_ue_req
-#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_req
-#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_command
-#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_context_release_complete
-
-typedef struct s1ap_initial_ue_message_s {
-  unsigned     eNB_ue_s1ap_id:24;
-  uint32_t     mme_ue_s1ap_id;
-  cgi_t        e_utran_cgi;
-} s1ap_initial_ue_message_t;
-
-typedef struct s1ap_initial_ctxt_setup_req_s {
-  unsigned                eNB_ue_s1ap_id:24;
-  uint32_t                mme_ue_s1ap_id;
-
-  /* Key eNB */
-  uint8_t                 keNB[32];
-
-  ambr_t                  ambr;
-  ambr_t                  apn_ambr;
-
-  /* EPS bearer ID */
-  unsigned                ebi:4;
-
-  /* QoS */
-  qci_t                   qci;
-  priority_level_t        prio_level;
-  pre_emp_vulnerability_t pre_emp_vulnerability;
-  pre_emp_capability_t    pre_emp_capability;
-
-  /* S-GW TEID for user-plane */
-  Teid_t                  teid;
-  /* S-GW IP address for User-Plane */
-  ip_address_t            s_gw_address;
-} s1ap_initial_ctxt_setup_req_t;
-
-typedef struct s1ap_ue_cap_ind_s {
-  unsigned  eNB_ue_s1ap_id:24;
-  uint32_t  mme_ue_s1ap_id;
-  uint8_t   radio_capabilities[100];
-  uint32_t  radio_capabilities_length;
-} s1ap_ue_cap_ind_t;
-
-#define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20
-typedef struct s1ap_eNB_deregistered_ind_s {
-  uint8_t  nb_ue_to_deregister;
-  uint32_t mme_ue_s1ap_id[S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE];
-} s1ap_eNB_deregistered_ind_t;
-
-typedef struct s1ap_deregister_ue_req_s {
-  uint32_t mme_ue_s1ap_id;
-} s1ap_deregister_ue_req_t;
-
-typedef struct s1ap_ue_context_release_req_s {
-  uint32_t mme_ue_s1ap_id;
-} s1ap_ue_context_release_req_t;
-
-typedef struct s1ap_ue_context_release_command_s {
-  uint32_t mme_ue_s1ap_id;
-} s1ap_ue_context_release_command_t;
-
-typedef struct s1ap_ue_context_release_complete_s {
-  uint32_t mme_ue_s1ap_id;
-} s1ap_ue_context_release_complete_t;
-
-#endif /* S1AP_MESSAGES_TYPES_H_ */
diff --git a/openair3/COMMON/sctp_messages_def.h b/openair3/COMMON/sctp_messages_def.h
deleted file mode 100644
index c2d51c91eb8d85fed748615a0fcfd3382263b6af..0000000000000000000000000000000000000000
--- a/openair3/COMMON/sctp_messages_def.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.1  (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
- */
-
-//WARNING: Do not include this header directly. Use intertask_interface.h instead.
-
-MESSAGE_DEF(SCTP_INIT_MSG,          MESSAGE_PRIORITY_MED, SctpInit,                 sctpInit)
-MESSAGE_DEF(SCTP_DATA_REQ,          MESSAGE_PRIORITY_MED, sctp_data_req_t,          sctp_data_req)
-MESSAGE_DEF(SCTP_DATA_IND,          MESSAGE_PRIORITY_MED, sctp_data_ind_t,          sctp_data_ind)
-MESSAGE_DEF(SCTP_NEW_ASSOCIATION,   MESSAGE_PRIORITY_MAX, sctp_new_peer_t,          sctp_new_peer)
-MESSAGE_DEF(SCTP_CLOSE_ASSOCIATION, MESSAGE_PRIORITY_MAX, sctp_close_association_t, sctp_close_association)
diff --git a/openair3/COMMON/sctp_messages_types.h b/openair3/COMMON/sctp_messages_types.h
deleted file mode 100644
index 98a92c66b64b9c82cdd6b50b095dd1e7058152df..0000000000000000000000000000000000000000
--- a/openair3/COMMON/sctp_messages_types.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#ifndef SCTP_MESSAGES_TYPES_H_
-#define SCTP_MESSAGES_TYPES_H_
-
-#define SCTP_DATA_IND(mSGpTR)           (mSGpTR)->ittiMsg.sctp_data_ind
-#define SCTP_DATA_REQ(mSGpTR)           (mSGpTR)->ittiMsg.sctp_data_req
-#define SCTP_INIT_MSG(mSGpTR)           (mSGpTR)->ittiMsg.sctpInit
-#define SCTP_CLOSE_ASSOCIATION(mSGpTR)  (mSGpTR)->ittiMsg.sctp_close_association
-
-typedef struct sctp_data_req_s {
-  uint8_t  *buffer;
-  uint32_t  bufLen;
-  uint32_t  assocId;
-  uint16_t  stream;
-} sctp_data_req_t;
-
-typedef struct sctp_data_ind_s {
-  uint8_t  *buffer;           ///< SCTP buffer
-  uint32_t  buf_length;       ///< SCTP buffer length
-  int32_t   assoc_id;         ///< SCTP physical association ID
-  uint8_t   stream;           ///< Stream number on which data had been received
-  uint16_t  instreams;        ///< Number of input streams for the SCTP connection between peers
-  uint16_t  outstreams;       ///< Number of output streams for the SCTP connection between peers
-} sctp_data_ind_t;
-
-typedef struct sctp_init_s {
-  /* Request usage of ipv4 */
-  unsigned  ipv4:1;
-  /* Request usage of ipv6 */
-  unsigned  ipv6:1;
-  uint8_t   nb_ipv4_addr;
-  uint32_t  ipv4_address[10];
-  uint8_t   nb_ipv6_addr;
-  char     *ipv6_address[10];
-  uint16_t  port;
-  uint32_t  ppid;
-} SctpInit;
-
-typedef struct sctp_close_association_s {
-  uint32_t  assoc_id;
-} sctp_close_association_t;
-
-typedef struct sctp_new_peer_s {
-  uint32_t instreams;
-  uint32_t outstreams;
-  uint32_t assoc_id;
-} sctp_new_peer_t;
-
-#endif /* SCTP_MESSAGES_TYPES_H_ */
diff --git a/openair3/COMMON/tasks_def.h b/openair3/COMMON/tasks_def.h
deleted file mode 100644
index d1b7b8d75608667beafcaff1bbfdcf5c67ab167e..0000000000000000000000000000000000000000
--- a/openair3/COMMON/tasks_def.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.1  (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
- */
-
-// This task is mandatory and must always be placed in first position
-TASK_DEF(TASK_TIMER,    TASK_PRIORITY_MED, 10)
-
-// Other possible tasks in the process
-
-/// GTPV1-U task
-TASK_DEF(TASK_GTPV1_U,  TASK_PRIORITY_MED, 200)
-/// FW_IP task
-TASK_DEF(TASK_FW_IP,    TASK_PRIORITY_MED, 200)
-/// MME Applicative task
-TASK_DEF(TASK_MME_APP,  TASK_PRIORITY_MED, 200)
-/// NAS task
-TASK_DEF(TASK_NAS_MME,  TASK_PRIORITY_MED, 200)
-/// S11 task
-TASK_DEF(TASK_S11,      TASK_PRIORITY_MED, 200)
-/// S1AP task
-TASK_DEF(TASK_S1AP,     TASK_PRIORITY_MED, 200)
-/// S6a task
-TASK_DEF(TASK_S6A,      TASK_PRIORITY_MED, 200)
-/// SCTP task
-TASK_DEF(TASK_SCTP,     TASK_PRIORITY_MED, 200)
-/// Serving and Proxy Gateway Application task
-TASK_DEF(TASK_SPGW_APP, TASK_PRIORITY_MED, 200)
-/// UDP task
-TASK_DEF(TASK_UDP,      TASK_PRIORITY_MED, 200)
-//MESSAGE GENERATOR TASK
-TASK_DEF(TASK_MSC,      TASK_PRIORITY_MED,          200)
diff --git a/openair3/COMMON/udp_messages_def.h b/openair3/COMMON/udp_messages_def.h
deleted file mode 100644
index 35322f2450cd270f417a66de1c170427dad75ea7..0000000000000000000000000000000000000000
--- a/openair3/COMMON/udp_messages_def.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.1  (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
- */
-
-MESSAGE_DEF(UDP_INIT,     MESSAGE_PRIORITY_MED, udp_init_t,     udp_init)
-MESSAGE_DEF(UDP_DATA_REQ, MESSAGE_PRIORITY_MED, udp_data_req_t, udp_data_req)
-MESSAGE_DEF(UDP_DATA_IND, MESSAGE_PRIORITY_MED, udp_data_ind_t, udp_data_ind)
diff --git a/openair3/COMMON/udp_messages_types.h b/openair3/COMMON/udp_messages_types.h
deleted file mode 100644
index 7825a924d1cb5e1fc2600aecbbcd97a8d7a46e80..0000000000000000000000000000000000000000
--- a/openair3/COMMON/udp_messages_types.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#ifndef UDP_MESSAGES_TYPES_H_
-#define UDP_MESSAGES_TYPES_H_
-
-#define UDP_INIT(mSGpTR)    (mSGpTR)->ittiMsg.udp_init
-
-typedef struct {
-  uint32_t  port;
-  char     *address;
-} udp_init_t;
-
-typedef struct {
-  uint8_t  *buffer;
-  uint32_t  buffer_length;
-  uint32_t  buffer_offset;
-  uint32_t  peer_address;
-  uint32_t  peer_port;
-} udp_data_req_t;
-
-typedef struct {
-  uint8_t  *buffer;
-  uint32_t  buffer_length;
-  uint32_t  peer_address;
-  uint32_t  peer_port;
-} udp_data_ind_t;
-
-#endif /* UDP_MESSAGES_TYPES_H_ */
diff --git a/openair3/NAS/COMMON/API/NETWORK/l2_message.h b/openair3/NAS/COMMON/API/NETWORK/l2_message.h
deleted file mode 100644
index 9cf65b7736db6c01c89ac0f8442e84114ab81916..0000000000000000000000000000000000000000
--- a/openair3/NAS/COMMON/API/NETWORK/l2_message.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*****************************************************************************
-
-Source    as_message.h
-
-Version   0.1
-
-Date    2012/10/18
-
-Product   NAS stack
-
-Subsystem Application Programming Interface
-
-Author    Frederic Maurel
-
-Description Defines the messages supported by the Access Stratum sublayer
-    protocol (usually RRC and S1AP for E-UTRAN) and functions used
-    to encode and decode
-
-*****************************************************************************/
-#ifndef __AS_MESSAGE_H__
-#define __AS_MESSAGE_H__
-
-#include "commonDef.h"
-#include "networkDef.h"
-
-/****************************************************************************/
-/*********************  G L O B A L    C O N S T A N T S  *******************/
-/****************************************************************************/
-
-/* Access Stratum Message types */
-#define AS_REQUEST  0x0100
-#define AS_RESPONSE 0x0200
-#define AS_INDICATION 0x0400
-#define AS_CONFIRM  0x0800
-
-/*
- * Access Stratum Message identifiers
- * ----------------------------------
- */
-
-/* Cell information relevant for cell selection processing */
-#define AS_CELL_INFO      0x01
-#define AS_CELL_INFO_REQ    (AS_CELL_INFO | AS_REQUEST)
-#define AS_CELL_INFO_RSP    (AS_CELL_INFO | AS_RESPONSE)
-#define AS_CELL_INFO_IND    (AS_CELL_INFO | AS_INDICATION)
-
-/* Security mode control */
-#define AS_SECURITY     0x02
-#define AS_SECURITY_REQ     (AS_SECURITY | AS_REQUEST)
-#define AS_SECURITY_RSP     (AS_SECURITY | AS_RESPONSE)
-
-/* Paging information */
-#define AS_PAGING     0x03
-#define AS_PAGING_IND     (AS_PAGING | AS_INDICATION)
-
-/* NAS signalling connection establishment */
-#define AS_NAS_ESTABLISH    0x04
-#define AS_NAS_ESTABLISH_REQ    (AS_NAS_ESTABLISH | AS_REQUEST)
-#define AS_NAS_ESTABLISH_RSP    (AS_NAS_ESTABLISH | AS_RESPONSE)
-
-/* NAS signalling connection release */
-#define AS_NAS_RELEASE      0x05
-#define AS_NAS_RELEASE_REQ    (AS_NAS_RELEASE | AS_REQUEST)
-#define AS_NAS_RELEASE_IND    (AS_NAS_RELEASE | AS_INDICATION)
-
-/* NAS information transfer */
-#define AS_INFO_TRANSFER    0x10
-#define AS_UL_INFO_TRANSFER   (AS_INFO_TRANSFER | AS_REQUEST)
-#define AS_DL_INFO_TRANSFER   (AS_INFO_TRANSFER | AS_INDICATION)
-
-/****************************************************************************/
-/************************  G L O B A L    T Y P E S  ************************/
-/****************************************************************************/
-
-/*
- * --------------------------------------------------------------------------
- *      Available PLMNs and cell Information
- * --------------------------------------------------------------------------
- */
-
-/* Radio access technologies supported by the network */
-#define AS_GSM        (1 << NET_ACCESS_GSM)
-#define AS_COMPACT      (1 << NET_ACCESS_COMPACT)
-#define AS_UTRAN      (1 << NET_ACCESS_UTRAN)
-#define AS_EGPRS      (1 << NET_ACCESS_EGPRS)
-#define AS_HSDPA      (1 << NET_ACCESS_HSDPA)
-#define AS_HSUPA      (1 << NET_ACCESS_HSUPA)
-#define AS_HSDUPA     (1 << NET_ACCESS_HSDUPA)
-#define AS_EUTRAN     (1 << NET_ACCESS_EUTRAN)
-
-/*
- * NAS->AS -K_eNB refresh request
- * NAS request AS to refresh its KeNB key
- */
-typedef struct kenb_refresh_req_s {
-  Byte_t kenb[32];
-} kenb_refresh_req_t;
-
-/*
- * NAS->AS - Cell Information request
- * NAS request AS to search for a suitable cell belonging to the selected
- * PLMN to camp on.
- */
-typedef struct {
-  plmn_t plmnID;  /* PLMN identifier         */
-  Byte_t rat;   /* Bitmap - set of radio access technologies   */
-} cell_info_req_t;
-
-/*
- * AS->NAS - Cell Information response
- * AS search for a suitable cell and respond to NAS. If found, the cell
- * is selected to camp on.
- */
-typedef struct {
-  plmn_t plmnID;  /* PLMN identifier          */
-  TAC_t tac;    /* identifies a tracking area the PLMN belongs to */
-  CI_t cellID;  /* identifies a cell within a PLMN      */
-  AcT_t rat;    /* radio access technology supported by the cell  */
-} cell_info_rsp_t;
-
-/*
- * AS->NAS - Cell Information indication
- * AS Reports available PLMNs with associated Radio Access Technologies
- * to NAS on request from NAS or autonomously.
- */
-typedef struct {
-#define PLMN_LIST_MAX_SIZE  6
-  PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */
-  Byte_t rat[PLMN_LIST_MAX_SIZE]; /* Radio access technologies   */
-  TAC_t tac; /* identifies a tracking area within a scope of PLMNs   */
-  CI_t cellID;  /* identifies a cell within a PLMN     */
-} cell_info_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *        Security mode control
- * --------------------------------------------------------------------------
- */
-
-/*
- * TODO: NAS->AS - Security command request
- */
-typedef struct {} security_req_t;
-
-
-/*
- * TODO: AS->NAS - Security command response
- */
-typedef struct {} security_rsp_t;
-
-
-/*
- * --------------------------------------------------------------------------
- *        Paging information
- * --------------------------------------------------------------------------
- */
-
-/*
- * TODO: AS->NAS - Paging Information indication
- */
-typedef struct {} paging_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *      NAS signalling connection establishment
- * --------------------------------------------------------------------------
- */
-
-/* Cause of RRC connection establishment */
-#define AS_CAUSE_EMERGENCY    (NET_ESTABLISH_CAUSE_EMERGENCY)
-#define AS_CAUSE_HIGH_PRIO    (NET_ESTABLISH_CAUSE_HIGH_PRIO)
-#define AS_CAUSE_MT_ACCESS    (NET_ESTABLISH_CAUSE_MT_ACCESS)
-#define AS_CAUSE_MO_SIGNAL    (NET_ESTABLISH_CAUSE_MO_SIGNAL)
-#define AS_CAUSE_MO_DATA    (NET_ESTABLISH_CAUSE_MO_DATA)
-#define AS_CAUSE_V1020      (NET_ESTABLISH_CAUSE_V1020)
-
-/* Type of the call associated to the RRC connection establishment */
-#define AS_TYPE_ORIGINATING_SIGNAL  (NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL)
-#define AS_TYPE_EMERGENCY_CALLS   (NET_ESTABLISH_TYPE_EMERGENCY_CALLS)
-#define AS_TYPE_ORIGINATING_CALLS (NET_ESTABLISH_TYPE_ORIGINATING_CALLS)
-#define AS_TYPE_TERMINATING_CALLS (NET_ESTABLISH_TYPE_TERMINATING_CALLS)
-#define AS_TYPE_MO_CS_FALLBACK    (NET_ESTABLISH_TYPE_MO_CS_FALLBACK)
-
-
-/* Structure of the SAE Temporary Mobile Subscriber Identity */
-typedef struct {
-  uint8_t MMEcode;  /* MME code that allocated the GUTI   */
-  uint32_t m_tmsi;  /* M-Temporary Mobile Subscriber Identity */
-} as_stmsi_t;
-
-/* Structure of the dedicated NAS information */
-typedef struct {
-  uint32_t length;  /* Length of the NAS information data   */
-  Byte_t* data; /* Dedicated NAS information data container */
-} as_nas_info_t;
-
-/*
- * NAS->AS - NAS signalling connection establishment request
- * NAS request AS to perform the RRC connection establishment procedure
- * to transfer initial NAS message to the network while UE is in IDLE mode.
- */
-typedef struct {
-  uint8_t cause;    /* Connection establishment cause     */
-  uint8_t type;   /* Associated call type         */
-  plmn_t plmnID;    /* Identifier of the selected PLMN      */
-  as_stmsi_t s_tmsi;    /* SAE Temporary Mobile Subscriber Identity */
-  as_nas_info_t initialNasMsg;/* Initial NAS message to transfer      */
-} nas_establish_req_t;
-
-/*
- * TODO: AS->NAS - NAS signalling connection establishment response
- */
-typedef struct {} nas_establish_rsp_t;
-
-/*
- * --------------------------------------------------------------------------
- *      NAS signalling connection release
- * --------------------------------------------------------------------------
- */
-
-/*
- * TODO: NAS->AS - NAS signalling connection release request
- */
-typedef struct {} nas_release_req_t;
-
-/*
- * TODO: AS->NAS - NAS signalling connection release indication
- */
-typedef struct {} nas_release_ind_t;
-
-/*
- * --------------------------------------------------------------------------
- *        NAS information transfer
- * --------------------------------------------------------------------------
- */
-
-/*
- * AS->NAS - Downlink data transfer
- * AS notifies upper layer that NAS or non-3GPP dedicated downlink information
- * has to be transfered to NAS.
-*/
-typedef as_nas_info_t dl_info_transfer_t;
-
-/*
- * NAS->AS - Uplink data transfer request
- * NAS requests under layer to transfer NAS or non-3GPP dedicated uplink
- * information to AS.
- */
-typedef as_nas_info_t ul_info_transfer_t;
-
-/*
- * --------------------------------------------------------------------------
- *  Structure of the AS messages handled by the network sublayer
- * --------------------------------------------------------------------------
- */
-typedef struct {
-  uint16_t msgID;
-  union {
-    cell_info_req_t cell_info_req;
-    cell_info_rsp_t cell_info_rsp;
-    cell_info_ind_t cell_info_ind;
-    security_req_t security_req;
-    security_rsp_t security_rsp;
-    paging_ind_t paging_ind;
-    nas_establish_req_t nas_establish_req;
-    nas_establish_rsp_t nas_establish_rsp;
-    nas_release_req_t nas_release_req;
-    nas_release_ind_t nas_release_ind;
-    ul_info_transfer_t ul_info_transfer;
-    dl_info_transfer_t dl_info_transfer;
-  } __attribute__((__packed__)) msg;
-} as_message_t;
-
-/****************************************************************************/
-/********************  G L O B A L    V A R I A B L E S  ********************/
-/****************************************************************************/
-
-/****************************************************************************/
-/******************  E X P O R T E D    F U N C T I O N S  ******************/
-/****************************************************************************/
-
-int as_message_decode(const char* buffer, int length, as_message_t* msg);
-
-int as_message_encode(char* buffer, int length, const as_message_t* msg);
-
-/* Implemented in the network_api.c body file */
-int as_message_send(as_message_t* as_msg, const void* nas_msg);
-
-#endif /* __AS_MESSAGE_H__*/
diff --git a/openair3/NAS/TOOLS/network.h b/openair3/NAS/TOOLS/network.h
deleted file mode 100644
index cde82f4560cc6039f90ea85068e5d3f321af082a..0000000000000000000000000000000000000000
--- a/openair3/NAS/TOOLS/network.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.1  (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
- */
-
-/*****************************************************************************
-Source    network.h
-
-Version   0.1
-
-Date    2013/03/26
-
-Product   USIM data generator
-
-Subsystem PLMN network operators
-
-Author    Frederic Maurel
-
-Description Defines a list of PLMN network operators
-
-*****************************************************************************/
-#ifndef __NETWORK_H__
-#define __NETWORK_H__
-
-#include "commonDef.h"
-#include "networkDef.h"
-
-/****************************************************************************/
-/*********************  G L O B A L    C O N S T A N T S  *******************/
-/****************************************************************************/
-/*
- * PLMN network operator record index
- */
-#define TEST1 0
-#define SFR1  1
-#define SFR2  2
-#define SFR3  3
-#define OAI_LTEBOX 4
-#define TM1   5
-#define FCT1  6
-#define VDF1  7
-#define VDF2  8
-#define VDF3  9
-#define VDF4  10
-#define VDF5  11
-
-
-#define SELECTED_PLMN TEST1 //SFR1
-
-#define TEST_PLMN {0,0,0x0f,1,1,0}  // 00101
-#define SFR_PLMN_1  {0,2,0x0f,8,0,1}  // 20810
-#define SFR_PLMN_2  {0,2,0x0f,8,1,1}  // 20811
-#define SFR_PLMN_3  {0,2,0x0f,8,3,1}  // 20813
-#define OAI_LTEBOX_PLMN  {0,2,0x0f,8,3,9}  //20893
-#define TM_PLMN_1   {1,3,0,0,8,2}       // 310280
-#define FCT_PLMN_1  {1,3,8,0,2,0}       // 310028
-#define VDF_PLMN_1  {2,2,0x0f,2,0,1}  // 22210
-#define VDF_PLMN_2  {1,2,0x0f,4,0x0f,1} // 2141
-#define VDF_PLMN_3  {1,2,0x0f,4,0x0f,6} // 2146
-#define VDF_PLMN_4  {6,2,0x0f,2,0x0f,2} // 2622
-#define VDF_PLMN_5  {6,2,0x0f,2,0x0f,4} // 2624
-
-
-/****************************************************************************/
-/************************  G L O B A L    T Y P E S  ************************/
-/****************************************************************************/
-
-/*
- * PLMN network operator record
- */
-typedef struct {
-  unsigned int num;
-  plmn_t plmn;
-  char fullname[NET_FORMAT_LONG_SIZE + 1];
-  char shortname[NET_FORMAT_SHORT_SIZE + 1];
-  tac_t tac_start;
-  tac_t tac_end;
-} network_record_t;
-
-
-/****************************************************************************/
-/********************  G L O B A L    V A R I A B L E S  ********************/
-/****************************************************************************/
-
-/*
- * The list of PLMN network operator records
- */
-network_record_t network_records[] = {
-  {00101, TEST_PLMN, "Test network",     "OAI4G",     0x0001, 0xfffd},
-  {20810, SFR_PLMN_1, "SFR France",      "SFR",       0x0001, 0xfffd},
-  {20811, SFR_PLMN_2, "SFR France",      "SFR",       0x0001, 0xfffd},
-  {20813, SFR_PLMN_3, "SFR France",      "SFR",       0x0001, 0xfffd},
-  {20893, OAI_LTEBOX_PLMN, "OAI LTEBOX",   "OAIALU",  0x0001, 0xfffd},
-  {310280,TM_PLMN_1,  "T-Mobile USA",    "T-Mobile",  0x0001, 0xfffd},
-  {310028,FCT_PLMN_1, "FICTITIOUS USA",  "FICTITIO",  0x0001, 0xfffd},
-  {22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE",  0x0001, 0xfffd},
-  {2141,  VDF_PLMN_2, "Vodafone Spain",  "VODAFONE",  0x0001, 0xfffd},
-  {2146,  VDF_PLMN_3, "Vodafone Spain",  "VODAFONE",  0x0001, 0xfffd},
-  {2622,  VDF_PLMN_4, "Vodafone Germ",   "VODAFONE",  0x0001, 0xfffd},
-  {2624,  VDF_PLMN_5, "Vodafone Germ",   "VODAFONE",  0x0001, 0xfffd},
-};
-
-/****************************************************************************/
-/******************  E X P O R T E D    F U N C T I O N S  ******************/
-/****************************************************************************/
-
-#endif /* __NETWORK_H__*/
diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c
index e2a327f4886c1fd4cf84c78d7901a1bb5bfcc307..7404cd8b8a83a751e21fad46eca07033e41afcac 100644
--- a/openair3/NAS/UE/ESM/esm_ebr_context.c
+++ b/openair3/NAS/UE/ESM/esm_ebr_context.c
@@ -57,7 +57,13 @@ Description Defines functions used to handle EPS bearer contexts.
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-
+#ifdef PDCP_USE_NETLINK
+#ifdef UESIM_EXPANSION
+  #include "openairinterface5g_limits.h"
+  extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
+#endif
+#endif
+extern uint8_t  nfapi_mode;
 
 /****************************************************************************/
 /****************  E X T E R N A L    D E F I N I T I O N S  ****************/
@@ -208,7 +214,7 @@ int esm_ebr_context_create(
            char           broadcast[INET_ADDRSTRLEN];
            struct in_addr in_addr;
            char           command_line[500];
-           int            res;
+           int            res = -1;
 
            switch (pdn->type) {
            case NET_PDN_TYPE_IPV4V6:
@@ -272,7 +278,38 @@ int esm_ebr_context_create(
                strcpy(broadcast, ipv4_addr);
              }
 
-             res = sprintf(command_line,
+             if(nfapi_mode ==3){
+                // this is for L2 FAPI simulator.
+                // change for multiple UE's like 256UEs.
+                // if it's made too many tables , OS may crush so we use one table.
+#ifdef PDCP_USE_NETLINK
+#ifdef UESIM_EXPANSION
+                uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2;
+                res = sprintf(command_line,
+                           "ifconfig oip%d %s netmask %s broadcast %s up && "
+                           "ip rule add from %s/24 table %d && "
+                           "ip rule add to %s/24 table %d && "
+                           "ip route add default dev oip%d table %d",
+                           inst_nic + 1, ipv4_addr, netmask, broadcast,
+                           ipv4_addr, 201,
+                           ipv4_addr, 201,
+                           inst_nic + 1, 201);
+
+               inst_pdcp_list[inst_nic] = ueid;
+#else
+               res = sprintf(command_line,
+                          "ifconfig oip%d %s netmask %s broadcast %s up && "
+                          "ip rule add from %s/32 table %d && "
+                          "ip rule add to %s/32 table %d && "
+                          "ip route add default dev oip%d table %d",
+                          ueid + 1, ipv4_addr, netmask, broadcast,
+                          ipv4_addr, ueid + 201,
+                          ipv4_addr, ueid + 201,
+                          ueid + 1, ueid + 201);
+#endif
+#endif
+             } else {
+               res = sprintf(command_line,
                            "ifconfig oip%d %s netmask %s broadcast %s up && "
                            "ip rule add from %s/32 table %d && "
                            "ip rule add to %s/32 table %d && "
@@ -281,6 +318,7 @@ int esm_ebr_context_create(
                            ipv4_addr, ueid + 201,
                            ipv4_addr, ueid + 201,
                            ueid + 1, ueid + 201);
+             }
              if ( res<0 ) {
                 LOG_TRACE(WARNING, "ESM-PROC  - Failed to system command string");
              }
diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c
index 529ac5e602b79a342932af73d3ec45a12cae06ab..6df66666389ce1c3f7f36163f51cccf0205b5249 100644
--- a/openair3/NAS/UE/nas_ue_task.c
+++ b/openair3/NAS/UE/nas_ue_task.c
@@ -40,7 +40,7 @@
 
 // FIXME review these externs
 extern unsigned char NB_eNB_INST;
-extern unsigned char NB_UE_INST;
+extern uint16_t NB_UE_INST;
 
 char *make_port_str_from_ueid(const char *base_port_str, int ueid);
 
diff --git a/openair3/SECU/key_nas_encryption.c b/openair3/SECU/key_nas_encryption.c
deleted file mode 100644
index aa641137efbf987111fceb5cf016319209c83679..0000000000000000000000000000000000000000
--- a/openair3/SECU/key_nas_encryption.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#include <string.h>
-#include "secu_defs.h"
-
-/*!
- * Derive the kNASenc from kasme and perform truncate on the generated key to
- * reduce his size to 128 bits. Definition of the derivation function can
- * be found in 3GPP TS.33401 #A.7
- * @param[in] nas_alg_type NAS algorithm distinguisher
- * @param[in] nas_enc_alg_id NAS encryption/integrity algorithm identifier.
- * Possible values are:
- *      - 0 for EIA0 algorithm (Null Integrity Protection algorithm)
- *      - 1 for 128-EIA1 SNOW 3G
- *      - 2 for 128-EIA2 AES
- * @param[in] kasme Key for MME as provided by AUC
- * @param[out] knas Truncated ouput key as derived by KDF
- */
-
-/*int derive_key_nas(algorithm_type_dist_t nas_alg_type, uint8_t nas_enc_alg_id,
-               const uint8_t kasme[32], uint8_t** knas)
-{
-    uint8_t s[7];
-    uint8_t knas_temp[32];
-
-    // FC
-    s[0] = 0x15;
-
-    // P0 = algorithm type distinguisher
-    s[1] = nas_alg_type & 0xFF;
-
-    // L0 = length(P0) = 1
-    s[2] = 0x00;
-    s[3] = 0x01;
-
-    // P1
-    s[4] = nas_enc_alg_id;
-
-    // L1 = length(P1) = 1
-    s[5] = 0x00;
-    s[6] = 0x01;
-
-    kdf((uint8_t*)kasme, 32, s, 7, (uint8_t**)&knas_temp, 32);
-
-    // Truncate the generate key to 128 bits
-    memcpy(knas, knas_temp, 16);
-
-    return 0;
-}
-*/
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.h b/openair3/TEST/EPC_TEST/generate_scenario.h
index 0f240f483d293b13a09ea48e87d74631d729c3e2..b2042a894cd54b7e96ce4169373429896e538d76 100644
--- a/openair3/TEST/EPC_TEST/generate_scenario.h
+++ b/openair3/TEST/EPC_TEST/generate_scenario.h
@@ -38,11 +38,7 @@
 #include "platform_constants.h"
 #include "PHY/impl_defs_lte.h"
 #include "s1ap_messages_types.h"
-#ifdef CMAKER
 #include "SystemInformationBlockType2.h"
-#else
-#include "RRC/LTE/MESSAGES/SystemInformationBlockType2.h"
-#endif
 
 #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
             struct in_addr inp;\
diff --git a/openair3/UTILS/mme_config.c b/openair3/UTILS/mme_config.c
deleted file mode 100644
index d2c25af10a25e5230cb69ac46e1ed9e3a5c0ea4d..0000000000000000000000000000000000000000
--- a/openair3/UTILS/mme_config.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * 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.1  (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
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <libconfig.h>
-
-#include <arpa/inet.h> /* To provide inet_addr */
-
-#include "intertask_interface.h"
-#include "assertions.h"
-#include "msc.h"
-#include "mme_config.h"
-#include "spgw_config.h"
-#include "intertask_interface_conf.h"
-
-mme_config_t mme_config;
-
-int mme_config_find_mnc_length(const char mcc_digit1P,
-                               const char mcc_digit2P,
-                               const char mcc_digit3P,
-                               const char mnc_digit1P,
-                               const char mnc_digit2P,
-                               const char mnc_digit3P)
-{
-
-  uint16_t mcc = 100*mcc_digit1P + 10*mcc_digit2P + mcc_digit3P;
-  uint16_t mnc3= 100*mnc_digit1P + 10*mnc_digit2P + mnc_digit3P;
-  uint16_t mnc2=                   10*mnc_digit1P + mnc_digit2P;
-  int  plmn_index = 0;
-
-  AssertFatal((mcc_digit1P >= 0) && (mcc_digit1P <= 9)
-              && (mcc_digit2P >= 0) && (mcc_digit2P <= 9)
-              && (mcc_digit3P >= 0) && (mcc_digit3P <= 9) ,
-              "BAD MCC PARAMETER (%d%d%d)!\n",
-              mcc_digit1P, mcc_digit2P, mcc_digit3P);
-
-  AssertFatal((mnc_digit2P >= 0) && (mnc_digit2P <= 9)
-              && (mnc_digit1P >= 0) && (mnc_digit1P <= 9) ,
-              "BAD MNC PARAMETER (%d.%d.%d)!\n",
-              mnc_digit1P, mnc_digit2P, mnc_digit3P);
-
-
-  while (plmn_index < mme_config.gummei.nb_plmns) {
-    if (mme_config.gummei.plmn_mcc[plmn_index] == mcc) {
-      if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc2) &&
-          (mme_config.gummei.plmn_mnc_len[plmn_index] == 2)) {
-        return 2;
-      } else if ((mme_config.gummei.plmn_mnc[plmn_index] == mnc3) &&
-                 (mme_config.gummei.plmn_mnc_len[plmn_index] == 3)) {
-        return 3;
-      }
-    }
-
-    plmn_index += 1;
-  }
-
-  return 0;
-}
-
-
-static
-void mme_config_init(mme_config_t *mme_config_p)
-{
-  memset(mme_config_p, 0, sizeof(mme_config_t));
-
-  pthread_rwlock_init(&mme_config_p->rw_lock, NULL);
-
-  mme_config_p->verbosity_level            = 0;
-  mme_config_p->config_file                = NULL;
-  mme_config_p->max_eNBs                   = MAX_NUMBER_OF_ENB;
-  mme_config_p->max_ues                    = MAX_NUMBER_OF_UE;
-
-  mme_config_p->emergency_attach_supported     = 0;
-  mme_config_p->unauthenticated_imsi_supported = 0;
-
-  /* Timer configuration */
-  mme_config_p->gtpv1u_config.port_number = GTPV1_U_PORT_NUMBER;
-  mme_config_p->s1ap_config.port_number   = S1AP_PORT_NUMBER;
-  /* IP configuration */
-  mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up     = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP);
-
-  mme_config_p->ipv4.mme_interface_name_for_S1_MME        = DEFAULT_MME_INTERFACE_NAME_FOR_S1_MME;
-  mme_config_p->ipv4.mme_ip_address_for_S1_MME            = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S1_MME);
-
-  mme_config_p->ipv4.mme_interface_name_for_S11           = DEFAULT_MME_INTERFACE_NAME_FOR_S11;
-  mme_config_p->ipv4.mme_ip_address_for_S11               = inet_addr(DEFAULT_MME_IP_ADDRESS_FOR_S11);
-
-  mme_config_p->ipv4.sgw_ip_address_for_S11               = inet_addr(DEFAULT_SGW_IP_ADDRESS_FOR_S11);
-
-  mme_config_p->s6a_config.conf_file    = S6A_CONF_FILE;
-
-  mme_config_p->itti_config.queue_size  = ITTI_QUEUE_MAX_ELEMENTS;
-  mme_config_p->itti_config.log_file    = NULL;
-
-  mme_config_p->sctp_config.in_streams  = SCTP_IN_STREAMS;
-  mme_config_p->sctp_config.out_streams = SCTP_OUT_STREAMS;
-
-  mme_config_p->relative_capacity = RELATIVE_CAPACITY;
-
-  mme_config_p->mme_statistic_timer = MME_STATISTIC_TIMER_S;
-
-  mme_config_p->gummei.nb_mme_gid = 1;
-  mme_config_p->gummei.mme_gid    = calloc(1, sizeof(*mme_config_p->gummei.mme_gid));
-  mme_config_p->gummei.mme_gid[0] = MMEGID;
-  mme_config_p->gummei.nb_mmec    = 1;
-  mme_config_p->gummei.mmec       = calloc(1, sizeof(*mme_config_p->gummei.mmec));
-  mme_config_p->gummei.mmec[0]    = MMEC;
-
-  /* Set the TAI */
-  mme_config_p->gummei.nb_plmns   = 1;
-  mme_config_p->gummei.plmn_mcc   = calloc(1, sizeof(*mme_config_p->gummei.plmn_mcc));
-  mme_config_p->gummei.plmn_mnc   = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc));
-  mme_config_p->gummei.plmn_mnc_len   = calloc(1, sizeof(*mme_config_p->gummei.plmn_mnc_len));
-  mme_config_p->gummei.plmn_tac   = calloc(1, sizeof(*mme_config_p->gummei.plmn_tac));
-
-
-  mme_config_p->gummei.plmn_mcc[0]     = PLMN_MCC;
-  mme_config_p->gummei.plmn_mnc[0]     = PLMN_MNC;
-  mme_config_p->gummei.plmn_mnc_len[0] = PLMN_MNC_LEN;
-  mme_config_p->gummei.plmn_tac[0]     = PLMN_TAC;
-
-  mme_config_p->s1ap_config.outcome_drop_timer_sec = S1AP_OUTCOME_TIMER_DEFAULT;
-}
-
-int mme_system(char *command_pP, int abort_on_errorP)
-{
-  int ret = -1;
-
-  if (command_pP) {
-    fprintf(stdout, "system command: %s\n",command_pP);
-    ret = system(command_pP);
-
-    if (ret < 0) {
-      fprintf(stderr, "ERROR in system command %s: %d\n",
-              command_pP,ret);
-
-      if (abort_on_errorP) {
-        exit(-1); // may be not exit
-      }
-    }
-  }
-
-  return ret;
-}
-
-
-static int config_parse_file(mme_config_t *mme_config_p)
-{
-  config_t          cfg;
-  config_setting_t *setting_mme                      = NULL;
-  config_setting_t *setting                          = NULL;
-  config_setting_t *subsetting                       = NULL;
-  config_setting_t *sub2setting                      = NULL;
-
-  long int         alongint;
-  int              i, num;
-  char             *astring                          = NULL;
-  char             *address                          = NULL;
-  char             *cidr                             = NULL;
-
-  const char*       tac                              = NULL;
-  const char*       mcc                              = NULL;
-  const char*       mnc                              = NULL;
-
-  char             *sgw_ip_address_for_S1u_S12_S4_up = NULL;
-  char             *mme_interface_name_for_S1_MME    = NULL;
-  char             *mme_ip_address_for_S1_MME        = NULL;
-  char             *mme_interface_name_for_S11       = NULL;
-  char             *mme_ip_address_for_S11           = NULL;
-  char             *sgw_ip_address_for_S11           = NULL;
-  char                system_cmd[256];
-
-  config_init(&cfg);
-
-  if(mme_config_p->config_file != NULL) {
-    /* Read the file. If there is an error, report it and exit. */
-    if(! config_read_file(&cfg, mme_config_p->config_file)) {
-      fprintf(stdout, "ERROR: %s:%d - %s\n", mme_config_p->config_file, config_error_line(&cfg), config_error_text(&cfg));
-      config_destroy(&cfg);
-      AssertFatal (1 == 0, "Failed to parse MME configuration file %s!\n", mme_config_p->config_file);
-    }
-  } else {
-    fprintf(stdout, "ERROR No MME configuration file provided!\n");
-    config_destroy(&cfg);
-    AssertFatal (0, "No MME configuration file provided!\n");
-  }
-
-  setting_mme = config_lookup(&cfg, MME_CONFIG_STRING_MME_CONFIG);
-
-  if(setting_mme != NULL) {
-    // GENERAL MME SETTINGS
-    if(  (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_REALM, (const char **)&astring) )) {
-      mme_config_p->realm = strdup(astring);
-      mme_config_p->realm_length = strlen(mme_config_p->realm);
-    }
-
-    if(  (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXENB, &alongint) )) {
-      mme_config_p->max_eNBs = (uint32_t)alongint;
-    }
-
-    if(  (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_MAXUE, &alongint) )) {
-      mme_config_p->max_ues = (uint32_t)alongint;
-    }
-
-    if(  (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_RELATIVE_CAPACITY, &alongint) )) {
-      mme_config_p->relative_capacity = (uint8_t)alongint;
-    }
-
-    if(  (config_setting_lookup_int( setting_mme, MME_CONFIG_STRING_STATISTIC_TIMER, &alongint) )) {
-      mme_config_p->mme_statistic_timer = (uint32_t)alongint;
-    }
-
-    if(  (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_EMERGENCY_ATTACH_SUPPORTED, (const char **)&astring) )) {
-      if (strcasecmp(astring , "yes") == 0)
-        mme_config_p->emergency_attach_supported = 1;
-      else
-        mme_config_p->emergency_attach_supported = 0;
-    }
-
-    if(  (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_UNAUTHENTICATED_IMSI_SUPPORTED, (const char **)&astring) )) {
-      if (strcasecmp(astring , "yes") == 0)
-        mme_config_p->unauthenticated_imsi_supported = 1;
-      else
-        mme_config_p->unauthenticated_imsi_supported = 0;
-    }
-
-    if(  (config_setting_lookup_string( setting_mme, MME_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
-      if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0)
-        mme_config_p->verbosity_level = 0;
-      else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0)
-        mme_config_p->verbosity_level = 2;
-      else if (strcasecmp(astring , MME_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0)
-        mme_config_p->verbosity_level = 1;
-      else
-        mme_config_p->verbosity_level = 0;
-    }
-
-    // ITTI SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_INTERTASK_INTERFACE_CONFIG);
-
-    if (setting != NULL) {
-      if(  (config_setting_lookup_int( setting, MME_CONFIG_STRING_INTERTASK_INTERFACE_QUEUE_SIZE, &alongint) )) {
-        mme_config_p->itti_config.queue_size = (uint32_t)alongint;
-      }
-    }
-
-    // S6A SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S6A_CONFIG);
-
-    if (setting != NULL) {
-      if(  (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_CONF_FILE_PATH, (const char **)&astring) )) {
-        if (astring != NULL)
-          mme_config_p->s6a_config.conf_file = strdup(astring);
-      }
-
-      if(  (config_setting_lookup_string( setting, MME_CONFIG_STRING_S6A_HSS_HOSTNAME, (const char **)&astring) )) {
-        if (astring != NULL)
-          mme_config_p->s6a_config.hss_host_name  = strdup(astring);
-        else
-          AssertFatal (1 == 0,
-                       "You have to provide a valid HSS hostname %s=...\n",
-                       MME_CONFIG_STRING_S6A_HSS_HOSTNAME);
-      }
-    }
-
-    // SCTP SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_SCTP_CONFIG);
-
-    if (setting != NULL) {
-      if(  (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_INSTREAMS, &alongint) )) {
-        mme_config_p->sctp_config.in_streams = (uint16_t)alongint;
-      }
-
-      if(  (config_setting_lookup_int( setting, MME_CONFIG_STRING_SCTP_OUTSTREAMS, &alongint) )) {
-        mme_config_p->sctp_config.out_streams = (uint16_t)alongint;
-      }
-    }
-
-    // S1AP SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_S1AP_CONFIG);
-
-    if (setting != NULL) {
-      if(  (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_OUTCOME_TIMER, &alongint) )) {
-        mme_config_p->s1ap_config.outcome_drop_timer_sec = (uint8_t)alongint;
-      }
-
-      if(  (config_setting_lookup_int( setting, MME_CONFIG_STRING_S1AP_PORT, &alongint) )) {
-        mme_config_p->s1ap_config.port_number = (uint16_t)alongint;
-      }
-    }
-
-    // GUMMEI SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_GUMMEI_CONFIG);
-
-    if (setting != NULL) {
-      subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_CODE);
-
-      if (subsetting != NULL) {
-        num     = config_setting_length(subsetting);
-
-        if (mme_config_p->gummei.nb_mmec != num) {
-          if (mme_config_p->gummei.mmec != NULL) {
-            free(mme_config_p->gummei.mmec);
-          }
-
-          mme_config_p->gummei.mmec = calloc(num, sizeof(*mme_config_p->gummei.mmec));
-        }
-
-        mme_config_p->gummei.nb_mmec = num;
-
-        for (i = 0; i < num; i++) {
-          mme_config_p->gummei.mmec[i] = config_setting_get_int_elem(subsetting, i);
-        }
-      }
-
-      subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_MME_GID);
-
-      if (subsetting != NULL) {
-        num     = config_setting_length(subsetting);
-
-        if (mme_config_p->gummei.nb_mme_gid != num) {
-          if (mme_config_p->gummei.mme_gid != NULL) {
-            free(mme_config_p->gummei.mme_gid);
-          }
-
-          mme_config_p->gummei.mme_gid = calloc(num, sizeof(*mme_config_p->gummei.mme_gid));
-        }
-
-        mme_config_p->gummei.nb_mme_gid = num;
-
-        for (i = 0; i < num; i++) {
-          mme_config_p->gummei.mme_gid[i] = config_setting_get_int_elem(subsetting, i);
-        }
-      }
-
-      subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_TAI_LIST);
-
-      if (subsetting != NULL) {
-        num     = config_setting_length(subsetting);
-
-        if (mme_config_p->gummei.nb_plmns != num) {
-          if (mme_config_p->gummei.plmn_mcc != NULL)     free(mme_config_p->gummei.plmn_mcc);
-
-          if (mme_config_p->gummei.plmn_mnc != NULL)     free(mme_config_p->gummei.plmn_mnc);
-
-          if (mme_config_p->gummei.plmn_mnc_len != NULL) free(mme_config_p->gummei.plmn_mnc_len);
-
-          if (mme_config_p->gummei.plmn_tac != NULL)     free(mme_config_p->gummei.plmn_tac);
-
-          mme_config_p->gummei.plmn_mcc     = calloc(num, sizeof(*mme_config_p->gummei.plmn_mcc));
-          mme_config_p->gummei.plmn_mnc     = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc));
-          mme_config_p->gummei.plmn_mnc_len = calloc(num, sizeof(*mme_config_p->gummei.plmn_mnc_len));
-          mme_config_p->gummei.plmn_tac     = calloc(num, sizeof(*mme_config_p->gummei.plmn_tac));
-        }
-
-        mme_config_p->gummei.nb_plmns = num;
-
-        for (i = 0; i < num; i++) {
-          sub2setting =  config_setting_get_elem(subsetting, i);
-
-          if (sub2setting != NULL) {
-            if(  (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MCC, &mcc) )) {
-              mme_config_p->gummei.plmn_mcc[i] = (uint16_t)atoi(mcc);
-            }
-
-            if(  (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_MNC, &mnc) )) {
-              mme_config_p->gummei.plmn_mnc[i] = (uint16_t)atoi(mnc);
-              mme_config_p->gummei.plmn_mnc_len[i] = strlen(mnc);
-              AssertFatal((mme_config_p->gummei.plmn_mnc_len[i] == 2) || (mme_config_p->gummei.plmn_mnc_len[i] == 3),
-                          "Bad MNC length %u, must be 2 or 3", mme_config_p->gummei.plmn_mnc_len[i]);
-            }
-
-            if(  (config_setting_lookup_string( sub2setting, MME_CONFIG_STRING_TAC, &tac) )) {
-              mme_config_p->gummei.plmn_tac[i] = (uint16_t)atoi(tac);
-              AssertFatal(mme_config_p->gummei.plmn_tac[i] != 0,
-                          "TAC must not be 0");
-            }
-          }
-        }
-      }
-    }
-
-    // NETWORK INTERFACE SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
-
-    if(setting != NULL) {
-      if(  (
-             config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S1_MME,
-                                           (const char **)&mme_interface_name_for_S1_MME)
-             && config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S1_MME,
-                                              (const char **)&mme_ip_address_for_S1_MME)
-             && config_setting_lookup_string( setting, MME_CONFIG_STRING_INTERFACE_NAME_FOR_S11_MME,
-                                              (const char **)&mme_interface_name_for_S11)
-             && config_setting_lookup_string( setting, MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S11_MME,
-                                              (const char **)&mme_ip_address_for_S11)
-           )
-        ) {
-        mme_config_p->ipv4.mme_interface_name_for_S1_MME = strdup(mme_interface_name_for_S1_MME);
-        cidr = strdup(mme_ip_address_for_S1_MME);
-        address = strtok(cidr, "/");
-        IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR MME S1_MME !\n" )
-        free(cidr);
-
-        mme_config_p->ipv4.mme_interface_name_for_S11 = strdup(mme_interface_name_for_S11);
-        cidr = strdup(mme_ip_address_for_S11);
-        address = strtok(cidr, "/");
-        IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.mme_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR MME S11 !\n" )
-        free(cidr);
-
-        if (strncasecmp("tun",mme_config_p->ipv4.mme_interface_name_for_S1_MME, strlen("tun")) == 0) {
-          if (snprintf(system_cmd, 256,
-                       "ip link set %s down ;openvpn --rmtun --dev %s",
-                       mme_config_p->ipv4.mme_interface_name_for_S1_MME,
-                       mme_config_p->ipv4.mme_interface_name_for_S1_MME
-                      ) > 0) {
-            mme_system(system_cmd, 1);
-          } else {
-            fprintf(stderr, "Del %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
-          }
-
-          if (snprintf(system_cmd, 256,
-                       "openvpn --mktun --dev %s;sync;ifconfig  %s up;sync",
-                       mme_config_p->ipv4.mme_interface_name_for_S1_MME,
-                       mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) {
-            mme_system(system_cmd, 1);
-          } else {
-            fprintf(stderr, "Create %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
-          }
-
-          if (snprintf(system_cmd, 256,
-                       "ip -4 addr add %s  dev %s",
-                       mme_ip_address_for_S1_MME,
-                       mme_config_p->ipv4.mme_interface_name_for_S1_MME) > 0) {
-            mme_system(system_cmd, 1);
-          } else {
-            fprintf(stderr, "Set IPv4 address on %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
-          }
-        }
-
-      }
-    }
-
-    // NAS SETTING
-    setting = config_setting_get_member (setting_mme, MME_CONFIG_STRING_NAS_CONFIG);
-
-    if (setting != NULL) {
-      subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_INTEGRITY_ALGORITHM_LIST);
-
-      if (subsetting != NULL) {
-        num     = config_setting_length(subsetting);
-
-        if (num <= 8) {
-          for (i = 0; i < num; i++) {
-            astring = config_setting_get_string_elem(subsetting, i);
-
-            if (strcmp("EIA0", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-            else if (strcmp("EIA1", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA1;
-            else if (strcmp("EIA2", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA2;
-            else if (strcmp("EIA3", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-            else if (strcmp("EIA4", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-            else if (strcmp("EIA5", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-            else if (strcmp("EIA6", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-            else if (strcmp("EIA7", astring) == 0) mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-          }
-
-          for (i = num; i < 8; i++) {
-            mme_config_p->nas_config.prefered_integrity_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EIA0;
-          }
-        }
-      }
-
-      subsetting = config_setting_get_member (setting, MME_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST);
-
-      if (subsetting != NULL) {
-        num     = config_setting_length(subsetting);
-
-        if (num <= 8) {
-          for (i = 0; i < num; i++) {
-            astring = config_setting_get_string_elem(subsetting, i);
-
-            if (strcmp("EEA0", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-            else if (strcmp("EEA1", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA1;
-            else if (strcmp("EEA2", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA2;
-            else if (strcmp("EEA3", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-            else if (strcmp("EEA4", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-            else if (strcmp("EEA5", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-            else if (strcmp("EEA6", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-            else if (strcmp("EEA7", astring) == 0) mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-          }
-
-          for (i = num; i < 8; i++) {
-            mme_config_p->nas_config.prefered_ciphering_algorithm[i] = NAS_CONFIG_SECURITY_ALGORITHMS_EEA0;
-          }
-        }
-      }
-
-    }
-  }
-
-  setting = config_lookup(&cfg, SGW_CONFIG_STRING_SGW_CONFIG);
-
-  if(setting != NULL) {
-    subsetting = config_setting_get_member (setting, SGW_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
-
-    if(subsetting != NULL) {
-      if(  (
-             config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP,
-                                           (const char **)&sgw_ip_address_for_S1u_S12_S4_up)
-             && config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11,
-                                              (const char **)&sgw_ip_address_for_S11)
-             && config_setting_lookup_int( subsetting, SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP, &alongint)
-           )
-        ) {
-        cidr = strdup(sgw_ip_address_for_S1u_S12_S4_up);
-        address = strtok(cidr, "/");
-        IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR SGW S1u_S12_S4 !\n" )
-        free(cidr);
-
-        cidr = strdup(sgw_ip_address_for_S11);
-        address = strtok(cidr, "/");
-        IPV4_STR_ADDR_TO_INT_NWBO ( address, mme_config_p->ipv4.sgw_ip_address_for_S11, "BAD IP ADDRESS FORMAT FOR SGW S11 !\n" )
-        free(cidr);
-
-        mme_config_p->gtpv1u_config.port_number = (uint16_t) alongint;
-      }
-    }
-  }
-
-  return 0;
-}
-
-#define DISPLAY_ARRAY(size, format, args...)                        \
-do {                                                                \
-    int i;                                                          \
-    for (i = 0; i < size; i++) {                                    \
-        fprintf(stdout, format, args);                              \
-        if ((i != (size - 1)) && ((i + 1) % 10 == 0))               \
-        {                                                           \
-            fprintf(stdout, "\n        ");                          \
-        }                                                           \
-    }                                                               \
-    if (i > 0)                                                      \
-        fprintf(stdout, "\n");                                      \
-} while(0)
-
-static void config_display(mme_config_t *mme_config_p)
-{
-  int j;
-
-  fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION);
-  fprintf(stdout, "Configuration:\n");
-  fprintf(stdout, "- File ...............: %s\n", mme_config_p->config_file);
-  fprintf(stdout, "- Verbosity level ....: %d\n", mme_config_p->verbosity_level);
-  fprintf(stdout, "- Realm ..............: %s\n", mme_config_p->realm);
-  fprintf(stdout, "- Max eNBs ...........: %u\n", mme_config_p->max_eNBs);
-  fprintf(stdout, "- Max UEs ............: %u\n", mme_config_p->max_ues);
-  fprintf(stdout, "- Emergency support ..: %s\n", mme_config_p->emergency_attach_supported == 0 ? "FALSE" : "TRUE");
-  fprintf(stdout, "- Unauth IMSI support : %s\n", mme_config_p->unauthenticated_imsi_supported == 0 ? "FALSE" : "TRUE");
-  fprintf(stdout, "- Relative capa ......: %u\n\n", mme_config_p->relative_capacity);
-  fprintf(stdout, "- Statistics timer ...: %u (seconds)\n\n", mme_config_p->mme_statistic_timer);
-  fprintf(stdout, "- S1-U:\n");
-  fprintf(stdout, "    port number ......: %d\n", mme_config_p->gtpv1u_config.port_number);
-  fprintf(stdout, "- S1-MME:\n");
-  fprintf(stdout, "    port number ......: %d\n", mme_config_p->s1ap_config.port_number);
-  fprintf(stdout, "- IP:\n");
-  //fprintf(stdout, "    s1-u iface .......: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up);
-  fprintf(stdout, "    s1-u ip ..........: %s\n",
-          inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up)));
-  //fprintf(stdout, "    sgi iface ........: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI);
-  //fprintf(stdout, "    sgi ip ...........: %s/%d\n",
-  //        inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.pgw_ip_addr_for_SGI)),
-  //        mme_config_p->ipv4.pgw_ip_netmask_for_SGI);
-  fprintf(stdout, "    s1-MME iface .....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
-  fprintf(stdout, "    s1-MME ip ........: %s\n",
-          inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S1_MME)));
-  //fprintf(stdout, "    s11 S-GW iface ...: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S11);
-  //fprintf(stdout, "    s11 S-GW ip ......: %s/%d\n",
-  //        inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S11)),
-  //        mme_config_p->ipv4.sgw_ip_netmask_for_S11);
-  fprintf(stdout, "    s11 MME iface ....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S11);
-  fprintf(stdout, "    s11 S-GW ip ......: %s\n",
-          inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S11)));
-  fprintf(stdout, "- ITTI:\n");
-  fprintf(stdout, "    queue size .......: %u (bytes)\n", mme_config_p->itti_config.queue_size);
-  fprintf(stdout, "    log file .........: %s\n", mme_config_p->itti_config.log_file);
-  fprintf(stdout, "- SCTP:\n");
-  fprintf(stdout, "    in streams .......: %u\n", mme_config_p->sctp_config.in_streams);
-  fprintf(stdout, "    out streams ......: %u\n", mme_config_p->sctp_config.out_streams);
-  fprintf(stdout, "- GUMMEI:\n");
-  fprintf(stdout, "    mme group ids ....:\n        ");
-  DISPLAY_ARRAY(mme_config_p->gummei.nb_mme_gid, "| %u ", mme_config_p->gummei.mme_gid[i]);
-  fprintf(stdout, "    mme codes ........:\n        ");
-  DISPLAY_ARRAY(mme_config_p->gummei.nb_mmec, "| %u ", mme_config_p->gummei.mmec[i]);
-  fprintf(stdout, "    plmns ............: (mcc.mnc:tac)\n");
-
-  for (j= 0; j < mme_config_p->gummei.nb_plmns; j++) {
-    if (mme_config_p->gummei.plmn_mnc_len[j] ==2 ) {
-      fprintf(stdout, "            %3u.%3u:%u\n",
-              mme_config_p->gummei.plmn_mcc[j],
-              mme_config_p->gummei.plmn_mnc[j],
-              mme_config_p->gummei.plmn_tac[j]);
-    } else {
-      fprintf(stdout, "            %3u.%03u:%u\n",
-              mme_config_p->gummei.plmn_mcc[j],
-              mme_config_p->gummei.plmn_mnc[j],
-              mme_config_p->gummei.plmn_tac[j]);
-    }
-  }
-
-  fprintf(stdout, "- S6A:\n");
-  fprintf(stdout, "    conf file ........: %s\n", mme_config_p->s6a_config.conf_file);
-}
-
-static void usage(void)
-{
-  fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION);
-  fprintf(stdout, "Please report any bug to: %s\n\n", PACKAGE_BUGREPORT);
-  fprintf(stdout, "Usage: oaisim_mme [options]\n\n");
-  fprintf(stdout, "Available options:\n");
-  fprintf(stdout, "-h      Print this help and return\n");
-  fprintf(stdout, "-c<path>\n");
-  fprintf(stdout, "        Set the configuration file for mme\n");
-  fprintf(stdout, "        See template in UTILS/CONF\n");
-  fprintf(stdout, "-K<file>\n");
-  fprintf(stdout, "        Output intertask messages to provided file\n");
-  fprintf(stdout, "-V      Print %s version and return\n", PACKAGE_NAME);
-  fprintf(stdout, "-v[1-2] Debug level:\n");
-  fprintf(stdout, "            1 -> ASN1 XER printf on and ASN1 debug off\n");
-  fprintf(stdout, "            2 -> ASN1 XER printf on and ASN1 debug on\n");
-}
-
-extern void
-nwGtpv1uDisplayBanner(void);
-
-int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p)
-{
-  int c;
-  mme_config_init(mme_config_p);
-
-  /* Parsing command line */
-  while ((c = getopt (argc, argv, "O:c:hi:K:v:V")) != -1) {
-    switch (c) {
-    case 'O':
-    case 'c': {
-      /* Store the given configuration file. If no file is given,
-       * then the default values will be used.
-       */
-      int config_file_len = 0;
-      config_file_len = strlen(optarg);
-      mme_config_p->config_file = malloc(sizeof(char) * (config_file_len + 1));
-      memcpy(mme_config_p->config_file, optarg, config_file_len);
-      mme_config_p->config_file[config_file_len] = '\0';
-    }
-    break;
-
-    case 'v': {
-      mme_config_p->verbosity_level = atoi(optarg);
-    }
-    break;
-
-    case 'V': {
-      fprintf(stdout, "==== EURECOM %s v%s ====\n"
-              "Please report any bug to: %s\n", PACKAGE_NAME, PACKAGE_VERSION,
-              PACKAGE_BUGREPORT);
-      exit(0);
-      nwGtpv1uDisplayBanner();
-    }
-    break;
-
-    case 'K':
-      mme_config_p->itti_config.log_file = strdup(optarg);
-      break;
-
-    case 'h': /* Fall through */
-    default:
-      usage();
-      exit(0);
-    }
-  }
-
-  /* Parse the configuration file using libconfig */
-  if (config_parse_file(mme_config_p) != 0) {
-    return -1;
-  }
-
-  /* Display the configuration */
-  config_display(mme_config_p);
-  return 0;
-}
diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
index 32fddb9c2dcffcb811fdbe4136c3da45fa5e0be0..b0f131de9178dacdf06f252325fd3da7e7b2e7d3 100644
--- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
+++ b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
@@ -8,33 +8,47 @@
 #include <unistd.h>
 #include <errno.h>
 
-int fullread(int fd, void *_buf, int count)
-{
+const int port = 4043;
+#define helpTxt "\
+\x1b[31m\
+tcp_bridge: error: you have to run one UE and one eNB\n\
+For this, export TCPBRIDGE=enb (eNB case) or \n\
+                 TCPBRIDGE=<an ip address> (UE case)\n\
+\x1b[m"
+
+int fullread(int fd, void *_buf, int count) {
   char *buf = _buf;
   int ret = 0;
   int l;
+
   while (count) {
     l = read(fd, buf, count);
+
     if (l <= 0) return -1;
+
     count -= l;
     buf += l;
     ret += l;
   }
+
   return ret;
 }
 
-int fullwrite(int fd, void *_buf, int count)
-{
+int fullwrite(int fd, void *_buf, int count) {
   char *buf = _buf;
   int ret = 0;
   int l;
+
   while (count) {
     l = write(fd, buf, count);
+
     if (l <= 0) return -1;
+
     count -= l;
     buf += l;
     ret += l;
   }
+
   return ret;
 }
 
@@ -46,155 +60,208 @@ typedef struct {
   uint64_t timestamp;
   uint64_t next_tx_timestamp;
   int is_enb;
+  char *ip;
 } tcp_bridge_state_t;
 
-void verify_connection(int fd, int is_enb)
-{
+void verify_connection(int fd, int is_enb) {
   char c = is_enb;
+
   if (fullwrite(fd, &c, 1) != 1) exit(1);
+
   if (fullread(fd, &c, 1) != 1) exit(1);
+
   if (c == is_enb) {
-    printf("\x1b[31mtcp_bridge: error: you have to run one UE and one eNB"
-           " (did you run 'export ENODEB=1' in the eNB terminal?)\x1b[m\n");
+    printf(helpTxt);
     exit(1);
   }
 }
 
-int tcp_bridge_start(openair0_device *device)
-{
-  int port = 4043;
-  tcp_bridge_state_t *tcp_bridge = device->priv;
-  int try;
-  int max_try = 5;
-
-  int sock = socket(AF_INET, SOCK_STREAM, 0);
-  if (sock == -1) { perror("tcp_bridge: socket"); exit(1); }
-
-  int enable = 1;
-  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)))
-    { perror("tcp_bridge: SO_REUSEADDR"); exit(1); }
 
+int start_enb(tcp_bridge_state_t *tcp_bridge) {
   struct sockaddr_in addr = {
-    sin_family: AF_INET,
-    sin_port: htons(port),
-    sin_addr: { s_addr: INADDR_ANY }
+sin_family:
+    AF_INET,
+sin_port:
+    htons(port),
+sin_addr:
+    { s_addr: INADDR_ANY }
   };
 
-  if (bind(sock, (struct sockaddr *)&addr, sizeof(addr))) {
-    if (errno == EADDRINUSE) goto client_mode;
-    { perror("tcp_bridge: bind"); exit(1); }
+  if (bind(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr))) {
+    perror("tcp_bridge: bind");
+    exit(1);
   }
 
-  if (listen(sock, 5))
-    { perror("tcp_bridge: listen"); exit(1); }
+  if (listen(tcp_bridge->sock, 5)) {
+    perror("tcp_bridge: listen");
+    exit(1);
+  }
 
   printf("tcp_bridge: wait for connection on port %d\n", port);
-
   socklen_t len = sizeof(addr);
-  int sock2 = accept(sock, (struct sockaddr *)&addr, &len);
-  if (sock2 == -1)
-    { perror("tcp_bridge: accept"); exit(1); }
-
-  close(sock);
+  int sockServ = accept(tcp_bridge->sock, (struct sockaddr *)&addr, &len);
 
-  tcp_bridge->sock = sock2;
+  if ( sockServ == -1) {
+    perror("tcp_bridge: accept");
+    exit(1);
+  }
 
+  verify_connection(sockServ, tcp_bridge->is_enb);
   printf("tcp_bridge: connection established\n");
-
-  verify_connection(sock2, tcp_bridge->is_enb);
-
+  close(tcp_bridge->sock);
+  tcp_bridge->sock=sockServ;
   return 0;
+}
 
-client_mode:
-  addr.sin_addr.s_addr = inet_addr("127.0.0.1");
-
-  for (try = 0; try < max_try; try++) {
-    if (try != 0) sleep(1);
+int start_ue(tcp_bridge_state_t *tcp_bridge) {
+struct sockaddr_in addr = {sin_family:
+    AF_INET,
+sin_port:
+    htons(port),
+sin_addr:
+    { s_addr: INADDR_ANY }
+  };
+  addr.sin_addr.s_addr = inet_addr(tcp_bridge->ip);
 
-    printf("tcp_bridge: trying to connect to 127.0.0.1:%d (attempt %d/%d)\n",
-           port, try+1, max_try);
+  while(1) {
+    printf("tcp_bridge: trying to connect to %s:%d\n", tcp_bridge->ip, port);
 
-    if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
+    if (connect(tcp_bridge->sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
+      verify_connection(tcp_bridge->sock, tcp_bridge->is_enb);
       printf("tcp_bridge: connection established\n");
-      tcp_bridge->sock = sock;
-      verify_connection(sock, tcp_bridge->is_enb);
       return 0;
     }
 
     perror("tcp_bridge");
+    sleep(1);
+  }
+
+  return 0;
+}
+
+int tcp_bridge_start(openair0_device *device) {
+  tcp_bridge_state_t *tcp_bridge = device->priv;
+  tcp_bridge->sock = socket(AF_INET, SOCK_STREAM, 0);
+
+  if (tcp_bridge->sock == -1) {
+    perror("tcp_bridge: socket");
+    exit(1);
   }
 
-  printf("tcp_bridge: connection failed\n");
+  int enable = 1;
+
+  if (setsockopt(tcp_bridge->sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int))) {
+    perror("tcp_bridge: SO_REUSEADDR");
+    exit(1);
+  }
 
-  exit(1);
+  if ( tcp_bridge->is_enb )
+    return start_enb(tcp_bridge);
+  else
+    return start_ue(tcp_bridge);
 }
 
-int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; }
-int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) { abort(); return 0; }
-int tcp_bridge_get_stats(openair0_device* device) { return 0; }
-int tcp_bridge_reset_stats(openair0_device* device) { return 0; }
+int tcp_bridge_request(openair0_device *device, void *msg, ssize_t msg_len) {
+  abort();
+  return 0;
+}
+int tcp_bridge_reply(openair0_device *device, void *msg, ssize_t msg_len) {
+  abort();
+  return 0;
+}
+int tcp_bridge_get_stats(openair0_device *device) {
+  return 0;
+}
+int tcp_bridge_reset_stats(openair0_device *device) {
+  return 0;
+}
 void tcp_bridge_end(openair0_device *device) {}
-int tcp_bridge_stop(openair0_device *device) { return 0; }
-int tcp_bridge_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,int exmimo_dump_config) { return 0; }
-int tcp_bridge_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { return 0; }
+int tcp_bridge_stop(openair0_device *device) {
+  return 0;
+}
+int tcp_bridge_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,int exmimo_dump_config) {
+  return 0;
+}
+int tcp_bridge_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
+  return 0;
+}
+
+int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
+  if (cc != 1) {
+    printf("tcp_bridge: only 1 antenna supported\n");
+    exit(1);
+  }
 
-int tcp_bridge_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
-{
-  if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); }
   tcp_bridge_state_t *t = device->priv;
+
   /* deal with discontinuities in output (think: eNB in TDD mode) */
   if (t->next_tx_timestamp && timestamp != t->next_tx_timestamp) {
     uint32_t b[4096];
     uint64_t to_send = timestamp - t->next_tx_timestamp;
     memset(b, 0, 4096 * sizeof(uint32_t));
+
     while (to_send) {
       int len = to_send > 4096 ? 4096 : to_send;
       int n = fullwrite(t->sock, b, len * 4);
+
       if (n != len * 4) {
         printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno));
         abort();
       }
+
       to_send -= len;
     }
   }
+
   int n = fullwrite(t->sock, buff[0], nsamps * 4);
+
   if (n != nsamps * 4) {
     printf("tcp_bridge: write error ret %d (wanted %d) error %s\n", n, nsamps*4, strerror(errno));
     abort();
   }
+
   t->next_tx_timestamp = timestamp + nsamps;
   return nsamps;
 }
 
-int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc)
-{
-  if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); }
+int tcp_bridge_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
+  if (cc != 1) {
+    printf("tcp_bridge: only 1 antenna supported\n");
+    exit(1);
+  }
+
   tcp_bridge_state_t *t = device->priv;
   int n = fullread(t->sock, buff[0], nsamps * 4);
+
   if (n != nsamps * 4) {
     printf("tcp_bridge: read error ret %d nsamps*4 %d error %s\n", n, nsamps * 4, strerror(errno));
     abort();
   }
+
   *timestamp = t->timestamp;
   t->timestamp += nsamps;
   return nsamps;
 }
 
-int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc)
-{
-  if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); }
+int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
+  if (cc != 1) {
+    printf("tcp_bridge: only 1 antenna supported\n");
+    exit(1);
+  }
+
   tcp_bridge_state_t *t = device->priv;
   int n;
 
   /* In synch mode, UE does not write, but we need to
-   * send something to the eNodeB.
-   * We know that UE is in synch mode when it reads
-   * 10 subframes at a time.
-   */
+     send something to the eNodeB.
+     We know that UE is in synch mode when it reads
+     10 subframes at a time.
+  */
   if (nsamps == t->samples_per_subframe * 10) {
     uint32_t b[nsamps];
     memset(b, 0, nsamps * 4);
     n = fullwrite(t->sock, b, nsamps * 4);
+
     if (n != nsamps * 4) {
       printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno));
       abort();
@@ -205,96 +272,106 @@ int tcp_bridge_read_ue(openair0_device *device, openair0_timestamp *timestamp, v
 }
 
 /* To startup proper communcation between eNB and UE,
- * we need to understand that:
- * - eNodeB starts reading subframe 0
- * - then eNodeB starts sending subframe 4
- * and then repeats read/write for each subframe.
- * The UE:
- * - reads 10 subframes at a time until it is synchronized
- * - then reads subframe n and writes subframe n+2
- * We also want to enforce that the subframe 0 is read
- * at the beginning of the UE RX buffer, not in the middle
- * of it.
- * So it means:
- * - for the eNodeB: let it run as in normal mode (as with a B210)
- * - for the UE, on its very first read:
- *   - we want this read to get data from subframe 0
- *     but the first write of eNodeB is subframe 4
- *     so we first need to read and ignore 6 subframes
- *   - the UE will start its TX only at the subframe 2
- *     corresponding to the subframe 0 it just read,
- *     so we need to write 12 subframes before anything
- *     (the function tcp_bridge_read_ue takes care to
- *     insert dummy TX data during the synch phase)
- *
- * Here is a drawing of the beginning of things to make
- * this logic clearer.
- *
- * We see that eNB starts RX at subframe 0, starts TX at subfram 4,
- * and that UE starts RX at subframe 10 and TX at subframe 12.
- *
- * We understand that the UE has to transmit 12 empty
- * subframes for the eNodeB to start its processing.
- *
- * And because the eNodeB starts its TX at subframe 4 and we
- * want the UE to start its RX at subframe 10, we need to
- * read and ignore 6 subframes in the UE.
- *
- *          -------------------------------------------------------------------------
- * eNB RX:  | *0* | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 |  10  | 11 |  12  | 13 | 14 ...
- *          -------------------------------------------------------------------------
- *
- *          -------------------------------------------------------------------------
- * eNB TX:  |  0  | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 |  10  | 11 |  12  | 13 | 14 ...
- *          -------------------------------------------------------------------------
- *
- *          -------------------------------------------------------------------------
- * UE RX:   |  0  | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 | *10* | 11 |  12  | 13 | 14 ...
- *          -------------------------------------------------------------------------
- *
- *          -------------------------------------------------------------------------
- * UE TX:   |  0  | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 |  10  | 11 | *12* | 13 | 14 ...
- *          -------------------------------------------------------------------------
- *
- * As a final note, we do TX before RX to ensure that the eNB will
- * get some data and send us something so there is no deadlock
- * at the beginning of things. Hopefully the kernel buffers for
- * the sockets are big enough so that the first (big) TX can
- * return to user mode before the buffers are full. If this
- * is wrong in some environment, we will need to work by smaller
- * units of data at a time.
- */
-int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc)
-{
-  if (cc != 1) { printf("tcp_bridge: only 1 antenna supported\n"); exit(1); }
-  tcp_bridge_state_t *t = device->priv;
+   we need to understand that:
+   - eNodeB starts reading subframe 0
+   - then eNodeB starts sending subframe 4
+   and then repeats read/write for each subframe.
+   The UE:
+   - reads 10 subframes at a time until it is synchronized
+   - then reads subframe n and writes subframe n+2
+   We also want to enforce that the subframe 0 is read
+   at the beginning of the UE RX buffer, not in the middle
+   of it.
+   So it means:
+   - for the eNodeB: let it run as in normal mode (as with a B210)
+   - for the UE, on its very first read:
+     - we want this read to get data from subframe 0
+       but the first write of eNodeB is subframe 4
+       so we first need to read and ignore 6 subframes
+     - the UE will start its TX only at the subframe 2
+       corresponding to the subframe 0 it just read,
+       so we need to write 12 subframes before anything
+       (the function tcp_bridge_read_ue takes care to
+       insert dummy TX data during the synch phase)
+
+   Here is a drawing of the beginning of things to make
+   this logic clearer.
+
+   We see that eNB starts RX at subframe 0, starts TX at subfram 4,
+   and that UE starts RX at subframe 10 and TX at subframe 12.
+
+   We understand that the UE has to transmit 12 empty
+   subframes for the eNodeB to start its processing.
+
+   And because the eNodeB starts its TX at subframe 4 and we
+   want the UE to start its RX at subframe 10, we need to
+   read and ignore 6 subframes in the UE.
+
+            -------------------------------------------------------------------------
+   eNB RX:  | *0* | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 |  10  | 11 |  12  | 13 | 14 ...
+            -------------------------------------------------------------------------
+
+            -------------------------------------------------------------------------
+   eNB TX:  |  0  | 1 | 2 | 3 | *4* | 5 | 6 | 7 | 8 | 9 |  10  | 11 |  12  | 13 | 14 ...
+            -------------------------------------------------------------------------
+
+            -------------------------------------------------------------------------
+   UE RX:   |  0  | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 | *10* | 11 |  12  | 13 | 14 ...
+            -------------------------------------------------------------------------
+
+            -------------------------------------------------------------------------
+   UE TX:   |  0  | 1 | 2 | 3 |  4  | 5 | 6 | 7 | 8 | 9 |  10  | 11 | *12* | 13 | 14 ...
+            -------------------------------------------------------------------------
+
+   As a final note, we do TX before RX to ensure that the eNB will
+   get some data and send us something so there is no deadlock
+   at the beginning of things. Hopefully the kernel buffers for
+   the sockets are big enough so that the first (big) TX can
+   return to user mode before the buffers are full. If this
+   is wrong in some environment, we will need to work by smaller
+   units of data at a time.
+*/
+int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
+  if (cc != 1) {
+    printf("tcp_bridge: only 1 antenna supported\n");
+    exit(1);
+  }
 
+  tcp_bridge_state_t *t = device->priv;
   uint32_t b[t->samples_per_subframe * 12];
   memset(b, 0, t->samples_per_subframe * 12 * 4);
   int n = fullwrite(t->sock, b, t->samples_per_subframe * 12 * 4);
+
   if (n != t->samples_per_subframe * 12 * 4) {
     printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno));
     abort();
   }
+
   n = fullread(t->sock, b, t->samples_per_subframe * 6 * 4);
+
   if (n != t->samples_per_subframe * 6 * 4) {
     printf("tcp_bridge: read error ret %d error %s\n", n, strerror(errno));
     abort();
   }
 
   device->trx_read_func = tcp_bridge_read_ue;
-
   return tcp_bridge_read_ue(device, timestamp, buff, nsamps, cc);
 }
 
 __attribute__((__visibility__("default")))
-int device_init(openair0_device* device, openair0_config_t *openair0_cfg)
-{
-  tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t*)malloc(sizeof(tcp_bridge_state_t));
-  memset(tcp_bridge, 0, sizeof(tcp_bridge_state_t));
-
-  tcp_bridge->is_enb = getenv("ENODEB") != NULL;
+int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
+  tcp_bridge_state_t *tcp_bridge = (tcp_bridge_state_t *)calloc(sizeof(tcp_bridge_state_t),1);
+
+  if ((tcp_bridge->ip=getenv("TCPBRIDGE")) == NULL ) {
+    /* for compatibility, we test the ENB environment variable */
+    if ((tcp_bridge->ip=getenv("ENODEB")) != NULL ) {
+      tcp_bridge->ip=strdup("enb");
+    } else {
+      tcp_bridge->ip=strdup("127.0.0.1");
+    }
+  }
 
+  tcp_bridge->is_enb = strncasecmp(tcp_bridge->ip,"enb",3) == 0;
   printf("tcp_bridge: running as %s\n", tcp_bridge->is_enb ? "eNB" : "UE");
 
   /* only 25, 50 or 100 PRBs handled for the moment */
@@ -323,15 +400,21 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg)
   device->priv = tcp_bridge;
 
   switch ((int)openair0_cfg[0].sample_rate) {
-  case 30720000: tcp_bridge->samples_per_subframe = 30720; break;
-  case 15360000: tcp_bridge->samples_per_subframe = 15360; break;
-  case 7680000:  tcp_bridge->samples_per_subframe = 7680; break;
+    case 30720000:
+      tcp_bridge->samples_per_subframe = 30720;
+      break;
+
+    case 15360000:
+      tcp_bridge->samples_per_subframe = 15360;
+      break;
+
+    case 7680000:
+      tcp_bridge->samples_per_subframe = 7680;
+      break;
   }
 
   /* let's pretend to be a b2x0 */
   device->type = USRP_B200_DEV;
-
   device->openair0_cfg=&openair0_cfg[0];
-
   return 0;
 }
diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h
index 1c27f655851f12b0d58eab503ca6e4e52346fc4a..644952ca794a041a046d86efdf054ccaff1b7c39 100644
--- a/targets/COMMON/openairinterface5g_limits.h
+++ b/targets/COMMON/openairinterface5g_limits.h
@@ -5,8 +5,18 @@
 #        define NUMBER_OF_eNB_MAX 1
 #        define NUMBER_OF_RU_MAX 2
 #        ifndef UE_EXPANSION
+// TODO:L2 FAPI simulator.
+// UESIM_EXPANSION is used to be same value of NUMBER_OF_UE_MAX
+// in eNB and UE.
+// now , if we use --mu option in UE, compiling error will occur.
+// This problem will be fixed in the future.
+#            ifndef UESIM_EXPANSION
 #                define NUMBER_OF_UE_MAX 16
 #                define NUMBER_OF_CONNECTED_eNB_MAX 3
+#            else
+#                define NUMBER_OF_UE_MAX 256
+#                define NUMBER_OF_CONNECTED_eNB_MAX 1
+#            endif
 #        else
 #                define NUMBER_OF_UE_MAX 256
 #                define NUMBER_OF_CONNECTED_eNB_MAX 1
@@ -15,8 +25,18 @@
 #        define NUMBER_OF_eNB_MAX 7
 #        define NUMBER_OF_RU_MAX 32
 #        ifndef UE_EXPANSION
-#                define NUMBER_OF_UE_MAX 20
+/* if the value of MAX_MOBILES_PER_ENB and NUMBER_OF_UE_MAX is different,
+eNB process will exit because unexpected access happens.
+Now some parts are using NUMBER_OF_UE_MAX
+and the other are using MAX_MOBILES_PER_ENB in for-loop.
+*/
+#            ifndef UESIM_EXPANSION
+#                define NUMBER_OF_UE_MAX 16
 #                define NUMBER_OF_CONNECTED_eNB_MAX 3
+#            else
+#                define NUMBER_OF_UE_MAX 256
+#                define NUMBER_OF_CONNECTED_eNB_MAX 1
+#            endif
 #        else
 #                define NUMBER_OF_UE_MAX 256
 #                define NUMBER_OF_CONNECTED_eNB_MAX 1
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
index ced031163d242aef51b065bf8a73cdc5142547cc..472d84c7e2319d84d3436081f91839cd44b72160 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf
@@ -172,7 +172,7 @@ eNBs =
 
 
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "127.0.0.3";
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
@@ -181,14 +181,24 @@ eNBs =
 
     NETWORK_INTERFACES :
     {
-        ENB_INTERFACE_NAME_FOR_S1_MME            = "lo";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "127.0.0.2/24";
-        ENB_INTERFACE_NAME_FOR_S1U               = "lo";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "127.0.0.5/24";
+        #ENB_INTERFACE_NAME_FOR_S1_MME            = "lo";
+        #ENB_IPV4_ADDRESS_FOR_S1_MME              = "127.0.0.2/24";
+        #ENB_INTERFACE_NAME_FOR_S1U               = "lo";
+        #ENB_IPV4_ADDRESS_FOR_S1U                 = "127.0.0.5/24";
+        #ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
+
+        #ENB_IPV4_ADDRESS_FOR_X2C                 = "127.0.0.2/24";
+        #ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+        
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "enp0s31f6";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.188/24";
+        ENB_INTERFACE_NAME_FOR_S1U               = "enp0s31f6";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.188/24";
         ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
-
-        ENB_IPV4_ADDRESS_FOR_X2C                 = "127.0.0.2/24";
+        
+        ENB_IPV4_ADDRESS_FOR_X2C                 = "192.168.12.188/24";
         ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+        
     };
   }
 );
@@ -196,7 +206,7 @@ eNBs =
 MACRLCs = (
 	{
 	num_cc = 1;
-      	local_s_if_name  = "lo";			  
+      	local_s_if_name  = "lo:";			  
       	remote_s_address = "127.0.0.1";
     	local_s_address  = "127.0.0.2"; 
     	local_s_portc    = 50001;	
diff --git a/targets/RT/USER/.ue.nvram b/targets/RT/USER/.ue.nvram
deleted file mode 100644
index 17469c87add15bffcfe07e54a19cd93743f18818..0000000000000000000000000000000000000000
Binary files a/targets/RT/USER/.ue.nvram and /dev/null differ
diff --git a/targets/RT/USER/.ue_emm.nvram b/targets/RT/USER/.ue_emm.nvram
deleted file mode 100644
index e858ba8cce57931e7fdf05ce434c22cd6bb6daa5..0000000000000000000000000000000000000000
Binary files a/targets/RT/USER/.ue_emm.nvram and /dev/null differ
diff --git a/targets/RT/USER/.usim.nvram b/targets/RT/USER/.usim.nvram
deleted file mode 100644
index 4e9adcd0d341f8826310a2c6a95a7f518dc14d97..0000000000000000000000000000000000000000
Binary files a/targets/RT/USER/.usim.nvram and /dev/null differ
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index cc25ca088535774423a57d2f57bbe069f52bf740..9db1684bd27b7c351d7459d0319d6ab649f3608d 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -164,6 +164,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
 
   // *******************************************************************
 
+#if defined(PRE_SCD_THREAD)
+    RU_t *ru = RC.ru[0];
+#endif
+
   if (nfapi_mode == 1) {
     // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
     uint16_t frame = proc->frame_rx;
@@ -218,6 +222,40 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 );
 
+#if defined(PRE_SCD_THREAD)
+    if (nfapi_mode == 2){
+      new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
+      dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
+
+// L2-emulator can work only one eNB.
+//      memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
+//      memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
+      memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
+      memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
+
+      if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) {
+          LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n");
+          exit_fun("error locking mutex_time");
+      }
+
+      ru->proc.instance_pre_scd++;
+
+      if (ru->proc.instance_pre_scd == 0) {
+          if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) {
+              LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" );
+              exit_fun( "ERROR pthread_cond_signal cond_pre_scd" );
+          }
+      }else{
+          LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n",
+                 proc->frame_rx,proc->subframe_rx,ru->proc.instance_pre_scd );
+      }
+
+      if (pthread_mutex_unlock(&ru->proc.mutex_pre_scd)!= 0) {
+          LOG_E( PHY, "[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n");
+          exit_fun("error unlocking mutex_pre_scd");
+      }
+    }
+#endif
 
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
   eNB->UL_INFO.frame     = proc->frame_rx;
@@ -906,6 +944,12 @@ void init_eNB_proc(int inst) {
     if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) {
       pthread_create( &L1_proc->pthread, attr0, L1_thread, proc );
       pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc);
+    } else if (nfapi_mode == 2) { // this is neccesary in VNF or L2 FAPI simulator.
+      // Original Code from Fujitsu w/ old structure/field name
+      //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
+      //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
+      pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc );
+      pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx);
     }
 
     pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB );
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 7df0a8c623524d08eb62da5a1201e8ee8c251140..ddc7fdf94bc19e176ba66034ea51dcc8295a0fd1 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -118,7 +118,11 @@ static int DEFENBS[] = {0};
 #include "pdcp.h"
 
 extern volatile int                    oai_exit;
-
+extern int emulate_rf;
+extern int numerology;
+extern clock_source_t clock_source;
+extern uint8_t dlsch_ue_select_tbl_in_use;
+extern uint8_t nfapi_mode;
 
 extern PARALLEL_CONF_t get_thread_parallel_conf(void);
 extern WORKER_CONF_t   get_thread_worker_conf(void);
@@ -141,6 +145,11 @@ int connect_rau(RU_t *ru);
 
 extern uint16_t sf_ahead;
 
+#if defined(PRE_SCD_THREAD)
+void init_ru_vnf(void);
+#endif
+
+
 /*************************************************************/
 /* Functions to attach and configure RRU                     */
 
@@ -1942,7 +1951,12 @@ void* pre_scd_thread( void* param ){
     int                     CC_id;
     int                     Mod_id;
     RU_t               *ru      = (RU_t*)param;
-    Mod_id = ru->eNB_list[0]->Mod_id;
+
+    // L2-emulator can work only one eNB
+    if( nfapi_mode == 2)
+       Mod_id = 0;
+    else 
+       Mod_id = ru->eNB_list[0]->Mod_id;
 
     frame = 0;
     subframe = 4;
@@ -2820,6 +2834,114 @@ void stop_RU(int nb_ru)
   }
 }
 
+//Some of the member of ru pointer is used in pre_scd.
+//This funtion is for initializing ru pointer for L2 FAPI simulator.
+#if defined(PRE_SCD_THREAD)
+void init_ru_vnf(void) {
+  
+  int ru_id;
+  RU_t *ru;
+  RU_proc_t *proc;
+//  PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
+  int i;
+  int CC_id;
+
+
+  dlsch_ue_select_tbl_in_use = 1;
+
+
+  // create status mask
+  RC.ru_mask = 0;
+  pthread_mutex_init(&RC.ru_mutex,NULL);
+  pthread_cond_init(&RC.ru_cond,NULL);
+
+  // read in configuration file)
+  printf("configuring RU from file\n");
+  RCconfig_RU();
+  LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs());
+
+  if (RC.nb_CC != 0)
+    for (i=0;i<RC.nb_L1_inst;i++) 
+      for (CC_id=0;CC_id<RC.nb_CC[i];CC_id++) RC.eNB[i][CC_id]->num_RU=0;
+
+  LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
+  for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
+    LOG_D(PHY,"Process RC.ru[%d]\n",ru_id);
+    ru               = RC.ru[ru_id];
+//    ru->rf_config_file = rf_config_file;
+    ru->idx          = ru_id;              
+    ru->ts_offset    = 0;
+    // use eNB_list[0] as a reference for RU frame parameters
+    // NOTE: multiple CC_id are not handled here yet!
+
+    if (ru->num_eNB > 0) {
+//      LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
+
+      if (ru->eNB_list[0] == 0)
+      {
+        LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__);
+        ru->eNB_list[0] = RC.eNB[0][0];
+        ru->num_eNB=1;
+      //
+      // DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU
+      //
+      }
+      else
+      {
+        LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__);
+      }
+    }
+
+// frame_parms is not used in L2 FAPI simulator
+/*
+    eNB0             = ru->eNB_list[0];
+    LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
+    LOG_D(PHY, "eNB0:%p\n", eNB0);
+    if (eNB0)
+    {
+      if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
+        AssertFatal(eNB0!=NULL,"eNB0 is null!\n");
+
+      if (eNB0) {
+        LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
+        memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+
+        // attach all RU to all eNBs in its list/
+        LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU);
+        for (i=0;i<ru->num_eNB;i++) {
+          eNB0 = ru->eNB_list[i];
+          eNB0->RU_list[eNB0->num_RU++] = ru;
+        }
+      }
+    }
+*/
+    LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
+
+//    set_function_spec_param(ru);
+    LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
+
+//    init_RU_proc(ru);
+  
+    proc = &ru->proc;
+    memset((void*)proc,0,sizeof(RU_proc_t));
+
+    proc->instance_pre_scd = -1;
+    pthread_mutex_init( &proc->mutex_pre_scd, NULL);
+    pthread_cond_init( &proc->cond_pre_scd, NULL);
+    pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void*)ru);
+    pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread");
+
+  } // for ru_id
+  
+
+
+  //  sleep(1);
+  LOG_D(HW,"[lte-softmodem.c] RU threads created\n");
+  
+
+}
+#endif
+
 
 /* --------------------------------------------------------*/
 /* from here function to use configuration module          */
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 5dde1034a48343eb9da7eeaa1ea57df717d5510f..872340e28caca653b7497260efdf498ac4efdc1d 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -689,7 +689,7 @@ int main( int argc, char **argv ) {
 #if T_TRACER
   T_Config_Init();
 #endif
-  ret=config_check_cmdlineopt(NULL);
+  ret=config_check_unknown_cmdlineopt(NULL);
 
   if (ret != 0) {
     LOG_E(ENB_APP, "%i unknown options in command line\n",ret);
@@ -879,8 +879,14 @@ int main( int argc, char **argv ) {
 
   printf("NFAPI MODE:%s\n", nfapi_mode_str);
 
-  if (nfapi_mode==2) // VNF
+
+if (nfapi_mode==2) {// VNF
+#if defined(PRE_SCD_THREAD)
+    init_ru_vnf();  // ru pointer is necessary for pre_scd.
+#endif
     wait_nfapi_init("main?");
+  }
+
 
   printf("START MAIN THREADS\n");
   // start the main threads
@@ -896,13 +902,16 @@ int main( int argc, char **argv ) {
 
   printf("wait_eNBs()\n");
   wait_eNBs();
+
   printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
 
-  if (RC.nb_RU >0) {
+  // RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
+  // but RU thread deals with pre_scd and this is necessary in VNF and simulator.
+  // some initialization is necessary and init_ru_vnf do this.
+  if (RC.nb_RU >0 && nfapi_mode != 2) {
     printf("Initializing RU threads\n");
     init_RU(get_softmodem_params()->rf_config_file);
-
-    for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
+    for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
       RC.ru[ru_id]->rf_map.card=0;
       RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
     }
@@ -938,7 +947,7 @@ int main( int argc, char **argv ) {
   sync_var=0;
   pthread_cond_broadcast(&sync_cond);
   pthread_mutex_unlock(&sync_mutex);
-  ret=config_check_cmdlineopt(CONFIG_CHECKALLSECTIONS);
+  ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
 
   if (ret != 0) {
     LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret);
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 6d182b16cfd9e3513dc8301d49ae8ceaeb7e0174..81f84e133b6fdf2cbf1a5722464be8fc1f6f92c4 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -150,6 +150,7 @@
 {"emul-iface",                 CONFIG_HLP_EMULIFACE,   0,               strptr:&emul_iface,		    defstrval:"lo",       TYPE_STRING,   100}, \
 {"L2-emul",                    NULL,  		       0,               u8ptr:&nfapi_mode,		    defuintval:3,         TYPE_UINT8,	 0},   \
 {"num-ues",     	       NULL,                   0,               u8ptr:&(NB_UE_INST),		    defuintval:1,         TYPE_UINT8,	 0},   \
+{"nums_ue_thread",             NULL,                   0,               u16ptr:&(NB_THREAD_INST),           defuintval:1,         TYPE_UINT16,   0},   \
 {"r"  ,                        CONFIG_HLP_PRB,         0,               u8ptr:&(frame_parms[0]->N_RB_DL),   defintval:25,         TYPE_UINT8,    0},   \
 {"dlsch-demod-shift",          CONFIG_HLP_DLSHIFT,     0,		iptr:(int32_t *)&dlsch_demod_shift, defintval:0,          TYPE_INT,	 0},   \
 {"usrp-args",                  CONFIG_HLP_USRP_ARGS,   0,               strptr:(char **)&usrp_args,         defstrval:"type=b200",TYPE_STRING,   0},   \
@@ -158,7 +159,7 @@
 {"clock",                      CONFIG_HLP_CLK,         0,               uptr:&clock_source,                 defintval:0,          TYPE_UINT,     0},   \
 {"s" ,                         CONFIG_HLP_SNR,         0,               iptr:&snr_dB,                       defintval:25,         TYPE_INT,      0},   \
 {"T" ,                         CONFIG_HLP_TDD,         PARAMFLAG_BOOL,  iptr:&tddflag,                      defintval:0,          TYPE_INT,      0},   \
-{"A",                          CONFIG_HLP_TADV,        0,               iptr:&(timingadv),                    defintval:0,          TYPE_INT,      0}    \
+{"A",                          CONFIG_HLP_TADV,        0,               iptr:&(timingadv),                  defintval:0,          TYPE_INT,      0}    \
 }
 
 /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -306,6 +307,7 @@ extern void kill_eNB_proc(int inst);
 // In lte-ru.c
 extern void init_RU(char*);
 extern void stop_ru(RU_t *ru);
+extern void init_ru_vnf(void);
 extern void init_RU_proc(RU_t *ru);
 extern void stop_RU(int nb_ru);
 extern void kill_RU_proc(RU_t *ru);
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 784c14fa4d53a8b58324f656e35bdf37f1271690..31857026ee41cd44f2ce60a4fbc4564461086de8 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -94,7 +94,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
 extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
 
 extern int simL1flag;
-
+extern uint16_t sf_ahead;
 //extern int tx_req_UE_MAC1();
 
 void ue_stub_rx_handler(unsigned int, char *);
@@ -102,9 +102,11 @@ void ue_stub_rx_handler(unsigned int, char *);
 int32_t **rxdata;
 int32_t **txdata;
 
-int timer_subframe;
-int timer_frame;
-SF_ticking *phy_stub_ticking;
+int timer_subframe = 0;
+int timer_frame = 0;
+SF_ticking *phy_stub_ticking = NULL;
+int next_ra_frame = 0;
+module_id_t next_Mod_id = 0;
 
 #define KHz (1000UL)
 #define MHz (1000*KHz)
@@ -386,7 +388,7 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
   for (inst=0;inst<nb_inst;inst++) {
 
     LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);
-    PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
+    // PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
   }
   init_timer_thread();
   init_UE_single_thread_stub(nb_inst);
@@ -963,31 +965,53 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
 	thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
 
-	module_id_t Mod_id = 0;
+	// for multipule UE's L2-emulator
+	//module_id_t Mod_id = 0;
+
 	//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
   static __thread int UE_thread_rxtx_retval;
   struct rx_tx_thread_data *rtd = arg;
   UE_rxtx_proc_t *proc = rtd->proc;
 
-  // Initializations for nfapi-L2-emulator mode
-  dl_config_req = NULL;
-  ul_config_req = NULL;
-  hi_dci0_req	= NULL;
-  tx_request_pdu_list = NULL;
-
+  // settings for nfapi-L2-emulator mode
+  module_id_t ue_thread_id = rtd->ue_thread_id;
+  uint16_t     ue_index = 0;
+  uint16_t     ue_num = NB_UE_INST/NB_THREAD_INST+((NB_UE_INST%NB_THREAD_INST > ue_thread_id) ? 1 :0);
+  module_id_t ue_Mod_id;
   PHY_VARS_UE    *UE;   //= rtd->UE;
   int ret;
+  uint8_t   end_flag;
+  proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
+  phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
+
+  if(ue_thread_id == 0){
+    phy_stub_ticking->ticking_var = -1;
+    proc->subframe_rx=proc->sub_frame_start;
+    // Initializations for nfapi-L2-emulator mode
+    dl_config_req = NULL;
+    ul_config_req = NULL;
+    hi_dci0_req        = NULL;
+    tx_request_pdu_list = NULL;
+
+    // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
+    do{
+      end_flag = 1;
+      for(uint16_t i = 0;i< NB_THREAD_INST;i++){
+        if(phy_stub_ticking->num_single_thread[i] == 0){
+          end_flag = 0;
+        }
+      }
+   }while(end_flag == 0);
 
-
-  phy_stub_ticking->ticking_var = -1;
-  proc->subframe_rx=proc->sub_frame_start;
+    sync_var=0;
+  }
 
 
   //PANOS: CAREFUL HERE!
   wait_sync("UE_phy_stub_single_thread_rxn_txnp4");
 
   while (!oai_exit) {
-
+    if(ue_thread_id == 0){
     if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
       LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" );
       exit_fun("nothing to add");
@@ -1006,12 +1030,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
     proc->subframe_rx=timer_subframe;
     proc->frame_rx = timer_frame;
-    proc->subframe_tx=(timer_subframe+4)%10;
-    proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
+    
+    // FDD and TDD tx timing settings.
+    // XXX:It is the result of timing adjustment in debug.
+    // It is necessary to investigate why this will work in the future.
+    proc->subframe_tx=(timer_subframe+sf_ahead)%10;
+    proc->frame_tx = proc->frame_rx + (proc->subframe_rx>(9-sf_ahead)?1:0);
     //oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
 
-
-    oai_subframe_ind(timer_frame, timer_subframe);
+    if(UE->frame_parms.frame_type == FDD){
+    oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
+    }else{
+    oai_subframe_ind(proc->frame_tx,proc->subframe_tx);
+    }
 
     //Guessing that the next 4 lines are not needed for the phy_stub mode.
     /*initRefTimes(t2);
@@ -1035,14 +1066,45 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     	UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
 
     	UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
-    	UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
-
-
-
+     	UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
+
+        UL_INFO->cqi_ind.cqi_pdu_list =  (nfapi_cqi_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
+        UL_INFO->cqi_ind.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
+        UL_INFO->cqi_ind.number_of_cqis = 0;
+
+        if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
+          LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
+          exit_fun("nothing to add");
+        }
+        memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST);
+        pthread_cond_broadcast(&phy_stub_ticking->cond_single_thread);
+
+        if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) {
+          LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
+          exit_fun("nothing to add");
+        }
+    }else{
+        if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
+          LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
+           exit_fun("nothing to add");
+        }
+        while (phy_stub_ticking->num_single_thread[ue_thread_id] < 0) {
+          // most of the time, the thread is waiting here
+          LOG_D(MAC,"Waiting for single_thread (ue_thread_id %d)\n",ue_thread_id);
+          pthread_cond_wait( &phy_stub_ticking->cond_single_thread, &phy_stub_ticking->mutex_single_thread);
+        }
+        if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) {
+          LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
+          exit_fun("nothing to add");
+        }
+    }
 
-    for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
-    	//LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
-    	UE = PHY_vars_UE_g[Mod_id][0];
+    //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
+    for (ue_index=0; ue_index < ue_num; ue_index++) {
+    ue_Mod_id = ue_thread_id + NB_THREAD_INST*ue_index;
+    UE = PHY_vars_UE_g[ue_Mod_id][0];
+    //LOG_D(MAC, "UE_phy_stub_single_thread_rxn_txnp4, NB_UE_INST:%d, Mod_id:%d \n", NB_UE_INST, Mod_id);
+    //UE = PHY_vars_UE_g[Mod_id][0];
     lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx);
     if ((sf_type == SF_DL) ||
 	(UE->frame_parms.frame_type == FDD) ||
@@ -1068,12 +1130,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
       if (dl_config_req!=NULL && tx_request_pdu_list!=NULL){
     	  //if(dl_config_req!= NULL) {
-    	  dl_config_req_UE_MAC(dl_config_req, Mod_id);
+    	  dl_config_req_UE_MAC(dl_config_req, ue_Mod_id);
 
       }
 
       if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
-    	  hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
+    	  hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id);
       }
 
       if(nfapi_mode!=3)
@@ -1087,7 +1149,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
     if (UE->mac_enabled==1) {
 
-      ret = ue_scheduler(UE->Mod_id,
+      ret = ue_scheduler(ue_Mod_id,
 			 proc->frame_rx,
 			 proc->subframe_rx,
 			 proc->frame_tx,
@@ -1113,34 +1175,37 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
     // We make the start of RA between consecutive UEs differ by 20 frames
 	//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH  && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
-	if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH  && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) {
-
+	if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH  && ue_Mod_id == next_Mod_id) {
+          next_ra_frame++;
+          if(next_ra_frame > 200){
 	  // check if we have PRACH opportunity
 
-	  if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) &&  UE_mac_inst[Mod_id].SI_Decoded == 1) {
+	  if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) &&  UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
 
 	  // The one working strangely...
       //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
 
-	    PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
+	    PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
 	    if(prach_resources!=NULL ) {
-	    	UE_mac_inst[Mod_id].ra_frame = proc->frame_rx;
-	      LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d \n", Mod_id );
-	      fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
-	      Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
-	      UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
-	      next_Mod_id = Mod_id + 1;
-	      next_ra_frame = (proc->frame_rx + 20)%1000;
+	    	UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx;
+	      LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id ,proc->frame_tx, proc->subframe_tx);
+	      fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
+	      Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0);
+	      UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
+	      next_Mod_id = ue_Mod_id + 1;
+	      //next_ra_frame = (proc->frame_rx + 20)%1000;
+              next_ra_frame = 0;
 	    }
 
 	    //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
 	  }
+          }
 	} // mode is PRACH
 	// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
 	// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
 	// Generate UL_indications which correspond to UL traffic.
 	if(ul_config_req!=NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
-		ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id);
+		ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id);
 	}
       }
 
@@ -1149,6 +1214,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
 
     } //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
 
+    phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
+
+    // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
+    if(ue_thread_id == 0){
+      do{
+        end_flag = 1;
+        for(uint16_t i = 0;i< NB_THREAD_INST;i++){
+          if(phy_stub_ticking->num_single_thread[i] == 0){
+             end_flag = 0;
+          }
+        }
+      }while(end_flag == 0);
+
 
     if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0)
       {
@@ -1163,6 +1241,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     	  //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
     	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
     	  oai_nfapi_rx_ind(&UL_INFO->rx_ind);
+          for(uint8_t num_pdu = 0;num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus;num_pdu++){
+            free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data);
+          }
     	  //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
     	  UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
       }
@@ -1199,14 +1280,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     	  free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
     	  UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
       //}
-
+      free(UL_INFO->cqi_ind.cqi_pdu_list);
+      UL_INFO->cqi_ind.cqi_pdu_list = NULL;
+      free(UL_INFO->cqi_ind.cqi_raw_pdu_list);
+      UL_INFO->cqi_ind.cqi_raw_pdu_list = NULL;
       free(UL_INFO);
       UL_INFO = NULL;
 
       // De-allocate memory of nfapi requests copies before next subframe round
       if(dl_config_req!=NULL){
-    	  if(dl_config_req->vendor_extension)
-    		  free(dl_config_req->vendor_extension);
+    	  if(dl_config_req->vendor_extension!=NULL){
+            free(dl_config_req->vendor_extension);
+            dl_config_req->vendor_extension = NULL;
+          }
     	  if(dl_config_req->dl_config_request_body.dl_config_pdu_list!=NULL){
     		  free(dl_config_req->dl_config_request_body.dl_config_pdu_list);
     		  dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
@@ -1236,7 +1322,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
     	  hi_dci0_req = NULL;
       }
 
-
+    }
 
   }
   // thread finished
@@ -1780,6 +1866,13 @@ void init_UE_single_thread_stub(int nb_inst) {
 	  AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
 	  AssertFatal(PHY_vars_UE_g[i]!=NULL,"PHY_vars_UE_g[inst] is NULL\n");
 	  AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n");
+	  if(nfapi_mode == 3){
+#ifdef NAS_UE
+          MessageDef *message_p;
+          message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE);
+         itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p);
+#endif
+	  }
   }
   UE = PHY_vars_UE_g[0][0];
 
@@ -1794,19 +1887,22 @@ void init_UE_single_thread_stub(int nb_inst) {
   // In phy_stub_UE mode due to less heavy processing operations we don't need two threads
   //int nb_threads=RX_NB_TH;
   int nb_threads=1;
-  for (int i=0; i<nb_threads; i++) {
-    rtd = calloc(1, sizeof(struct rx_tx_thread_data));
-    if (rtd == NULL) abort();
-    rtd->UE = UE;
-    rtd->proc = &UE->proc.proc_rxtx[i];
-
-    pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL);
-    pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL);
-    UE->proc.proc_rxtx[i].sub_frame_start=i;
-    UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
-    printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
-    pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd);
-
+  for(uint16_t ue_thread_id = 0;ue_thread_id < NB_THREAD_INST;ue_thread_id++){
+    UE = PHY_vars_UE_g[ue_thread_id][0];
+    for (int i=0; i<nb_threads; i++) {
+      rtd = calloc(1, sizeof(struct rx_tx_thread_data));
+      if (rtd == NULL) abort();
+      rtd->UE = UE;
+      rtd->proc = &UE->proc.proc_rxtx[i];
+      rtd->ue_thread_id = ue_thread_id;
+
+      pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL);
+      pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL);
+      UE->proc.proc_rxtx[i].sub_frame_start=i;
+      UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
+      printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
+      pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd);
+    }
   }
   // Remove thread for UE_sync in phy_stub_UE mode.
   //pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE);
@@ -2076,8 +2172,11 @@ int init_timer_thread(void) {
   pthread_mutex_init(&UE->timer_mutex,NULL);
   pthread_cond_init(&UE->timer_cond,NULL);
   UE->instance_cnt_timer = -1;
+  memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST);
   pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL);
   pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL);
+  pthread_mutex_init(&phy_stub_ticking->mutex_single_thread,NULL);
+  pthread_cond_init(&phy_stub_ticking->cond_single_thread,NULL);
   pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL);
   return 0;
 }
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index 1cd0b24f81d703ec31ada01866ed16c46bf89502..4583b6ac97cc56d8d2671da7c805d20b07d260de 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -110,9 +110,13 @@ pthread_mutex_t nfapi_sync_mutex;
 int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
 
 uint8_t nfapi_mode = 0;
-
+#ifdef PDCP_USE_NETLINK
+#ifdef UESIM_EXPANSION
+uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
+#endif
+#endif
 uint16_t sf_ahead=2;
-
+int tddflag;
 char *emul_iface;
 
 
@@ -491,10 +495,12 @@ static void get_options(void) {
   }
 
   UE_scan=0;
-
+   
   if (tddflag > 0) {
-    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
+    for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
       frame_parms[CC_id]->frame_type = TDD;
+      frame_parms[CC_id]->tdd_config = tddflag;
+    }
   }
 
   if (frame_parms[0]->N_RB_DL !=0) {
@@ -722,9 +728,15 @@ int main( int argc, char **argv ) {
 #endif
   int CC_id;
   uint8_t  abstraction_flag=0;
+#ifdef PDCP_USE_NETLINK
+#ifdef UESIM_EXPANSION
+  memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list));
+#endif
+#endif
   // Default value for the number of UEs. It will hold,
   // if not changed from the command line option --num-ues
   NB_UE_INST=1;
+  NB_THREAD_INST=1;
 #if defined (XFORMS)
   int ret;
 #endif
@@ -746,12 +758,36 @@ int main( int argc, char **argv ) {
   get_options ();
   printf("Running with %d UE instances\n",NB_UE_INST);
 
-  if (NB_UE_INST > 1 && simL1flag != 1) {
+  if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) {
     printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n");
     abort();
   }
 
   printf("NFAPI_MODE value: %d \n", nfapi_mode);
+
+  // Checking option of nums_ue_thread.
+  if(NB_THREAD_INST < 1){
+    printf("Running with 0 UE rxtx thread, exiting.\n");
+    abort();
+  }
+  // Checking option's relation between nums_ue_thread and num-ues
+  if(NB_UE_INST <NB_THREAD_INST ){
+    printf("Number of UEs < number of UE rxtx threads, exiting.\n");
+    abort();
+  }
+  // Not sure if the following is needed here
+  /*if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
+      if (UE_flag == 0) {
+        fprintf(stderr,"Getting configuration failed\n");
+        exit(-1);
+      }
+      else {
+        printf("Setting nfapi mode to UE_STUB_OFFNET\n");
+        nfapi_mode = 4;
+      }
+    }*/
+
+
 #if T_TRACER
   T_Config_Init();
 #endif
@@ -834,6 +870,8 @@ int main( int argc, char **argv ) {
     RCConfig_sim();
   }
 
+// source code written in below moved to later to avoid keeping waiting for nfapi_sync_cond in wait_nfapi_init.
+/*
   // start the main UE threads
   int eMBMS_active = 0;
 
@@ -862,7 +900,8 @@ int main( int argc, char **argv ) {
       PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
     }
   }
-
+*/
+  
   cpuf=get_cpu_freq_GHz();
 #ifndef DEADLINE_SCHEDULER
   printf("NO deadline scheduler\n");
@@ -907,8 +946,7 @@ int main( int argc, char **argv ) {
   LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
 #endif
 #if defined(ENABLE_ITTI)
-
-  if (create_tasks_ue(1) < 0) {
+  if (create_tasks_ue(NB_UE_INST) < 0) {
     printf("cannot create ITTI tasks\n");
     exit(-1); // need a softer mode
   }
@@ -922,6 +960,8 @@ int main( int argc, char **argv ) {
   mlockall(MCL_CURRENT | MCL_FUTURE);
   rt_sleep_ns(10*100000000ULL);
   const char *nfapi_mode_str = "<UNKNOWN>";
+  // start the main UE threads
+  int eMBMS_active = 0;
 
   switch(nfapi_mode) {
     case 0:
@@ -951,6 +991,33 @@ int main( int argc, char **argv ) {
 
   printf("NFAPI MODE:%s\n", nfapi_mode_str);
 
+  if (nfapi_mode==3) // UE-STUB-PNF
+  {
+      config_sync_var=0;
+      wait_nfapi_init("main?");
+      //Panos: Temporarily we will be using single set of threads for multiple UEs.
+      //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
+      init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
+  }
+  else {
+      init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
+              frame_parms[0]);
+  }
+
+
+  if (get_softmodem_params()->phy_test==0) {
+    printf("Filling UE band info\n");
+    fill_ue_band_info();
+    dl_phy_sync_success (0, 0, 0, 1);
+  }
+
+  if (nfapi_mode!=3){
+      number_of_cards = 1;
+      for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
+              PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
+              PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
+      }
+  }
   // connect the TX/RX buffers
 
   /*
@@ -1010,7 +1077,7 @@ int main( int argc, char **argv ) {
   }
 
 #endif
-  ret=config_check_cmdlineopt(CONFIG_CHECKALLSECTIONS);
+  ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
 
   if (ret != 0) {
     LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret);