From 714e9bb62c06b3c64c97abdaf3efe181350791af Mon Sep 17 00:00:00 2001
From: navid <navid@mycompany.com>
Date: Fri, 10 Jul 2015 23:44:07 +0000
Subject: [PATCH] * Add PRINT_STATS for oaisim in addition to XFORMS * Add RLC
 stats to openair2_proc * fix the autotests failure * some other cleanup

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7699 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 cmake_targets/CMakeLists.txt                  |   2 +
 .../autotests/run_compilation_autotests.bash  |  26 +-
 .../autotests/test.0101/CMakeLists.txt        |  12 +-
 cmake_targets/build_oai                       | 105 ++++----
 .../oaisim_build_oai/CMakeLists.template      |   1 -
 .../oaisim_noS1_build_oai/CMakeLists.template |   1 -
 openair2/LAYER2/RLC/rlc.c                     |   3 +-
 openair2/LAYER2/RLC/rlc.h                     |   7 +-
 openair2/LAYER2/openair2_proc.c               | 225 ++++++++++++++++--
 openair2/UTIL/OMG/static.c                    |   1 +
 targets/SIMU/USER/oaisim_config.c             |   2 +-
 targets/SIMU/USER/oaisim_functions.c          |   2 +-
 12 files changed, 304 insertions(+), 83 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index f39189fb90..4b7330b3be 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -174,6 +174,8 @@ add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages")
 add_boolean_option(TEST_OMG False "???")
 add_boolean_option(DEBUG_OMG False "???")
 add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope")
+add_boolean_option(PRINT_STATS False "This adds the possibility to see the status")
+
 add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
 
 add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
diff --git a/cmake_targets/autotests/run_compilation_autotests.bash b/cmake_targets/autotests/run_compilation_autotests.bash
index 9963edead6..50ec7ee21c 100755
--- a/cmake_targets/autotests/run_compilation_autotests.bash
+++ b/cmake_targets/autotests/run_compilation_autotests.bash
@@ -21,10 +21,10 @@ test_compile() {
     } > $tdir/log/$1.txt 2>&1
     if [ -s $3 ] ; then
         cp $3 $tdir/bin/`basename $3`.$1
-        echo_success "$1 test compiled"
+        echo_success "$1 $3 $5 compiled"
         xUnit_success "compilation" $1
     else
-        echo_error "$1 test compilation failed"
+        echo_error "$1 $3 $5 compilation failed"
         xUnit_fail "compilation" $1
     fi
 }
@@ -40,16 +40,16 @@ fi
 cd $tdir 
 
 test_compile \
-    test.0101 oaisim \
-    oaisim  $tdir/bin/oaisim.r8
+    test.0101 oaisim_nos1 \
+    oaisim_nos1  $tdir/bin/oaisim.r8 rel8.nos1
 
 test_compile \
-    test.0102 oaisim \
-    oaisim  $tdir/bin/oaisim.r8.nas
+    test.0102 oaisim_nos1 \
+    oaisim_nos1  $tdir/bin/oaisim.r8.nas rel8.nos1.nas
 
 test_compile \
     test.0103 lte-softmodem \
-    lte-softmodem  $tdir/bin/lte-softmodem.r8.rf
+    lte-softmodem  $tdir/bin/lte-softmodem.r8.rf rel8.rf
 
 test_compile \
     test.0104 dlsim \
@@ -61,19 +61,19 @@ test_compile \
 
 test_compile \
     test.0106 oaisim \
-    oaisim  $tdir/bin/oaisim.r8.itti
+    oaisim  $tdir/bin/oaisim.r8.itti rel8.itti
 
 test_compile \
-    test.0107 oaisim \
-    oaisim  $tdir/bin/oaisim.r10
+    test.0107 oaisim_nos1 \
+    oaisim_nos1  $tdir/bin/oaisim.r10 rel10.nos1
 
 test_compile \
     test.0108 oaisim \
-    oaisim  $tdir/bin/oaisim.r10.itti
+    oaisim  $tdir/bin/oaisim.r10.itti rel10.itti
 
 test_compile \
     test.0114 oaisim \
-    oaisim  $tdir/bin/oaisim.r8.itti.ral
+    oaisim  $tdir/bin/oaisim.r8.itti.ral rel8.itti.ral
 
 test_compile \
     test.0115 oaisim \
@@ -81,7 +81,7 @@ test_compile \
 
 test_compile \
     test.0120 nasmesh \
-    CMakeFiles/nasmesh/nasmesh.ko $tdir/bin/nasmesh.ko
+    CMakeFiles/nasmesh/nasmesh.ko $tdir/bin/nasmesh.ko 
 
 # write the test results into a file
 xUnit_write "$tdir/log/compilation_autotests.xml"
diff --git a/cmake_targets/autotests/test.0101/CMakeLists.txt b/cmake_targets/autotests/test.0101/CMakeLists.txt
index 75e8542cd5..dd5484c596 100644
--- a/cmake_targets/autotests/test.0101/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0101/CMakeLists.txt
@@ -16,9 +16,9 @@ set ( ENABLE_SECURITY False )
 set ( ENABLE_STANDALONE_EPC False )
 set ( ENABLE_USE_CPU_EXECUTION_TIME True )
 set ( ENABLE_USE_MME False )
-set ( ENABLE_VCD_FIFO True )
+set (  ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
 set ( ENB_MODE True )
-set ( EPC_BUILD False )
 set ( HARD_RT False )
 set ( JUMBO_FRAME True )
 set ( LARGE_SCALE False )
@@ -52,7 +52,7 @@ set ( OAI_EMU True )
 set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
 set ( OAI_NW_DRIVER_USE_NETLINK False )
 set ( OAISIM True )
-set ( OPENAIR1 False )
+set ( OPENAIR1 True )
 set ( OPENAIR2 True )
 set ( OPENAIR_EMU False )
 set ( OPENAIR_LTE True )
@@ -69,7 +69,7 @@ set ( PHY_EMUL False )
 set ( PHYSIM False )
 set ( PUCCH True )
 set ( RANDOM_BF False )
-set ( RF_BOARD False )
+set ( RF_BOARD "False" )
 set ( RLC_STOP_ON_LOST_PDU False )
 set ( RRC_ASN1_VERSION Rel8 )
 set ( RRC_DEFAULT_RAB_IS_AM False )
@@ -99,8 +99,8 @@ set ( TRACE_RLC_UM_RX False )
 set ( TRACE_RLC_UM_SEGMENT False )
 set ( TRACE_RLC_UM_TX_STATUS False )
 set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
-set ( USE_MME False )
+set ( USE_MME "R8" )
 set ( USER_MODE True )
 set ( XER_PRINT True )
 set ( XFORMS False )
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
\ No newline at end of file
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 1a0b46fed1..3af9035fe6 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -41,6 +41,7 @@ source $THIS_SCRIPT_PATH/tools/build_helper
 
 MSC_GEN="False"
 XFORMS="False"
+PRINT_STATS="False"
 VCD_TIMING="False"
 REL="Rel10"
 HW="EXMIMO"
@@ -81,7 +82,7 @@ Options
    EXMIMO (Default), USRP, BLADERF, None
    Adds this RF board support (in external packages installation and in compilation)
 --oaisim
-   Makes the oaisim simulator
+   Makes the oaisim simulator. Hardware will be defaulted to "NONE".
 --phy_simulators
    Makes the unitary tests Layer 1 simulators
 --core_simulators
@@ -91,13 +92,18 @@ Options
 -V | --vcd
    Adds a debgging facility to the binary files: GUI with major internal synchronization events
 -x | --xforms
-   Adds a software oscilloscope feature to the produced binaries
+   Adds a software oscilloscope feature to the produced binaries. If oaisim, then enable PRINT_STATS.
 --install-system-files
    Install OpenArInterface required files in Linux system
    (will ask root password)
-Usage:
+Usage (first build):
+ oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
  Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
- NI/ETTUS B201  + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP'
+ NI/ETTUS B201  + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP
+Usage (Regular):
+ oaisim : ./build_oai --oaisim -x 
+ Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x 
+ NI/ETTUS B201  + OAI ENB : ./build_oai --eNB -x -w USRP'
 }
 
 
@@ -176,7 +182,7 @@ function main() {
             EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
             shift;;
        -x | --xforms)
-            XFORMS=1
+            XFORMS="True"
             EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
             echo_info "Will generate the software oscilloscope features"
             shift;;
@@ -245,6 +251,16 @@ function main() {
     check_install_additional_tools
   fi
 
+  if [ "$oaisim" = "1" ] ; then
+      if [ "$HW" != "ETHERNET" ] ; then 
+	  HW="NONE"
+      fi 
+      if [ "$XFORMS" == "True" ] ; then 
+	  PRINT_STATS="True"
+      fi 
+  fi
+  
+  
   echo_info "3. building the compilation directives ..."
 
   DIR=$OPENAIR_DIR/cmake_targets
@@ -256,10 +272,10 @@ function main() {
     mkdir -p $DIR/lte_build_oai/build
     cmake_file=$DIR/lte_build_oai/CMakeLists.txt
     echo "cmake_minimum_required(VERSION 2.8)"   >   $cmake_file
-    echo "set(XFORMS $XFORMS )"                  >>  $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
+    echo "set ( XFORMS $XFORMS )"                  >>  $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
     echo 'set(PACKAGE_NAME "\"lte-softmodem\"")' >>  $cmake_file
     echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
     cd  $DIR/lte_build_oai/build
@@ -376,9 +392,10 @@ function main() {
 
   if [ "$oaisim" = "1" ] ; then
     dconf=$OPENAIR_DIR/targets/bin
-
-    echo_info "Compiling at_nas_ue"
+    
     [ "$CLEAN" = "1" ] && rm -rf $DIR/at_commands/build
+    
+    echo_info "Compiling at_nas_ue"
     mkdir -p $DIR/at_commands/build
     cd $DIR/at_commands/build
     cmake ..
@@ -389,9 +406,10 @@ function main() {
     echo_info "Compiling oaisim"
     cmake_file=$DIR/oaisim_build_oai/CMakeLists.txt
     cp $DIR/oaisim_build_oai/CMakeLists.template $cmake_file
-    echo "set(XFORMS $XFORMS )" >>  $cmake_file
-    echo "set(RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
-    echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
+    echo "set ( XFORMS $XFORMS )" >>  $cmake_file
+    echo "set ( PRINT_STATS $PRINT_STATS )" >>  $cmake_file
+    echo "set ( RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
+    echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
     echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
     [ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_build_oai/build
     mkdir -p $DIR/oaisim_build_oai/build
@@ -428,9 +446,10 @@ function main() {
     echo_info "Compiling oaisim_nos1"
     cmake_file=$DIR/oaisim_noS1_build_oai/CMakeLists.txt
     cp $DIR/oaisim_noS1_build_oai/CMakeLists.template $cmake_file
-    echo "set(XFORMS $XFORMS )" >>  $cmake_file
-    echo "set(RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
-    echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
+    echo "set ( XFORMS $XFORMS )" >>  $cmake_file
+    echo "set ( PRINT_STATS $PRINT_STATS )" >>  $cmake_file
+    echo "set ( RRC_ASN1_VERSION \"${REL}\")" >>  $cmake_file
+    echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >>  $cmake_file
     echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
     [ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_noS1_build_oai/build
     mkdir -p $DIR/oaisim_noS1_build_oai/build
@@ -446,12 +465,12 @@ function main() {
 
     # nasmesh driver compilation
     compilations \
-	  oaisim_noS1_build_oai nasmesh \
-	  CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+	oaisim_noS1_build_oai nasmesh \
+	CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
     #oai_nw_drv
     compilations \
-	  oaisim_noS1_build_oai oai_nw_drv \
-	  CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
+	oaisim_noS1_build_oai oai_nw_drv \
+	CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
 
     cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
     cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
@@ -471,28 +490,28 @@ function main() {
   # EPC compilation
   ##################
   if [ "$EPC" = "1" ] ; then
-    echo_info "Compiling EPC"
-    # Example HSS and EPC run on the same host
-    if [ "$CLEAN" = "1" ]; then
-      $OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
-      $OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
-    else
-      $OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
-      $OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
-    fi
-
-#   if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
-#    if [ -f $dbin/hss.conf ] ; then
-#      sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
-#      source $dconf/hss.conf.nospace
-#      rm -f $dconf/hss.conf.nospace
-#      create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
-#    else
-#      echo_warning "not created HSS database: config not found"
-#    fi
-#  fi
-fi
-
+      echo_info "Compiling EPC"
+      # Example HSS and EPC run on the same host
+      if [ "$CLEAN" = "1" ]; then
+	  $OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
+	  $OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
+      else
+	  $OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
+	  $OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
+      fi
+      
+      #   if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
+      #    if [ -f $dbin/hss.conf ] ; then
+      #      sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
+      #      source $dconf/hss.conf.nospace
+      #      rm -f $dconf/hss.conf.nospace
+      #      create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
+      #    else
+      #      echo_warning "not created HSS database: config not found"
+      #    fi
+      #  fi
+  fi
+  
   # Auto-tests
   #####################
   if [ "$OAI_TEST" = "1" ]; then
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index b2955cd20f..76564d8fdd 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -78,4 +78,3 @@ set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
 set (  USER_MODE True )
 set (  XER_PRINT False )
-set (  XFORMS False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index 6a4d128bbf..1ccd57fffd 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -80,4 +80,3 @@ set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
 set (  USER_MODE True )
 set (  XER_PRINT False )
-set (  XFORMS False )
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index ad6abbf76b..04610169d3 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -108,6 +108,7 @@ rlc_op_status_t rlc_stat_req     (
   const protocol_ctxt_t* const ctxt_pP,
   const srb_flag_t    srb_flagP,
   const rb_id_t       rb_idP,
+  unsigned int* stat_rlc_mode,
   unsigned int* stat_tx_pdcp_sdu,
   unsigned int* stat_tx_pdcp_bytes,
   unsigned int* stat_tx_pdcp_sdu_discarded,
@@ -154,7 +155,7 @@ rlc_op_status_t rlc_stat_req     (
   if (h_rc == HASH_TABLE_OK) {
     rlc_mode = rlc_union_p->mode;
   }
-
+  *stat_rlc_mode                     = rlc_mode;
   switch (rlc_mode) {
   case RLC_MODE_NONE:
     *stat_tx_pdcp_sdu                     = 0;
diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h
index bcd4062b57..627d48c311 100755
--- a/openair2/LAYER2/RLC/rlc.h
+++ b/openair2/LAYER2/RLC/rlc.h
@@ -540,7 +540,8 @@ public_rlc(void rlc_data_conf(
                         const protocol_ctxt_t* const ctxtP,
                         const  srb_flag_t    srb_flagP,
                         const  rb_id_t       rb_idP,
-                        unsigned int* stat_tx_pdcp_sdu,
+                        unsigned int* stat_rlc_mode,
+			unsigned int* stat_tx_pdcp_sdu,
                         unsigned int* stat_tx_pdcp_bytes,
                         unsigned int* stat_tx_pdcp_sdu_discarded,
                         unsigned int* stat_tx_pdcp_bytes_discarded,
@@ -572,6 +573,7 @@ public_rlc(void rlc_data_conf(
 * \param[in]  ctxtP                Running context.
 * \param[in]  srb_flagP            Flag to indicate signalling radio bearer (1) or data radio bearer (0).
 * \param[in]  rb_idP                       .
+* \param[out] stat_rlc_mode                        RLC mode 
 * \param[out] stat_tx_pdcp_sdu                     Number of SDUs coming from upper layers.
 * \param[out] stat_tx_pdcp_bytes                   Number of bytes coming from upper layers.
 * \param[out] stat_tx_pdcp_sdu_discarded           Number of discarded SDUs coming from upper layers.
@@ -605,7 +607,8 @@ public_rlc(rlc_op_status_t rlc_stat_req     (
              const protocol_ctxt_t* const ctxtP,
              const srb_flag_t    srb_flagP,
              const rb_id_t       rb_idP,
-             unsigned int* const stat_tx_pdcp_sdu,
+             unsigned int* const stat_rlc_mode,
+	     unsigned int* const stat_tx_pdcp_sdu,
              unsigned int* const stat_tx_pdcp_bytes,
              unsigned int* const stat_tx_pdcp_sdu_discarded,
              unsigned int* const stat_tx_pdcp_bytes_discarded,
diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c
index 523258b1a5..83441d7cb7 100644
--- a/openair2/LAYER2/openair2_proc.c
+++ b/openair2/LAYER2/openair2_proc.c
@@ -28,12 +28,12 @@
  *******************************************************************************/
 /******************************************************************************
  \file openair2_proc
-# \brief print openair2 statistics
+# \brief print openair2 overall statistics
 # \author Navid Nikaein
-# \date 2013
-# \version 0.1
+# \date 2013-2015
+# \version 0.2
 # \email navid.nikaein@eurecom.fr
-# @ingroup _mac
+# @ingroup _openair2
 */
 
 #ifdef USER_MODE
@@ -59,10 +59,12 @@
 #include "UTIL/LOG/log.h"
 
 static mapping rrc_status_names[] = {
-  {"RRC_IDLE", 0},
-  {"RRC_SI_RECEIVED",1},
-  {"RRC_CONNECTED",2},
-  {"RRC_RECONFIGURED",3},
+  {"RRC_INACTIVE", 0},
+  {"RRC_IDLE", 1},
+  {"RRC_SI_RECEIVED",2},
+  {"RRC_CONNECTED",3},
+  {"RRC_RECONFIGURED",4},
+  {"RRC_HO_EXECUTION",5},
   {NULL, -1}
 };
 
@@ -72,7 +74,37 @@ int dump_eNB_l2_stats(char *buffer, int length)
   int eNB_id,UE_id,number_of_cards;
   int len= length;
   int CC_id=0;
-  int i;
+  int i,j;
+  protocol_ctxt_t      ctxt;
+  rlc_op_status_t rlc_status;
+  unsigned int stat_rlc_mode;
+  unsigned int stat_tx_pdcp_sdu;
+  unsigned int stat_tx_pdcp_bytes;
+  unsigned int stat_tx_pdcp_sdu_discarded;
+  unsigned int stat_tx_pdcp_bytes_discarded;
+  unsigned int stat_tx_data_pdu;
+  unsigned int  stat_tx_data_bytes;
+  unsigned int  stat_tx_retransmit_pdu_by_status;
+  unsigned int  stat_tx_retransmit_bytes_by_status;
+  unsigned int stat_tx_retransmit_pdu;
+  unsigned int  stat_tx_retransmit_bytes;
+  unsigned int  stat_tx_control_pdu;
+  unsigned int  stat_tx_control_bytes;
+  unsigned int  stat_rx_pdcp_sdu;
+  unsigned int  stat_rx_pdcp_bytes;
+  unsigned int  stat_rx_data_pdus_duplicate;
+  unsigned int  stat_rx_data_bytes_duplicate;
+  unsigned int  stat_rx_data_pdu;
+  unsigned int  stat_rx_data_bytes;
+  unsigned int  stat_rx_data_pdu_dropped;
+  unsigned int  stat_rx_data_bytes_dropped;
+  unsigned int  stat_rx_data_pdu_out_of_window;
+  unsigned int  stat_rx_data_bytes_out_of_window;
+  unsigned int  stat_rx_control_pdu;
+  unsigned int  stat_rx_control_bytes;
+  unsigned int  stat_timer_reordering_timed_out;
+  unsigned int  stat_timer_poll_retransmit_timed_out;
+  unsigned int  stat_timer_status_prohibit_timed_out;
 
 #ifdef EXMIMO
   number_of_cards=1;
@@ -141,7 +173,7 @@ int dump_eNB_l2_stats(char *buffer, int length)
 	UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_bitrate=((UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS*8)/((eNB->frame + 1)*10));
         UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_bitrate= ((UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes_rx*8)/((eNB->frame + 1)*10));
        
-        len += sprintf(&buffer[len],"UE %d %s (DLSCH), RNTI %x : CQI %d, MCS1 %d, MCS2 %d, RB (tx %d, retx %d, total %d), ncce (tx %d, retx %d) \n",
+        len += sprintf(&buffer[len],"[MAC] UE %d (DLSCH),status %s, RNTI %x : CQI %d, MCS1 %d, MCS2 %d, RB (tx %d, retx %d, total %d), ncce (tx %d, retx %d) \n",
                        UE_id,
                        map_int_to_str(rrc_status_names, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status),
                        UE_list->eNB_UE_stats[CC_id][UE_id].crnti,
@@ -169,7 +201,7 @@ int dump_eNB_l2_stats(char *buffer, int length)
                        UE_list->eNB_UE_stats[CC_id][UE_id].avg_overhead_bytes
                       );
         
-	len += sprintf(&buffer[len],"UE %d %s (ULSCH), RNTI %x : rx power (normalized %d,  target %d), MCS (pre %d, post %d), RB (rx %d, retx %d, total %d), Current TBS %d \n",
+	len += sprintf(&buffer[len],"[MAC] UE %d (ULSCH), Status %d, RNTI %x : rx power (normalized %d,  target %d), MCS (pre %d, post %d), RB (rx %d, retx %d, total %d), Current TBS %d \n",
                        UE_id,
                        map_int_to_str(rrc_status_names, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status),
                        UE_list->eNB_UE_stats[CC_id][UE_id].crnti,
@@ -192,17 +224,182 @@ int dump_eNB_l2_stats(char *buffer, int length)
                        UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus_rx,
                        UE_list->eNB_UE_stats[CC_id][UE_id].num_errors_rx);
 
-        len+= sprintf(&buffer[len],"Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info);
-        len+= sprintf(&buffer[len],"Received BSR LCGID[0][1][2][3] = %u %u %u %u\n",
+        len+= sprintf(&buffer[len],"[MAC] Received PHR PH = %d (db)\n", UE_list->UE_template[CC_id][UE_id].phr_info);
+        len+= sprintf(&buffer[len],"[MAC] Received BSR LCGID[0][1][2][3] = %u %u %u %u\n",
                       UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID0],
                       UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID1],
                       UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID2],
                       UE_list->UE_template[CC_id][UE_id].bsr_info[LCGID3]
                      );
       }
+      
+      PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
+				     eNB_id,
+				     ENB_FLAG_YES,
+				     UE_list->eNB_UE_stats[UE_PCCID(eNB_id,UE_id)][UE_id].crnti, 
+				     eNB->frame,
+				     eNB->subframe,
+				     eNB_id);
+
+      rlc_status = rlc_stat_req(&ctxt,
+				SRB_FLAG_YES,
+				DCCH,
+				&stat_rlc_mode,
+				&stat_tx_pdcp_sdu,
+				&stat_tx_pdcp_bytes,
+				&stat_tx_pdcp_sdu_discarded,
+				&stat_tx_pdcp_bytes_discarded,
+				&stat_tx_data_pdu,
+				&stat_tx_data_bytes,
+				&stat_tx_retransmit_pdu_by_status,
+				&stat_tx_retransmit_bytes_by_status,
+				&stat_tx_retransmit_pdu,
+				&stat_tx_retransmit_bytes,
+				&stat_tx_control_pdu,
+				&stat_tx_control_bytes,
+				&stat_rx_pdcp_sdu,
+				&stat_rx_pdcp_bytes,
+				&stat_rx_data_pdus_duplicate,
+				&stat_rx_data_bytes_duplicate,
+				&stat_rx_data_pdu,
+				&stat_rx_data_bytes,
+				&stat_rx_data_pdu_dropped,
+				&stat_rx_data_bytes_dropped,
+				&stat_rx_data_pdu_out_of_window,
+				&stat_rx_data_bytes_out_of_window,
+				&stat_rx_control_pdu,
+				&stat_rx_control_bytes,
+				&stat_timer_reordering_timed_out,
+				&stat_timer_poll_retransmit_timed_out,
+				&stat_timer_status_prohibit_timed_out);
+      
+      if (rlc_status == RLC_OP_STATUS_OK) {
+	len+=sprintf(&buffer[len],"[RLC] DCCH Mode %s, NB_SDU_TO_TX = %d (bytes %d)\tNB_SDU_TO_TX_DISC %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_tx_pdcp_sdu,
+		     stat_tx_pdcp_bytes,
+		     stat_tx_pdcp_sdu_discarded,
+		     stat_tx_pdcp_bytes_discarded);
+	
+	len+=sprintf(&buffer[len],"[RLC] DCCH Mode %s, NB_TX_DATA   = %d (bytes %d)\tNB_TX_CONTROL %d (bytes %d)\tNB_TX_RETX %d (bytes %d)\tNB_TX_RETX_BY_STATUS = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_tx_data_pdu,
+		     stat_tx_data_bytes,
+		     stat_tx_control_pdu,
+		     stat_tx_control_bytes,
+		     stat_tx_retransmit_pdu,
+		     stat_tx_retransmit_bytes,
+		     stat_tx_retransmit_pdu_by_status,
+		     stat_tx_retransmit_bytes_by_status);
+		
+	
+	len+=sprintf(&buffer[len],"[RLC] DCCH Mode %s, NB_RX_DATA   = %d (bytes %d)\tNB_RX_CONTROL %d (bytes %d)\tNB_RX_DUPL %d (bytes %d)\tNB_RX_DROP = %d (bytes %d)\tNB_RX_OUT_OF_WINDOW = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_rx_data_pdu,
+		     stat_rx_data_bytes,
+		     stat_rx_control_pdu,
+		     stat_rx_control_bytes,
+		     stat_rx_data_pdus_duplicate,
+		     stat_rx_data_bytes_duplicate,
+		     stat_rx_data_pdu_dropped,
+		     stat_rx_data_bytes_dropped,
+		     stat_rx_data_pdu_out_of_window,
+		     stat_rx_data_bytes_out_of_window);
+	
+
+	len+=sprintf(&buffer[len],"[RLC] DCCH Mode %s, RX_REODERING_TIMEOUT = %d\tRX_POLL_RET_TIMEOUT %d\tRX_PROHIBIT_TIME_OUT %d\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_timer_reordering_timed_out,
+		     stat_timer_poll_retransmit_timed_out,
+		     stat_timer_status_prohibit_timed_out);
+
+	len+=sprintf(&buffer[len],"[RLC] DCCH Mode %s, NB_SDU_TO_RX = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_rx_pdcp_sdu,
+		     stat_rx_pdcp_bytes);
+      }
+      
+      rlc_status = rlc_stat_req(&ctxt,
+				SRB_FLAG_NO,
+				DTCH-2, // DRB_IDENTITY
+				&stat_rlc_mode,
+				&stat_tx_pdcp_sdu,
+				&stat_tx_pdcp_bytes,
+				&stat_tx_pdcp_sdu_discarded,
+				&stat_tx_pdcp_bytes_discarded,
+				&stat_tx_data_pdu,
+				&stat_tx_data_bytes,
+				&stat_tx_retransmit_pdu_by_status,
+				&stat_tx_retransmit_bytes_by_status,
+				&stat_tx_retransmit_pdu,
+				&stat_tx_retransmit_bytes,
+				&stat_tx_control_pdu,
+				&stat_tx_control_bytes,
+				&stat_rx_pdcp_sdu,
+				&stat_rx_pdcp_bytes,
+				&stat_rx_data_pdus_duplicate,
+				&stat_rx_data_bytes_duplicate,
+				&stat_rx_data_pdu,
+				&stat_rx_data_bytes,
+				&stat_rx_data_pdu_dropped,
+				&stat_rx_data_bytes_dropped,
+				&stat_rx_data_pdu_out_of_window,
+				&stat_rx_data_bytes_out_of_window,
+				&stat_rx_control_pdu,
+				&stat_rx_control_bytes,
+				&stat_timer_reordering_timed_out,
+				&stat_timer_poll_retransmit_timed_out,
+				&stat_timer_status_prohibit_timed_out);
+      
+      if (rlc_status == RLC_OP_STATUS_OK) {
+	len+=sprintf(&buffer[len],"[RLC] DTCH Mode %s, NB_SDU_TO_TX = %d (bytes %d)\tNB_SDU_TO_TX_DISC %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_tx_pdcp_sdu,
+		     stat_tx_pdcp_bytes,
+		     stat_tx_pdcp_sdu_discarded,
+		     stat_tx_pdcp_bytes_discarded);
+	
+	len+=sprintf(&buffer[len],"[RLC] DTCH Mode %s, NB_TX_DATA   = %d (bytes %d)\tNB_TX_CONTROL %d (bytes %d)\tNB_TX_RETX %d (bytes %d)\tNB_TX_RETX_BY_STATUS = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_tx_data_pdu,
+		     stat_tx_data_bytes,
+		     stat_tx_control_pdu,
+		     stat_tx_control_bytes,
+		     stat_tx_retransmit_pdu,
+		     stat_tx_retransmit_bytes,
+		     stat_tx_retransmit_pdu_by_status,
+		     stat_tx_retransmit_bytes_by_status);
+		
+	
+	len+=sprintf(&buffer[len],"[RLC] DTCH Mode %s, NB_RX_DATA   = %d (bytes %d)\tNB_RX_CONTROL %d (bytes %d)\tNB_RX_DUPL %d (bytes %d)\tNB_RX_DROP = %d (bytes %d)\tNB_RX_OUT_OF_WINDOW = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_rx_data_pdu,
+		     stat_rx_data_bytes,
+		     stat_rx_control_pdu,
+		     stat_rx_control_bytes,
+		     stat_rx_data_pdus_duplicate,
+		     stat_rx_data_bytes_duplicate,
+		     stat_rx_data_pdu_dropped,
+		     stat_rx_data_bytes_dropped,
+		     stat_rx_data_pdu_out_of_window,
+		     stat_rx_data_bytes_out_of_window);
+	
+
+	len+=sprintf(&buffer[len],"[RLC] DTCH Mode %s, RX_REODERING_TIMEOUT = %d\tRX_POLL_RET_TIMEOUT %d\tRX_PROHIBIT_TIME_OUT %d\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_timer_reordering_timed_out,
+		     stat_timer_poll_retransmit_timed_out,
+		     stat_timer_status_prohibit_timed_out);
+
+	len+=sprintf(&buffer[len],"[RLC] DTCH Mode %s, NB_SDU_TO_RX = %d (bytes %d)\n",
+		     (stat_rlc_mode==RLC_MODE_AM)? "AM": (stat_rlc_mode==RLC_MODE_UM)?"UM":"NONE",
+		     stat_rx_pdcp_sdu,
+		     stat_rx_pdcp_bytes);
+
+      }  		
     }
   }
-
+  
   return len + 1 /* SR: for trailing \0 */;
 }
 
diff --git a/openair2/UTIL/OMG/static.c b/openair2/UTIL/OMG/static.c
index 16ec05b751..f882ae7fe6 100644
--- a/openair2/UTIL/OMG/static.c
+++ b/openair2/UTIL/OMG/static.c
@@ -134,6 +134,7 @@ place_static_node (node_struct * node)
   LOG_I (OMG,
          "[STATIC] Initial position of node ID: %d type(%d: %s):  (X = %.2f, Y = %.2f) speed = 0.0\n",
          node->id, node->type, (node->type==eNB)?"eNB":(node->type==UE)?"UE":"Relay", node->x_pos, node->y_pos);
+
   node_vector_end[node->type] =
     (node_list *) add_entry (node, node_vector_end[node->type]);
 
diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c
index ae75f6aae8..f6d94ee31b 100644
--- a/targets/SIMU/USER/oaisim_config.c
+++ b/targets/SIMU/USER/oaisim_config.c
@@ -458,7 +458,7 @@ int olg_config(void)
    set_comp_log(RRC,  LOG_DEBUG, 0x15,1);
    set_comp_log(OCM,  LOG_ERR, 0x15,20);
    set_comp_log(OTG,  LOG_DEBUG, 0x15,1);
-   set_comp_log(OMG,  LOG_INFO, 0x15,1);
+   set_comp_log(OMG,  LOG_NOTICE, 0x15,1);
    set_comp_log(OPT,  LOG_ERR, 0x15,1);
 
 
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index b8c3540f2e..faf6878f25 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -115,7 +115,7 @@ double      **ShaF                  = NULL;
 double      **s_re, **s_im, **r_re, **r_im, **r_re0, **r_im0;
 node_list*     ue_node_list          = NULL;
 node_list*     enb_node_list         = NULL;
-int           omg_period            = 0;
+int           omg_period            = 10000;
 int           pdcp_period           = 0;
 int           cba_backoff           = 30;
 // time calibration for soft realtime mode
-- 
GitLab