diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 6c176a75c24a1c1945d84791e377d12aed305b59..810d3465c2ee651ab9227d7b1e62505633de99b4 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -21,7 +21,7 @@
 
 # Author: laurent THOMAS, Lionel GAUTHIER
 
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.0)
 
 #############################################
 # Base directories, compatible with legacy OAI building
@@ -169,11 +169,12 @@ endif()
 set(CMAKE_C_FLAGS
   "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
 # add autotools definitions that were maybe used!
+set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
 set(CMAKE_C_FLAGS
-  "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
+	"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}"
 )
 set(CMAKE_CXX_FLAGS
-  "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
+	"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D${MKVER}"
 )
 add_definitions("-DASN_DISABLE_OER_SUPPORT")
 
@@ -477,7 +478,8 @@ add_dependencies(X2AP_ENB rrc_flag x2_flag)
 add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
 add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
 
-add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
+add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR" "OAI_SIMU")
+
 
 add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
 #NOKIA config enhancement
@@ -585,6 +587,8 @@ set(HWLIB_TCP_BRIDGE_OAI_SOURCE
 add_library(tcp_bridge_oai MODULE ${HWLIB_TCP_BRIDGE_OAI_SOURCE} )
 set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
 
+add_library(rfsimulator MODULE ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c)
+
 ##########################################################
 
 include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
@@ -1949,6 +1953,8 @@ add_executable(lte-softmodem
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/COMMON/create_tasks.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
+  ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index d14bd3ec6edd36fa031d252cf2a4aea6d845a6e1..e77dbab0497ac39f9c403bb0d014e7053b71ab9b 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -76,7 +76,7 @@ trap handle_ctrl_c INT
 function print_help() {
   echo_info "
 This program installs OpenAirInterface Software
-You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
+You should have ubuntu 16.xx or 18.04 updated
 Options
 -h
    This help
@@ -167,6 +167,9 @@ Options
 --basic-simulator
    Generates a basic [1 UE + 1 eNB + no channel] simulator.
    See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation.
+--rfsimulator
+   Generate virtual RF driver
+   to use it, set the environement variable RFSIMULATOR to \"enb\" in the eNB and to the eNB IP address in the UEs
 Usage (first build):
  NI/ETTUS B201  + COTS UE : ./build_oai -I  --eNB -x --install-system-files -w USRP
 Usage (Regular):
@@ -234,25 +237,21 @@ function main() {
             echo_info "Setting release to: $REL"
             shift 2;;
        -w | --hardware)
-            HW="$2" #"${i#*=}"
-            # Use OAI_USRP  as the key word USRP is used inside UHD driver           
-            if [ "$HW" != "BLADERF" -a  "$HW" != "USRP" -a "$HW" != "LMSSDR" -a  "$HW" != "None" -a  "$HW" != "EXMIMO" -a  "$HW" != "IRIS"  ] ; then 
-		echo_fatal "Unknown HW type $HW will exit..."		
-	    else
-		if [ "$HW" == "USRP" ] ; then 
-		    HW="OAI_USRP"
-		fi 
-		if [ "$HW" == "BLADERF" ] ; then 
-		    HW="OAI_BLADERF"
-		fi
-		if [ "$HW" == "LMSSDR" ] ; then 
-		    HW="OAI_LMSSDR"
-		fi 
-                if [ "$HW" == "IRIS" ] ; then
-                    HW="OAI_IRIS"
-                fi
-		echo_info "Setting hardware to: $HW"
-	    fi
+                # Use OAI_USRP  as the key word USRP is used inside UHD driver
+                case "$2" in
+                    "EXMIMO")
+                        HW="EXMIMO"
+                        ;;
+                    "USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "SIMU")
+                        HW="OAI_"$2
+                        ;;
+                    "None")
+                        HW="None"
+                        ;;
+                    *)
+                        echo_fatal "Unknown HW type $HW: exit..."
+                esac
+	echo_info "Setting hardware to: $HW"
             shift 2;;
 	-t | --transport_protocol)
             TP="$2" #"${i#*=}"
@@ -374,6 +373,10 @@ function main() {
             BASIC_SIMULATOR=1
             echo_info "Compiling the basic simulator"
             shift 1;;
+	--rfsimulator)
+	    RFSIMULATOR=true
+	    echo_info "Compiling the RF simulator"
+	    shift 1;;
         -h | --help)
             print_help
             exit 1;;
@@ -386,56 +389,35 @@ function main() {
   
   CMAKE_CMD="$CMAKE_CMD .."
   echo_info "CMAKE_CMD=$CMAKE_CMD"
-  if [ "$eNB" = "1" ] && [ "$UE" = "1" ]; then
-    echo_error "Cannot build UE and eNB on one build_oai execution"
-    echo_error "use 2 build_oai invocations"
-    exit
-  fi  
-  #########################################################
-  # check validity of HW and TP parameters for eNB
-  #########################################################
-  # to be discussed
-  
-  if [ "$eNB" = "1" ] ; then
-      if [ "$HW" = "None" -a  "$TP" = "None" ] ; then
-	  echo_fatal "Define a local radio head (e.g. -w EXMIMO) or a transport protocol (e.g. -t ETHERNET) to communicate with a remote radio head!"
-      fi
-      if [ "$HW" = "None" ] ; then 
-	  echo_info "No radio head has been selected (HW set to $HW)"	
-      fi
-      if [ "$TP" = "None" ] ; then
-	  echo_info "No transport protocol has been selected (TP set to $TP)"	
-      fi
-  fi
-  
-  echo_info "RF HW set to $HW" 
-  #Now we set flags to enable deadline scheduler settings
-  #By default: USRP: disable, 
-  #By default: BLADERF: enable,
-  #By default: EXMIMO: enable
-  if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
-     if [ "$HW" = "EXMIMO" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="True"
-     elif [ "$HW" = "ETHERNET" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="False"
-     elif [ "$HW" = "OAI_USRP" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="False"
-     elif [ "$HW" = "OAI_BLADERF" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="False"
-     elif [ "$HW" = "OAI_LMSSDR" ] ; then     
-        DEADLINE_SCHEDULER_FLAG_USER="False" 
-     elif [ "$HW" = "OAI_IRIS" ] ; then
-        DEADLINE_SCHEDULER_FLAG_USER="False"
-     elif [ "$HW" = "None" ] ; then 
-        DEADLINE_SCHEDULER_FLAG_USER="False"
-     else 
-        echo_error "Unknown HW type $HW. Exiting now..."
-        exit 
-     fi
-  else
-     DEADLINE_SCHEDULER_FLAG_USER=$FORCE_DEADLINE_SCHEDULER_FLAG_USER
-  fi
-
+    #########################################################
+    # check validity of HW and TP parameters for eNB
+    #########################################################
+    # to be discussed
+    
+    if [ "$eNB" = "1" ] ; then
+	if [ "$HW" = "None" -a  "$TP" = "None" ] ; then
+            echo_fatal "Define a local radio head (e.g. -w EXMIMO) or a transport protocol (e.g. -t ETHERNET) to communicate with a remote radio head!"
+	fi
+	if [ "$HW" = "None" ] ; then 
+            echo_info "No radio head has been selected (HW set to $HW)"   
+	fi
+	if [ "$TP" = "None" ] ; then
+            echo_info "No transport protocol has been selected (TP set to $TP)"   
+	fi
+    fi
+    
+    echo_info "RF HW set to $HW" 
+    # If the user doesn't specify the Linux scheduler to use, we set a value
+    if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
+      case "$HW" in
+ 	  "EXMIMO")
+               DEADLINE_SCHEDULER_FLAG_USER="True"
+              ;;
+ 	  *)
+              DEADLINE_SCHEDULER_FLAG_USER="False"
+              ;;
+      esac
+    fi
   #Disable CPU Affinity for deadline scheduler
   if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then 
      CPU_AFFINITY_FLAG_USER="False"
@@ -515,27 +497,20 @@ function main() {
   
   echo_info "3. building the compilation directives ..."
 
-  DIR=$OPENAIR_DIR/cmake_targets
-  if [ "$NOS1" =  "1" ] ; then
-      lte_build_dir=lte_noS1_build_oai
-      if [ "$eNB" = "1" ] ; then
-         lte_exec=lte-softmodem-nos1
-      fi
-      if [ "$UE" = "1" ] ; then
-         lte_exec=lte-uesoftmodem-nos1
-      fi
-  else
-      lte_build_dir=lte_build_oai
-      if [ "$eNB" = "1" ] ; then
-         lte_exec=lte-softmodem
-      fi
-      if [ "$UE" = "1" ] ; then
-         lte_exec=lte-uesoftmodem
-      fi
-  fi
-  if [ "$T_TRACER" =  "False" ] ; then
-      lte_build_dir=${lte_build_dir}_noLOG
-  fi
+    DIR=$OPENAIR_DIR/cmake_targets
+    
+    if [ "$T_TRACER" =  "False" ] ; then
+        noLOGDirsuffix="_noLOG"
+    fi
+    if [ "$NOS1" =  "1" ] ; then
+        noS1Dir="_noS1"
+        bin_suffix="-nos1"
+    else
+        lte_build_dir=lte_build_oai
+        bin_suffix=""
+    fi
+
+    lte_build_dir="lte${noS1Dir}_build_oai${noLOGDirsuffix}"
 # configuration module libraries, one currently available, using libconfig 
   config_libconfig_shlib=params_libconfig
   
@@ -580,8 +555,8 @@ function main() {
     eval $CMAKE_CMD
   fi
 
-  if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
-    echo_info "Compiling $lte_exec"
+  if [ "$eNB" = "1" ] ; then
+    lte_exec=lte-softmodem${bin_suffix}
     compilations \
 	  $lte_build_dir $lte_exec \
 	  $lte_exec $dbin/$lte_exec.$REL
@@ -605,7 +580,29 @@ function main() {
     fi
   fi
 
-  if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
+  if [ "$UE" = 1  ] ; then
+        lte_exec=lte-uesoftmodem${bin_suffix}
+        compilations \
+            $lte_build_dir $lte_exec \
+            $lte_exec $dbin/$lte_exec.$REL
+        
+        # mandatory shared lib
+        compilations \
+            $lte_build_dir $config_libconfig_shlib \
+            lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
+        compilations \
+            $lte_build_dir coding \
+            libcoding.so $dbin/libcoding.so
+        
+        if [ "$NOS1" = "1" ] ; then
+            compilations \
+                $lte_build_dir nasmesh \
+                CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+            compilations \
+                $lte_build_dir rb_tool \
+                rb_tool $dbin/rb_tool
+            cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+        else        
     # ue_ip driver compilation
     echo_info "Compiling UE specific part"
     compilations \
@@ -645,6 +642,7 @@ function main() {
       echo_warning "not generated UE NAS files: binaries not found"
     fi
   fi
+    fi
 
   if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
     cd $OPENAIR_DIR/cmake_targets/lte-simulators
@@ -709,103 +707,108 @@ function main() {
     cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
   fi
 
-
-
-  # Telnet server compilation
-  #####################
-  if [ "$BUILD_TELNETSRV" = "1" ] ; then
-              build_dir=$lte_build_dir
-              compilations \
-                  $build_dir telnetsrv \
-                  libtelnetsrv.so $dbin/libtelnetsrv.so
-
-  fi 
-  # Telnet server compilation
-  #####################
-  if [ "$MSC_GEN" = "1" ] ; then
-              build_dir=$lte_build_dir
-              compilations \
-                  $build_dir msc \
-                  libmsc.so $dbin/libmsc.so
-
-  fi  
-  # build RF device and transport protocol libraries
-  #####################################
-  if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
-
-      build_dir=$lte_build_dir	  
-
-      # build RF device libraries
-      if [ "$HW" != "None" ] ; then
-	  rm -f liboai_device.so
-	  rm -f $dbin/liboai_device.so
-
-	  # link liboai_device.so with the selected RF device library
-	  if [ "$HW" == "EXMIMO" ] ; then
-	      compilations \
-		  $build_dir oai_exmimodevif \
-		  liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
-
-	      ln -sf liboai_exmimodevif.so liboai_device.so
-	      ln -sf $dbin/liboai_exmimodevif.so.$REL $dbin/liboai_device.so
-	      echo_info "liboai_device.so is linked to EXMIMO device library"       
-	  elif [ "$HW" == "OAI_USRP" ] ; then
-              compilations \
-                  $build_dir oai_usrpdevif \
-                  liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
-
-	      ln -sf liboai_usrpdevif.so liboai_device.so
-	      ln -sf $dbin/liboai_usrpdevif.so.$REL $dbin/liboai_device.so
-	      echo_info "liboai_device.so is linked to USRP device library"        
-	  elif [ "$HW" == "OAI_BLADERF" ] ; then
-	      if [ -f "/usr/include/libbladeRF.h" ] ; then
-		  compilations \
-		      $build_dir oai_bladerfdevif \
-		      liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
-	      fi
-
-	      ln -sf liboai_bladerfdevif.so liboai_device.so
-	      ln -sf $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
-	      echo_info "liboai_device.so is linked to BLADERF device library"	 
-	  elif [ "$HW" == "OAI_LMSSDR" ] ; then
-#	      if [ -f "/usr/include/libbladeRF.h" ] ; then
-		  compilations \
-		      $build_dir oai_lmssdrdevif \
-		      liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
-#	      fi
-
-	      ln -sf liboai_lmssdrdevif.so liboai_device.so
-	      ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
-	      echo_info "liboai_device.so is linked to LMSSDR device library"	 
-          elif [ "$HW" == "OAI_IRIS" ] ; then
-                  compilations \
-                      $build_dir oai_irisdevif \
-                      liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
-
-              ln -s liboai_irisdevif.so liboai_device.so
-              ln -s $dbin/liboai_irisdevif.so.$REL $dbin/liboai_device.so
-              echo_info "liboai_device.so is linked to IRIS device library"
-	  else 
-	      echo_info "liboai_device.so is not linked to any device library"	    
-	  fi
-      fi
-      
-      # build trasport protocol libraries (currently only ETHERNET is available)
-      if [ "$TP" != "None" ] ; then
-	  rm -f liboai_transpro.so
-	  rm -f $dbin/liboai_transpro.so
-
-	  if [ "$TP" == "ETHERNET" ] ; then
-	      compilations \
-		  $build_dir oai_eth_transpro \
-		  liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
-	      ln -sf liboai_eth_transpro.so liboai_transpro.so
-	      ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
-	      echo_info "liboai_transpro.so is linked with ETHERNET library"	 
-	  fi      
-      fi
-fi
-
+    # Telnet server compilation
+    #####################
+    if [ "$BUILD_TELNETSRV" = "1" ] ; then
+        compilations \
+            $lte_build_dir telnetsrv \
+            libtelnetsrv.so $dbin/libtelnetsrv.so
+        
+    fi
+    # msc library compilation
+    #####################
+    if [ "$MSC_GEN" = "1" ] ; then
+        compilations \
+            $lte_build_dir msc \
+            libmsc.so $dbin/libmsc.so
+        
+    fi
+    # build RF device and transport protocol libraries
+    #####################################
+    if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
+        
+        # build RF device libraries
+        if [ "$HW" != "None" ] ; then
+            rm -f liboai_device.so
+            rm -f $dbin/liboai_device.so
+            
+            # link liboai_device.so with the selected RF device library
+            if [ "$HW" == "EXMIMO" ] ; then
+                compilations \
+                    $lte_build_dir oai_exmimodevif \
+                    liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
+                
+                ln -sf liboai_exmimodevif.so liboai_device.so
+                ln -sf $dbin/liboai_exmimodevif.so.$REL $dbin/liboai_device.so
+                echo_info "liboai_device.so is linked to EXMIMO device library"
+            elif [ "$HW" == "OAI_USRP" ] ; then
+                compilations \
+                    $lte_build_dir oai_usrpdevif \
+                    liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
+                
+                ln -sf liboai_usrpdevif.so liboai_device.so
+                ln -sf $dbin/liboai_usrpdevif.so.$REL $dbin/liboai_device.so
+                echo_info "liboai_device.so is linked to USRP device library"
+            elif [ "$HW" == "OAI_BLADERF" ] ; then
+                if [ -f "/usr/include/libbladeRF.h" ] ; then
+                    compilations \
+                        $lte_build_dir oai_bladerfdevif \
+                        liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
+                fi
+                
+                ln -sf liboai_bladerfdevif.so liboai_device.so
+                ln -sf $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
+                echo_info "liboai_device.so is linked to BLADERF device library"
+            elif [ "$HW" == "OAI_LMSSDR" ] ; then
+                #       if [ -f "/usr/include/libbladeRF.h" ] ; then
+                compilations \
+                    $lte_build_dir oai_lmssdrdevif \
+                    liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
+                #       fi
+                
+                ln -sf liboai_lmssdrdevif.so liboai_device.so
+                ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
+                echo_info "liboai_device.so is linked to LMSSDR device library"
+            elif [ "$HW" == "OAI_IRIS" ] ; then
+                compilations \
+                    $lte_build_dir oai_irisdevif \
+                    liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
+                
+                ln -s liboai_irisdevif.so liboai_device.so
+                ln -s $dbin/liboai_irisdevif.so.$REL $dbin/liboai_device.so
+                echo_info "liboai_device.so is linked to IRIS device library"
+            else
+                echo_info "liboai_device.so is not linked to any device library"
+            fi
+        fi
+        
+        # build simulators devices
+        echo_info "Compiling rfsimulator"
+        compilations \
+            $lte_build_dir rfsimulator \
+            librfsimulator.so $dbin/librfsimulator.so.$REL
+        echo_info "Compiling basicsimulator"
+        compilations \
+            $lte_build_dir tcp_bridge_oai \
+            libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
+        # build transport protocol libraries (currently only ETHERNET is available)
+
+        rm -f liboai_transpro.so
+        rm -f $dbin/liboai_transpro.so
+        compilations \
+            $lte_build_dir oai_eth_transpro \
+            liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
+        ln -sf liboai_eth_transpro.so liboai_transpro.so
+        ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
+        echo_info "liboai_transpro.so is linked to ETHERNET transport"
+    fi
+    
+    if [ "$RFSIMULATOR" == "true" -o "$HW" == "OAI_SIMU" ] ; then
+        echo_info "Compiling rfsimulator"
+        compilations \
+            $lte_build_dir rfsimulator \
+            librfsimulator.so $dbin/librfsimulator.so.$REL
+    fi
 
   # Doxygen Support
   #####################
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index dd8c2e54dba3f4229fae2c3eb9f1e24076364c33..dc8ac26d0d60e2c5f4410ce1202896d9a8d4ed56 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -33,7 +33,7 @@
 #include "phy_init.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 #include "PHY/LTE_TRANSPORT/transport_common_proto.h"
-
+#include "targets/RT/USER/lte-softmodem.h"
 extern PHY_VARS_eNB *eNB;
 extern PHY_VARS_UE *UE;
 extern RU_t *ru;
@@ -169,12 +169,12 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
   }
   else ru->N_TA_offset=0;
 
-#if BASIC_SIMULATOR
+  if (IS_SOFTMODEM_BASICSIM) 
   /* this is required for the basic simulator in TDD mode
    * TODO: find a proper cleaner solution
    */
-  UE->N_TA_offset = 0;
-#endif
+    UE->N_TA_offset = 0;
+
 
   printf("Done lte_param_init\n");
 
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index 6b5863edc96e0acbb620272b0e583f9b2ae0f231..d4e870fb0c8555f6d97c82fba3d9acdc29232a9b 100644
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -45,7 +45,7 @@
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "PHY/LTE_TRANSPORT/transport_extern.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
-
+#include "targets/RT/USER/lte-softmodem.h"
 //#define DEBUG_DCI_ENCODING 1
 //#define DEBUG_DCI_DECODING 1
 //#define DEBUG_PHY
@@ -328,26 +328,25 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
   y[0] = &yseq0[0];
   y[1] = &yseq1[0];
 
-#if BASIC_SIMULATOR
+  if (IS_SOFTMODEM_BASICSIM){
   /* this should be the normal case
    * but it has to be validated for all the various cases
    * so let's just do it for the basic simulator
    */
-  memset(e, 2, DCI_BITS_MAX);
-#else
-#if 1
+//  memset(e, 2, DCI_BITS_MAX);
+  } else {
   // reset all bits to <NIL>, here we set <NIL> elements as 2
   // memset(e, 2, DCI_BITS_MAX);
   // here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
-  for (i=0; i<DCI_BITS_MAX; i++)
-    e[i]=taus()&1;
-#endif
+    for (i=0; i<DCI_BITS_MAX; i++)
+      e[i]=taus()&1;
+
 
   /* clear all bits, the above code may generate too much false detections
    * (not sure about this, to be checked somehow)
    */
   //memset(e, 0, DCI_BITS_MAX);
-#endif /* BASIC_SIMULATOR */
+  }/* BASIC_SIMULATOR */
 
   e_ptr = e;
 
diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c
index 33bd5cc7e8246f06b49ec8e85b30072cd4d10f33..e83e2c4d9dcdb9f5ec5d14623058626b1f780ea2 100644
--- a/openair1/PHY/LTE_TRANSPORT/pss.c
+++ b/openair1/PHY/LTE_TRANSPORT/pss.c
@@ -38,6 +38,7 @@
 //#include "defs.h"
 #include "PHY/defs_eNB.h"
 #include "PHY/phy_extern.h"
+#include "targets/RT/USER/lte-softmodem.h"
 
 int generate_pss(int32_t **txdataF,
                  short amp,
@@ -75,10 +76,9 @@ int generate_pss(int32_t **txdataF,
   a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
   //printf("[PSS] amp=%d, a=%d\n",amp,a);
 
-#if BASIC_SIMULATOR
+  if (IS_SOFTMODEM_BASICSIM)
   /* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
-  a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
-#endif
+    a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
 
   Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
 
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 64a41e829867e18e47d6aac515843822b20cfaa5..4af273b8b006b563d5aa3124bb2970882d334d69 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -2139,5 +2139,7 @@ int main(int argc, char **argv) {
   else
     return(0);
 }
-
-
+/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
+uint64_t get_softmodem_optmask(void) {
+  return 0;
+}
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 0c17e21acc647ea7489860fed86e7fd73a3ffd22..221cc708f3a6e0d11a5b8dfd5fd4c0a691ae195b 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -1509,5 +1509,7 @@ int main(int argc, char **argv) {
   return(0);
 }
 
-
-
+/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
+uint64_t get_softmodem_optmask(void) {
+  return 0;
+}
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index cddd409922bf7676c325083593bb626a49f1f5c4..d70d7030abb6b41df074ef41b22f790bb352dfa8 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -810,32 +810,33 @@ rrc_ue_establish_drb(
                     (eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
                     RADIO_ACCESS_BEARER,Rlc_info_um);
    */
-  if(PDCP_USE_NETLINK) {
-#   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
+  if(!EPC_MODE_ENABLED) {
+//#   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
     ip_addr_offset3 = 0;
     ip_addr_offset4 = 1;
     LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oai%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
           ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1);
-    oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP,   // interface_id
+    oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP+1,   // interface_id
                         ip_addr_offset3+ue_mod_idP+1, // third_octet
-                        ip_addr_offset4+ue_mod_idP+1); // fourth_octet
+                        ip_addr_offset4+ue_mod_idP+1, // fourth_octet
+                        "ue");                        // interface suffix
 
-    if (oip_ifup == 0 ) { // interface is up --> send a config the DRB
-      LOG_I(OIP,"[UE %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
+    if (oip_ifup == 0 && (!IS_SOFTMODEM_NOKRNMOD)) { // interface is up --> send a config the DRB
+      LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
             ue_mod_idP,
             ip_addr_offset3+ue_mod_idP,
-            (long int)((eNB_index * maxDRB) + DRB_config->drb_Identity));
+            (long int)((eNB_index * LTE_maxDRB) + DRB_config->drb_Identity));
       rb_conf_ipv4(0,//add
                    ue_mod_idP,//cx align with the UE index
                    ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
-                   (eNB_index * maxDRB) + DRB_config->drb_Identity,//rb
+                   (eNB_index * LTE_maxDRB) + DRB_config->drb_Identity,//rb
                    0,//dscp
                    ipv4_address(ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1),//saddr
                    ipv4_address(ip_addr_offset3+ue_mod_idP+1,eNB_index+1));//daddr
       LOG_D(RRC,"[UE %d] State = Attached (eNB %d)\n",ue_mod_idP,eNB_index);
     }
 
-#    endif
+//#    endif
   }
 
   return(0);
@@ -1930,7 +1931,7 @@ rrc_ue_process_rrcConnectionReconfiguration(
 
           for (i=0; (
                  i<rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
-               && (i < maxDRB); i++) {
+               && (i < LTE_maxDRB); i++) {
             // why minus 1 in RRC code for drb_identity ?
             connection_reestablishment_ind.drb_id[i]   =
               rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
@@ -2241,7 +2242,7 @@ rrc_ue_decode_dcch(
 
                 for (i=0; (
                        i<dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
-                     && (i < maxDRB); i++) {
+                     && (i < LTE_maxDRB); i++) {
                   // why minus 1 in RRC code for drb_identity ?
                   connection_reconfiguration_ho_ind.drb_id[i]   =
                     dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
@@ -2295,7 +2296,7 @@ rrc_ue_decode_dcch(
 
                 for (i=0; (
                        i<dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
-                     && (i < maxDRB); i++) {
+                     && (i < LTE_maxDRB); i++) {
                   // why minus 1 in RRC code for drb_identity ?
                   connection_reconfiguration_ind.drb_id[i]   =
                     dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index 3503956b108746292fbb28eacea58b1fe0c821d4..d377f3a8d6be01cfb53025c9412544d7349bdcd5 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -6272,30 +6272,30 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
           LOG_D(RRC,
                 "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
                 ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
-
-          if (PDCP_USE_NETLINK && (!LINK_ENB_PDCP_TO_GTPV1U)) {
+          if (!EPC_MODE_ENABLED) {
+//          if (PDCP_USE_NETLINK && (!LINK_ENB_PDCP_TO_GTPV1U)) {
             // can mean also IPV6 since ether -> ipv6 autoconf
-#   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET)
+//#   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET)
             LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n",
                   ctxt_pP->module_id,
                   ctxt_pP->module_id);
             oip_ifup = nas_config(
                          ctxt_pP->module_id,   // interface index
-                         ctxtReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA_pP->module_id + 1,   // thrid octet
-                         ctxt_pP->module_id + 1);  // fourth octet
-
+                         ctxt_pP->module_id + 1,   // thrid octet
+                         ctxt_pP->module_id + 1,   // fourth octet
+                         "enb");
             if (oip_ifup == 0) {    // interface is up --> send a config the DRB
               module_id_t ue_module_id;
               dest_ip_offset = 8;
               LOG_I(OIP,
                     "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
                     ctxt_pP->module_id, ctxt_pP->module_id,
-                    (long int)((ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity));
+                    (long int)((ue_context_pP->local_uid * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity));
               ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid];
               rb_conf_ipv4(0, //add
                            ue_module_id,  //cx
                            ctxt_pP->module_id,    //inst
-                           (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB
+                           (ue_module_id * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB
                            0,    //dscp
                            ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1),  //saddr
                            ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1));  //daddr
@@ -6303,7 +6303,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                     ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
             }
 
-#   endif
+//#   endif
           }
 
           LOG_D(RRC,
diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c
index c0f6d622aad6e20d30d63541eb470b968339dd3c..96ef60c13ad64114e6b3dbbd42536e745fbc0de8 100644
--- a/openair2/RRC/NAS/nas_config.c
+++ b/openair2/RRC/NAS/nas_config.c
@@ -44,7 +44,7 @@
 
 #include "nas_config.h"
 #include "common/utils/LOG/log.h"
-
+#include "targets/RT/USER/lte-softmodem.h"
 
 //default values according to the examples,
 
@@ -236,18 +236,20 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
 }
 
 // non blocking full configuration of the interface (address, and the two lest octets of the address)
-int nas_config(int interface_id, int thirdOctet, int fourthOctet)
+int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifsuffix)
 {
   //char buf[5];
   char ipAddress[20];
   char broadcastAddress[20];
-  char interfaceName[8];
+  char interfaceName[20];
   int returnValue;
   sprintf(ipAddress, "10.0.%d.%d", thirdOctet,fourthOctet);
 
   sprintf(broadcastAddress, "10.0.%d.255", thirdOctet);
 
-  sprintf(interfaceName, "oai%d", interface_id);
+
+  sprintf(interfaceName, "%s%s%d", UE_NAS_USE_TUN?"oaitun_":"oip",
+          UE_NAS_USE_TUN?ifsuffix:"",interface_id);
 
   bringInterfaceUp(interfaceName, 0);
   // sets the machine address
diff --git a/openair2/RRC/NAS/nas_config.h b/openair2/RRC/NAS/nas_config.h
index 4426ca9a1aabfd2eb9be65ffb2bb9886f72534fe..c6c60baf0ba569691ab738ed150e69e398003aae 100644
--- a/openair2/RRC/NAS/nas_config.h
+++ b/openair2/RRC/NAS/nas_config.h
@@ -54,7 +54,7 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
  * \note
  * @ingroup  ?????
  */
-int nas_config(int interface_id, int thirdOctet, int fourthOctet);
+int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifsuffix);
 
 /*! \fn int  blocking_NAS_config(char*, char*, char*, char*)
  * \brief This function initializes the nasmesh interface, in a blocking way,
diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c
index b62eb9d2dfe3853101aaee71fe082bb5f71cd764..06b08dfc40d3bcb1379ce1e18aa1ff74a138000c 100644
--- a/targets/ARCH/COMMON/common_lib.c
+++ b/targets/ARCH/COMMON/common_lib.c
@@ -37,6 +37,7 @@
 
 #include "common_lib.h"
 #include "common/utils/load_module_shlib.h"
+#include "targets/RT/USER/lte-softmodem.h"
 
 int set_device(openair0_device *device) {
 
@@ -96,13 +97,20 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
   loader_shlibfunc_t shlib_fdesc[1];
   int ret=0;
   char *libname;
-  if (flag == RAU_LOCAL_RADIO_HEAD) {
+  if ( IS_SOFTMODEM_BASICSIM ) {
+      libname=OAI_BASICSIM_LIBNAME;
+      shlib_fdesc[0].fname="device_init";
+  } else 
+  if ( IS_SOFTMODEM_RFSIM ) {
+      libname=OAI_RFSIM_LIBNAME;
+      shlib_fdesc[0].fname="device_init";
+  } else if (flag == RAU_LOCAL_RADIO_HEAD) {
       libname=OAI_RF_LIBNAME;
       shlib_fdesc[0].fname="device_init";
-    } else {
+  } else {
       libname=OAI_TP_LIBNAME;
       shlib_fdesc[0].fname="transport_init";      
-    } 
+  } 
   ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
   if (ret < 0) {
        fprintf(stderr,"Library %s couldn't be loaded\n",libname);
diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h
index 084ef9fcd9fbc629e6381f2d4a5ef025696f06ec..de9acc3ab5989be22c71a94b215abaf03700c7fb 100644
--- a/targets/ARCH/COMMON/common_lib.h
+++ b/targets/ARCH/COMMON/common_lib.h
@@ -39,7 +39,10 @@
 #define OAI_RF_LIBNAME        "oai_device"
 /* name of shared library implementing the transport */
 #define OAI_TP_LIBNAME        "oai_transpro"
-
+/* name of shared library implementing the basic/rf simulator */
+#define OAI_RFSIM_LIBNAME        "rfsimulator"
+/* name of shared library implementing the basic/rf simulator */
+#define OAI_BASICSIM_LIBNAME        "tcp_bridge_oai"
 /* flags for BBU to determine whether the attached radio head is local or remote */
 #define RAU_LOCAL_RADIO_HEAD  0
 #define RAU_REMOTE_RADIO_HEAD 1
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 89ca097bb5d67684225a77b197905f43d020b0a5..fd84c66c759c912d2daafe0b8e60fe0c1cf564ad 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -1381,12 +1381,12 @@ int setup_RU_buffers(RU_t *ru) {
     else if (frame_parms->N_RB_DL == 50)  ru->N_TA_offset = 624/2;
     else if (frame_parms->N_RB_DL == 25)  ru->N_TA_offset = 624/4;
 
-#if BASIC_SIMULATOR
+  if(IS_SOFTMODEM_BASICSIM)
     /* this is required for the basic simulator in TDD mode
      * TODO: find a proper cleaner solution
      */
     ru->N_TA_offset = 0;
-#endif
+
   }
 
   if (ru->openair0_cfg.mmapped_dma == 1) {
diff --git a/targets/RT/USER/lte-softmodem-common.c b/targets/RT/USER/lte-softmodem-common.c
index 0a637975368e4be03f98f53eb844e17cff13a411..e121e31a3984a90b16f8d209563faa2636cbb291 100644
--- a/targets/RT/USER/lte-softmodem-common.c
+++ b/targets/RT/USER/lte-softmodem-common.c
@@ -58,6 +58,8 @@ void get_common_options(void) {
   uint32_t noS1;
   uint32_t nokrnmod;
   uint32_t nonbiot;
+  uint32_t rfsim;
+  uint32_t basicsim;
   paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
   paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
   checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
@@ -90,6 +92,16 @@ void get_common_options(void) {
     set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
   }
 
+  if (rfsim) {
+    set_softmodem_optmask(SOFTMODEM_RFSIM_BIT);
+  }
+
+  if (basicsim) {
+    set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
+  }
+#if BASIC_SIMULATOR
+    set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT);
+#endif
   if(parallel_config != NULL) set_parallel_conf(parallel_config);
 
   if(worker_config != NULL)   set_worker_conf(worker_config);
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 9c736f8172285af4e0a0d46783d3c24cf160d2b3..60920eb401e97fabfca6265381bc1e4e21bffd7c 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -653,7 +653,7 @@ int main( int argc, char **argv ) {
   LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
   printf("Runtime table\n");
   fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
-  pdcp_module_init( ( IS_SOFTMODEM_NOS1 && !(IS_SOFTMODEM_NOKRNMOD))? (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT);
+  pdcp_module_init( ( IS_SOFTMODEM_NOS1 && !(IS_SOFTMODEM_NOKRNMOD))? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT);
 #
 
   if (RC.nb_inst > 0)  {
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 39f997a71f5a53ceab82a2ee1478a2a6d6d560ff..9b820e6e19e1f95f9f4ca199a2122af5ad149610 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -87,6 +87,7 @@
 #define CONFIG_HLP_PARALLEL_CMD  "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
 #define CONFIG_HLP_WORKER_CMD    "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
 #define CONFIG_HLP_NOS1          "Disable s1 interface\n"
+#define CONFIG_HLP_RFSIM         "Run in rf simulator mode (also known as basic simulator)\n"
 #define CONFIG_HLP_NOKRNMOD      "(noS1 only): Use tun instead of namesh module \n"
 #define CONFIG_HLP_DISABLNBIOT   "disable nb-iot, even if defined in config\n"
 
@@ -199,7 +200,9 @@
     {"numerology" ,             CONFIG_HLP_NUMEROLOGY,  PARAMFLAG_BOOL,         iptr:&NUMEROLOGY,                   defintval:0,                    TYPE_INT,       0},                     \
     {"parallel-config",         CONFIG_HLP_PARALLEL_CMD,0,                      strptr:(char **)&parallel_config,   defstrval:NULL,                 TYPE_STRING,    0},                     \
     {"worker-config",           CONFIG_HLP_WORKER_CMD,  0,                      strptr:(char **)&worker_config,     defstrval:NULL,                 TYPE_STRING,    0},                     \
-    {"noS1",                    CONFIG_HLP_NOS1,        PARAMFLAG_BOOL,         uptr:&noS1,             defintval:0,      TYPE_INT, 0},                     \
+    {"noS1",                    CONFIG_HLP_NOS1,        PARAMFLAG_BOOL,         uptr:&noS1,         defintval:0,      TYPE_INT, 0},                     \
+    {"rfsim",                   CONFIG_HLP_RFSIM,       PARAMFLAG_BOOL,         uptr:&rfsim,        defintval:0,      TYPE_INT, 0},                     \
+    {"basicsim",                CONFIG_HLP_RFSIM,       PARAMFLAG_BOOL,         uptr:&basicsim,     defintval:0,      TYPE_INT, 0},                     \
     {"nokrnmod",                CONFIG_HLP_NOKRNMOD,    PARAMFLAG_BOOL,         uptr:&nokrnmod,     defintval:0,      TYPE_INT, 0},                     \
     {"nbiot-disable",           CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL,         uptr:&nonbiot,      defuintval:0,                   TYPE_INT,       0},                     \
   }
@@ -238,8 +241,8 @@
 #define SOFTMODEM_NOS1_BIT            (1<<0)
 #define SOFTMODEM_NOKRNMOD_BIT        (1<<1)
 #define SOFTMODEM_NONBIOT_BIT         (1<<2)
-#define SOFTMODEM_BASICSIM_BIT        (1<<10)
-
+#define SOFTMODEM_RFSIM_BIT           (1<<10)
+#define SOFTMODEM_BASICSIM_BIT        (1<<11)
 typedef struct {
   uint64_t       optmask;
   THREAD_STRUCT  thread_struct;
@@ -260,6 +263,7 @@ typedef struct {
 #define IS_SOFTMODEM_NOS1            ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
 #define IS_SOFTMODEM_NOKRNMOD        ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
 #define IS_SOFTMODEM_NONBIOT         ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
+#define IS_SOFTMODEM_RFSIM           ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
 #define IS_SOFTMODEM_BASICSIM        ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
 extern uint64_t get_softmodem_optmask(void);
 extern uint64_t set_softmodem_optmask(uint64_t bitmask);
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index f67dbeca7efd0c17557f3e0d35d53028b312d46c..c8709f87c591cac19b36982ef152b87cd3aa8676 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -344,12 +344,12 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
     }
     else UE->N_TA_offset = 0;
 
-#if BASIC_SIMULATOR
+    if( IS_SOFTMODEM_BASICSIM)
     /* this is required for the basic simulator in TDD mode
      * TODO: find a proper cleaner solution
      */
-    UE->N_TA_offset = 0;
-#endif
+      UE->N_TA_offset = 0;
+
 
     if (simL1flag == 1) init_ue_devices(UE);
     LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
@@ -875,9 +875,9 @@ static void *UE_thread_rxn_txnp4(void *arg) {
       exit_fun("noting to add");
     }
     proc->instance_cnt_rxtx--;
-#if BASIC_SIMULATOR
-    if (pthread_cond_signal(&proc->cond_rxtx) != 0) abort();
-#endif
+    if ( IS_SOFTMODEM_BASICSIM ) {
+      if (pthread_cond_signal(&proc->cond_rxtx) != 0) abort(); 
+    }
     if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
       LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXTX\n" );
       exit_fun("noting to add");
@@ -1570,12 +1570,12 @@ void *UE_thread(void *arg) {
   }
 
   while (!oai_exit) {
-#if BASIC_SIMULATOR
-    while (!(UE->proc.instance_cnt_synch < 0)) {
-      printf("ue sync not ready\n");
-      usleep(500*1000);
-    }
-#endif
+    if (IS_SOFTMODEM_BASICSIM) 
+      while (!(UE->proc.instance_cnt_synch < 0)) {
+        printf("ue sync not ready\n");
+        usleep(500*1000);
+      }
+
 
     AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
     int instance_cnt_synch = UE->proc.instance_cnt_synch;
@@ -1665,17 +1665,15 @@ void *UE_thread(void *arg) {
                 // update thread index for received subframe
                 UE->current_thread_id[sub_frame] = thread_idx;
 
-#if BASIC_SIMULATOR
-                {
-                  int t;
-                  for (t = 0; t < 2; t++) {
-                        UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[t];
-                        pthread_mutex_lock(&proc->mutex_rxtx);
-                        while (proc->instance_cnt_rxtx >= 0) pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx );
-                        pthread_mutex_unlock(&proc->mutex_rxtx);
-                  }
-                }
-#endif
+                if (IS_SOFTMODEM_BASICSIM) {
+		  int t;
+		  for (t = 0; t < 2; t++) {
+			UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[t];
+			pthread_mutex_lock(&proc->mutex_rxtx);
+			while (proc->instance_cnt_rxtx >= 0) pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx );
+			pthread_mutex_unlock(&proc->mutex_rxtx);
+		  }
+		}
                 LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]);
 
                 thread_idx++;
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index b19d440b0d09a10c12150e95557b89a0f76aecb4..78d5bebc43ab6354280c1138663a2545e98a1282 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -441,10 +441,6 @@ static void get_options(void) {
 
   if (dumpframe  > 0)  mode = rx_dump_frame;
 
-# if BASIC_SIMULATOR
-  set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT); //this BASIC_SIMULATOR should be a config option
-# endif
-
   for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
     frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
   }
@@ -769,10 +765,11 @@ int main( int argc, char **argv ) {
   init_opt();
   uint32_t pdcp_initmask = ((!IS_SOFTMODEM_NOS1) || IS_SOFTMODEM_NOKRNMOD)? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
 
-  if ( IS_SOFTMODEM_BASICSIM || (nfapi_mode == 3) ) {
+  if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_mode == 3) ) {
     pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
   }
-
+  if ( IS_SOFTMODEM_NOKRNMOD)
+    pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
   pdcp_module_init( pdcp_initmask );
   //TTN for D2D
 #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))