Commit bb045248 authored by Lionel Gauthier's avatar Lionel Gauthier

Cleaner scripts ?

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4903 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 53e14660
#! /bin/bash
# Author Lionel GAUTHIER
###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/env_802dot21.bash
###########################################################
echo_success "\n###############################"
echo_success "# Check installed utils and libs"
echo_success "###############################"
......@@ -26,6 +26,7 @@ test_install_package "libatlas-base-dev"
test_install_package "libpgm-5.1-0" "--force-yes"
test_install_package "libpgm-dev" "--force-yes"
test_install_package linux-headers-`uname -r`
test_install_package "tshark" "--force-yes"
# for ODTONE git clone
test_install_package "git"
......@@ -36,11 +37,8 @@ echo_success "\n###############################"
echo_success "# COMPILE oaisim"
echo_success "###############################"
cd $OPENAIR_TARGETS/SIMU/USER
#make clean > /dev/null
#make cleancell >/dev/null
echo_success "Executing: make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo `"
make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo `
#make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 Rel10=1
if [[ $? -eq 2 ]] ; then
exit 1
fi
......
#!/bin/bash
# Author Lionel GAUTHIER
# OAI NETWORKING--------------------------------
declare -x EMULATION_DEV_INTERFACE="eth2"
declare -x IP_DRIVER_NAME="oai_nw_drv"
declare -x LTEIF="oai0"
declare -x ENB_IPv4="10.0.0.1"
declare -x ENB_IPv6="2001:1::1"
declare -x ENB_IPv6_CIDR=$ENB_IPv6"/64"
declare -x ENB_IPv4_CIDR=$ENB_IPv4"/24"
declare -a NAS_IMEI=( 3 9 1 8 3 6 6 2 0 0 0 0 0 0 )
# OAI MIH----------------------------------------
declare -x ENB_RAL_IP_ADDRESS="127.0.0.1"
declare -x ENB_MIHF_IP_ADDRESS=127.0.0.1
#------------------------------------------------
LOG_FILE="/tmp/oai_sim_enb.log"
###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
......@@ -14,7 +29,6 @@ declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
declare -x EMULATION_DEV_INTERFACE="eth2"
###########################################################
set_openair
......@@ -35,54 +49,28 @@ bash_exec "/sbin/ip6tables -t raw -F"
##################################################
# LAUNCH eNB executable
##################################################
declare MAKE_IP_DRIVER_TARGET="oai_nw_drv.ko"
declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim USE_MME=R10"
declare IP_DRIVER_NAME="oai_nw_drv"
declare LTEIF="oai0"
ENB_IPv4="10.0.0.1"
ENB_IPv6="2001:1::1"
ENB_IPv6_CIDR=$ENB_IPv6"/64"
ENB_IPv4_CIDR=$ENB_IPv4"/24"
#------------------------------------------------
declare -a NAS_IMEI=( 3 9 1 8 3 6 6 2 0 0 0 0 0 0 )
echo "Bringup UE interface"
echo "Bringup eNB interface"
pkill oaisim > /dev/null 2>&1
pkill oaisim > /dev/null 2>&1
rmmod -f $IP_DRIVER_NAME > /dev/null 2>&1
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green
# bash_exec "make --directory=$OPENAIR_TARGETS/SIMU/EXAMPLES/VIRT_EMUL_1eNB $MAKE_LTE_ACCESS_STRATUM_TARGET "
bash_exec "make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET "
#bash_exec "make --directory=$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL "
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=${NAS_IMEI[0]},${NAS_IMEI[1]},${NAS_IMEI[2]},${NAS_IMEI[3]},${NAS_IMEI[4]},${NAS_IMEI[5]},${NAS_IMEI[6]},${NAS_IMEI[7]},${NAS_IMEI[8]},${NAS_IMEI[9]},${NAS_IMEI[10]},${NAS_IMEI[11]},${NAS_IMEI[12]},${NAS_IMEI[13]}"
#bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/UE_LTE/$IP_DRIVER_NAME.ko"
bash_exec "ip route flush cache"
#bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set $LTEIF up"
sleep 1
bash_exec "ip addr add dev $LTEIF $ENB_IPv4_CIDR"
bash_exec "ip addr add dev $LTEIF $ENB_IPv6_CIDR"
sleep 1
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "ip route flush cache"
# please add table 200 lte in /etc/iproute2/rt_tables
ip rule add fwmark 3 table lte
ip route add default dev $LTEIF table lte
ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE
/sbin/ebtables -t nat -A POSTROUTING -p arp -j mark --mark-set 3
......@@ -102,24 +90,43 @@ ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE
/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark 3
# start MIH-F
#xterm -hold -e $ODTONE_ROOT/dist/odtone-mihf --log 4 --conf.file $ODTONE_ROOT/dist/odtone_enb.conf &
#wait_process_started odtone-mihf
xterm -hold -e $ODTONE_MIH_EXE_DIR/$MIH_F --log 4 --conf.file $ODTONE_MIH_EXE_DIR/$ENB_MIH_F_CONF_FILE &
wait_process_started $MIH_F
NOW=$(date +"%Y-%m-%d.%Hh_%Mm_%Ss")
#LOG_FILE="/tmp/oai_sim_enb_$NOW.log"
LOG_FILE="/tmp/oai_sim_enb.log"
rm -f $LOG_FILE
ENB_RAL_LINK_ID=`cat $ODTONE_MIH_EXE_DIR/$ENB_MIH_F_CONF_FILE | grep links | grep \= | grep -v \# | cut -d"=" -f2`
ENB_RAL_LINK_ID=`trim2 $ENB_RAL_LINK_ID`
ENB_RAL_LINK_ID=`echo $ENB_RAL_LINK_ID | cut -d" " -f1`
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -K $LOG_FILE -l9 -u0 -b1 -M0 -p2 -g1 -D $EMULATION_DEV_INTERFACE \
--enb-ral-listening-port 1234\
--enb-ral-link-id enb_lte_link\
--enb-ral-ip-address 127.0.0.1\
--enb-mihf-remote-port 1025\
--enb-mihf-ip-address 127.0.0.1\
--enb-mihf-id mihf1_enb
ENB_RAL_LISTENING_PORT=`cat $ODTONE_MIH_EXE_DIR/$ENB_MIH_F_CONF_FILE | grep links | grep \= | grep -v \# | cut -d"=" -f2`
ENB_RAL_LISTENING_PORT=`trim2 $ENB_RAL_LISTENING_PORT`
ENB_RAL_LISTENING_PORT=`echo $ENB_RAL_LISTENING_PORT | cut -d" " -f2`
ENB_MIHF_REMOTE_PORT=`cat $ODTONE_MIH_EXE_DIR/$ENB_MIH_F_CONF_FILE | grep local_port | grep \= | grep -v \# | tr -d " " | cut -d'=' -f2`
ENB_MIHF_ID=`cat $ODTONE_MIH_EXE_DIR/$ENB_MIH_F_CONF_FILE | grep id | grep \= | grep -v \# | tr -d " " | cut -d'=' -f2`
#remove 2 last digits (vitualization, index on 2 digits)
ENB_RAL_LINK_ID_STRIPPED=${ENB_RAL_LINK_ID%%??}
#xterm -hold -e gdb --args
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -K $LOG_FILE -l9 -u0 -b1 -M0 -p2 -g1 -D $EMULATION_DEV_INTERFACE \
--enb-ral-listening-port $ENB_RAL_LISTENING_PORT \
--enb-ral-link-id $ENB_RAL_LINK_ID_STRIPPED \
--enb-ral-ip-address $ENB_RAL_IP_ADDRESS \
--enb-mihf-remote-port $ENB_MIHF_REMOTE_PORT \
--enb-mihf-ip-address $ENB_MIHF_IP_ADDRESS \
--enb-mihf-id $ENB_MIHF_ID &
wait_process_started oaisim
# start MIH-USER
# wait for emulation start
tshark -c 500 -i $EMULATION_DEV_INTERFACE > /dev/null 2>&1
#xterm -hold -e $ODTONE_MIH_EXE_DIR/$ENB_MIH_USER --conf.file $ODTONE_MIH_EXE_DIR/$ENB_MIH_USER_CONF_FILE &
#wait_process_started $ENB_MIH_USER
sleep 100000
#!/bin/bash
# Author Lionel GAUTHIER
# OAI NETWORKING--------------------------------
declare -x EMULATION_DEV_INTERFACE="eth2"
declare -x IP_DRIVER_NAME="oai_nw_drv"
declare -x LTEIF="oai0"
declare -x UE_IPv4="10.0.0.2"
declare -x UE_IPv6="2001:1::2"
declare -x UE_IPv6_CIDR=$UE_IPv6"/64"
declare -x UE_IPv4_CIDR=$UE_IPv4"/24"
declare -a NAS_IMEI=( 3 9 1 8 3 6 7 3 0 2 0 0 0 0 )
# OAI MIH----------------------------------------
declare -x UE_MIHF_IP_ADDRESS="127.0.0.1"
declare -x UE_RAL_IP_ADDRESS="127.0.0.1"
#------------------------------------------------
LOG_FILE="/tmp/oai_sim_ue.log"
###########################################################
......@@ -16,7 +30,6 @@ declare -x OPENAIR1_DIR=""
declare -x OPENAIR2_DIR=""
declare -x OPENAIR3_DIR=""
declare -x OPENAIR_TARGETS=""
declare -x EMULATION_DEV_INTERFACE="eth2"
###########################################################
set_openair
......@@ -28,56 +41,31 @@ cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
##################################################
# LAUNCH UE executable
# LAUNCH UE
##################################################
declare MAKE_IP_DRIVER_TARGET="oai_nw_drv.ko"
declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim USE_MME=R10"
declare IP_DRIVER_NAME="oai_nw_drv"
declare LTEIF="oai0"
UE_IPv4="10.0.0.8"
UE_IPv6="2001:1::8"
UE_IPv6_CIDR=$UE_IPv6"/64"
UE_IPv4_CIDR=$UE_IPv4"/24"
#------------------------------------------------
declare -a NAS_IMEI=( 3 9 1 8 3 6 7 3 0 2 0 0 0 0 )
echo "Bringup UE interface"
pkill oaisim > /dev/null 2>&1
pkill oaisim > /dev/null 2>&1
rmmod -f $IP_DRIVER_NAME > /dev/null 2>&1
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green
# bash_exec "make --directory=$OPENAIR_TARGETS/SIMU/EXAMPLES/VIRT_EMUL_1eNB $MAKE_LTE_ACCESS_STRATUM_TARGET "
bash_exec "make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET "
#bash_exec "make --directory=$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL "
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=${NAS_IMEI[0]},${NAS_IMEI[1]},${NAS_IMEI[2]},${NAS_IMEI[3]},${NAS_IMEI[4]},${NAS_IMEI[5]},${NAS_IMEI[6]},${NAS_IMEI[7]},${NAS_IMEI[8]},${NAS_IMEI[9]},${NAS_IMEI[10]},${NAS_IMEI[11]},${NAS_IMEI[12]},${NAS_IMEI[13]}"
bash_exec "ip route flush cache"
#bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
bash_exec "ip link set $LTEIF up"
sleep 1
bash_exec "ip addr add dev $LTEIF $UE_IPv4_CIDR"
bash_exec "ip addr add dev $LTEIF $UE_IPv6_CIDR"
sleep 1
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "ip route flush cache"
# please add table 200 lte in file /etc/iproute2/rt_tables
ip rule add fwmark 5 table lte
ip -4 route add default dev $LTEIF table lte
ip -6 route add default dev $LTEIF table lte
ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE
# start MIH-F
......@@ -86,44 +74,41 @@ wait_process_started $MIH_F
sleep 3
NOW=$(date +"%Y-%m-%d.%Hh_%Mm_%Ss")
#LOG_FILE="/tmp/oai_sim_ue_$NOW.log"
LOG_FILE="/tmp/oai_sim_ue.log"
rm -f $LOG_FILE
UE_RAL_LINK_ID=`cat $ODTONE_MIH_EXE_DIR/$UE_MIH_F_CONF_FILE | grep links | grep \= | grep -v \# | cut -d"=" -f2`
UE_RAL_LINK_ID=`trim2 $UE_RAL_LINK_ID`
UE_RAL_LINK_ID=`echo $UE_RAL_LINK_ID | cut -d" " -f1`
UE_RAL_LINK_ID_STRIPPED=${UE_RAL_LINK_ID%%??}
UE_RAL_LISTENING_PORT=`cat $ODTONE_MIH_EXE_DIR/$UE_MIH_F_CONF_FILE | grep links | grep \= | grep -v \# | cut -d"=" -f2`
UE_RAL_LISTENING_PORT=`trim2 $UE_RAL_LISTENING_PORT`
UE_RAL_LISTENING_PORT=`echo $UE_RAL_LISTENING_PORT | cut -d" " -f2`
UE_RAL_IP_ADDRESS=127.0.0.1
UE_MIHF_REMOTE_PORT=`cat $ODTONE_MIH_EXE_DIR/$UE_MIH_F_CONF_FILE | grep local_port | grep \= | grep -v \# | tr -d " " | cut -d'=' -f2`
UE_MIHF_IP_ADDRESS=127.0.0.1
UE_MIHF_ID=`cat $ODTONE_MIH_EXE_DIR/$UE_MIH_F_CONF_FILE | grep id | grep \= | grep -v \# | tr -d " " | cut -d'=' -f2`
xterm -hold -e gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -a -K $LOG_FILE -l9 -u1 -b0 -M1 -p2 -g1 -D $EMULATION_DEV_INTERFACE \
#xterm -hold -e gdb --args
$OPENAIR_TARGETS/SIMU/USER/oaisim -a -K $LOG_FILE -l9 -u1 -b0 -M1 -p2 -g1 -D $EMULATION_DEV_INTERFACE \
--ue-ral-listening-port $UE_RAL_LISTENING_PORT \
--ue-ral-link-id $UE_RAL_LINK_ID \
--ue-ral-link-id $UE_RAL_LINK_ID_STRIPPED \
--ue-ral-ip-address $UE_RAL_IP_ADDRESS \
--ue-mihf-remote-port $UE_MIHF_REMOTE_PORT \
--ue-mihf-ip-address $UE_MIHF_IP_ADDRESS \
--ue-mihf-id $UE_MIHF_ID &
#oai_pid=$!
wait_process_started oaisim
sleep 5
#echo_warning "Press enter to continue..."
#read KEY
# start MIH-USER
xterm -hold -e $ODTONE_MIH_EXE_DIR/$UE_MIH_USER --conf.file $ODTONE_MIH_EXE_DIR/$UE_MIH_USER_CONF_FILE &
wait_process_started $UE_MIH_USER
# wait for emulation start
tshark -c 500 -i $EMULATION_DEV_INTERFACE > /dev/null 2>&1
sleep 5
xterm -hold -e $ODTONE_MIH_EXE_DIR/$UE_MIH_USER --conf.file $ODTONE_MIH_EXE_DIR/$UE_MIH_USER_CONF_FILE &
wait_process_started $UE_MIH_USER
sleep 100000
......
......@@ -202,7 +202,7 @@ wait_process_started () {
is_process_started () {
if [ -z "$1" ]
then
echo_error "WAITING FOR PROCESS START: NO PROCESS"
echo_error "WAITING FOR PROCESS START: ERROR NO PROCESS NAME IN ARGUMENT"
return 1
fi
ps -C $1 > /dev/null 2>&1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment