- Fix: avoid infinite loop on mulitcast read thread if no data to read
Pre-ci test passed git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4000 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Executable
+15
@@ -0,0 +1,15 @@
|
||||
all: oaisim naslite_netlink_ether
|
||||
|
||||
userclean: clean oaisim naslite_netlink_ether
|
||||
|
||||
oaisim:
|
||||
(cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 -j2)
|
||||
|
||||
naslite_netlink_ether:
|
||||
(cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko)
|
||||
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make)
|
||||
|
||||
clean:
|
||||
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
|
||||
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean)
|
||||
|
||||
Executable
+237
@@ -0,0 +1,237 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
echo "Bringup eNB interface"
|
||||
pkill oaisim
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
echo "REMOVING MULTICAST ROUTING RULE"
|
||||
ip route del 239.0.0.160/28 dev eth3
|
||||
#sudo make naslite_netlink_ether oaisim
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,6,2,0,0,0,0,0,0
|
||||
sleep 1
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
macchanger oai0 -m 90:f6:52:0c:60:aa
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
echo " ADDING MULTICAST ROUTING RULE"
|
||||
ip route add 239.0.0.160/28 dev eth3
|
||||
|
||||
rm -f /tmp/lte_enb.log
|
||||
|
||||
nice --adjustment=-10 /usr/local/src/trunk/targets/SIMU/USER/oaisim -E 1234 -u0 -M0 -p2 -g1 -l3 > /dev/null 2>&1 &
|
||||
#gdb --args /usr/local/src/trunk/targets/SIMU/USER/oaisim -E 1234 -u0 -M0 -p2 -g1 -l7
|
||||
|
||||
wait_process_started oaisim
|
||||
|
||||
sleep 3
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
echo "CONFIGURING OAI INTERFACE"
|
||||
ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::1/64
|
||||
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f0 -z0 -x 0::0/128 -y 2001:1::3/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f2 -z0 -s 10.0.1.1/32 -t 10.0.1.3/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f4 -z64 -x 0::0/128 -y 2001:1::3/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f6 -z64 -x 0::0/128 -y FF02::0/16 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f8 -z64 -s 0.0.0.0/32 -t 10.0.1.3/24 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f10 -z64 -s 0.0.0.0/32 -t 10.0.1.255/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f12 -z64 -s 0.0.0.0/32 -t 224.0.0.0/8 -r 3"
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_forward=1"
|
||||
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
while true; do sleep 10000; done
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+244
@@ -0,0 +1,244 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
echo "Bringup eNB interface"
|
||||
pkill oaisim
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
echo "REMOVING MULTICAST ROUTING RULE"
|
||||
ip route del 239.0.0.160/28 dev eth3
|
||||
#sudo make naslite_netlink_ether oaisim
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,6,2,0,0,0,0,0,0
|
||||
sleep 1
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
macchanger oai0 -m 90:f6:52:0c:60:aa
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
echo " ADDING MULTICAST ROUTING RULE"
|
||||
ip route add 239.0.0.160/28 dev eth3
|
||||
|
||||
rm -f /tmp/lte_enb.log
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -M0 -p3 -g1 -l7 > /dev/null 2>&1 &
|
||||
#nice -10 gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -M0 -p3 -g1 -l3
|
||||
|
||||
wait_process_started oaisim
|
||||
|
||||
sleep 3
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
echo "CONFIGURING OAI INTERFACE"
|
||||
ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::1/64
|
||||
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f0 -z0 -x 0::0/128 -y 2001:1::3/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f2 -z0 -s 10.0.1.1/32 -t 10.0.1.3/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f4 -z64 -x 0::0/128 -y 2001:1::3/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f6 -z64 -x 0::0/128 -y FF02::0/16 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f8 -z64 -s 0.0.0.0/32 -t 10.0.1.3/24 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f10 -z64 -s 0.0.0.0/32 -t 10.0.1.255/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f12 -z64 -s 0.0.0.0/32 -t 224.0.0.0/8 -r 3"
|
||||
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f14 -z0 -x 0::0/128 -y 2001:1::6/128 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f16 -z0 -s 10.0.1.1/32 -t 10.0.1.6/32 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f18 -z64 -x 0::0/128 -y 2001:1::6/128 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f20 -z64 -x 0::0/128 -y FF02::0/16 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f22 -z64 -s 0.0.0.0/32 -t 10.0.1.6/24 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f24 -z64 -s 0.0.0.0/32 -t 10.0.1.255/32 -r 14"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f26 -z64 -s 0.0.0.0/32 -t 224.0.0.0/8 -r 14"
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_forward=1"
|
||||
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
while true; do sleep 10000; done
|
||||
|
||||
echo "End"
|
||||
Executable
+216
@@ -0,0 +1,216 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bringup UE interface"
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,7,3,0,2,0,0,0,0
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth1
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::3/64
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s 10.0.1.3/32 -t 10.0.1.1/32 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g1 -l3 > /dev/null 2>&1
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g1 -l3
|
||||
echo "End"
|
||||
|
||||
Executable
+217
@@ -0,0 +1,217 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bringup UE interface"
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,7,3,0,2,0,0,0,0
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth1
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::3/64
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s 10.0.1.3/32 -t 10.0.1.1/32 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p3 -g1 -l3 > /dev/null 2>&1
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p3 -g1 -l3
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+217
@@ -0,0 +1,217 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bringup UE interface"
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,7,3,0,5,0,0,0,0
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth2
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.6 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::6/64
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s 10.0.1.6/32 -t 10.0.0.0/32 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -b0 -M1 -p2 -g1 -l3 > /dev/null 2>&1
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -b0 -M1 -p2 -g1 -l3
|
||||
echo "End"
|
||||
|
||||
Executable
+217
@@ -0,0 +1,217 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod oai_nw_drv
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bringup UE interface"
|
||||
pkill oaisim
|
||||
/sbin/rmmod oai_nw_drv
|
||||
make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/oai_nw_drv.ko oai_nw_drv_IMEI=3,9,1,8,3,6,7,3,0,5,0,0,0,0
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
#route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
|
||||
ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth2
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.6 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:1::6/64
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s 10.0.1.6/32 -t 10.0.0.0/32 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3
|
||||
$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3
|
||||
|
||||
echo " Enabling ping broadcast"
|
||||
bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -b0 -M2 -p3 -g1 -l3 > /dev/null 2>&1
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -b0 -M2 -p3 -g1 -l3
|
||||
echo "End"
|
||||
|
||||
Executable
+259
@@ -0,0 +1,259 @@
|
||||
#! /bin/bash
|
||||
#set -x
|
||||
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/log_rrm ./log_rrm.txt
|
||||
cp /tmp/log_oaiENB ./log_oaiENB.txt
|
||||
cp /tmp/log_lteralenb ./log_lteralenb.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up eNB interface"
|
||||
pkill LTE_RAL_ENB
|
||||
pkill oaisim_eNB
|
||||
pkill oaisim_eNB
|
||||
pkill cell_rrm
|
||||
/sbin/rmmod nascellrg
|
||||
echo "REMOVING MULTICAST ROUTING RULE"
|
||||
ip route del 239.0.0.160/28 dev eth3
|
||||
#sudo make naslite_netlink_ether oaisim
|
||||
#make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASRG/nascellrg.ko
|
||||
echo "eNB interface network driver started"
|
||||
sleep 1
|
||||
|
||||
echo " Configuring ipv6 dad.."
|
||||
#sysctl -w net.ipv6.conf.default.dad_transmits=0
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
#sysctl -w net.ipv6.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
#ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
#macchanger oai0 -m 90:f6:52:0c:60:aa
|
||||
#sleep 3
|
||||
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
echo "CONFIGURING eNB INTERFACE"
|
||||
ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "eNB interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:660:382:14::1/64
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
echo " ADDING MULTICAST ROUTING RULE"
|
||||
ip route add 239.0.0.160/28 dev eth3
|
||||
|
||||
#rm -f /tmp/lte_enb.log
|
||||
#rm -f rrm_log.txt
|
||||
sleep 1
|
||||
echo "Starting RRM module"
|
||||
exec $OPENAIR_TARGETS/SIMU/USER/cell_rrm > /tmp/log_rrm 2>&1 &
|
||||
sleep 2
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g1 -l6 > /tmp/log_oaiENB 2>&1 &
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g2 -l6
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g1 -l6
|
||||
|
||||
#sudo nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -l6
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1234 -u0 -b1 -M0 -p2 -l6 > /dev/null 2>&1 &log_oaiENB
|
||||
#gdb --args /usr/local/src/trunk/targets/SIMU/USER/oaisim -E 1234 -u0 -M0 -p2 -g1 -l7
|
||||
wait_process_started oaisim_eNB
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.ip_forward=1
|
||||
#assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
|
||||
#Activate next line to start with MIH-LTE-SAP
|
||||
sleep 4
|
||||
$OPENAIR3_DIR/RAL-LTE/LTE_RAL_ENB/LTE_RAL_ENB > /tmp/log_lteralenb 2>&1 &
|
||||
|
||||
#while true; do sleep 10000; done
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+233
@@ -0,0 +1,233 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill LTE_RAL_UE
|
||||
wait_process_ended LTE_RAL_UE
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
cp /tmp/log_lteralue ./log_lteralue.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up UE interface"
|
||||
pkill oaisim_UE
|
||||
/sbin/rmmod -w nascellmt
|
||||
ip route del 239.0.0.160/28 dev eth1
|
||||
|
||||
#make oaisim rrc_cellular=1 UE_flag=1
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASMT/nascellmt.ko nas_IMEI=3,5,6,0,1,4,9,1,5,0,0,0,0,0
|
||||
#sudo $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/start_mt_cellular
|
||||
echo "UE interface network driver started"
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
## ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth1
|
||||
ip link set oai0 up
|
||||
echo "UE interface network driver up"
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "UE interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
## ip addr add dev oai0 2001:660:382:14:235:60ff:fe14:9150/64
|
||||
ip addr add dev oai0 2001:660:382:14:235:60ff:fe14:9150/64
|
||||
|
||||
##
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#sudo bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sudo sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
# ** Next lines start the Access Stratum
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1234 -u1 -b0 -M1 -p2 -l6 > /dev/null 2>&1
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g2 -l6 > /tmp/log_oaiUE 2>&1 &
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g1 -l6
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g1 -l6
|
||||
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g1 -l3
|
||||
|
||||
# ** Next lines start the RAL
|
||||
wait_process_started oaisim_UE
|
||||
sleep 4
|
||||
$OPENAIR3_DIR/RAL-LTE/LTE_RAL_UE/LTE_RAL_UE > /tmp/log_lteralue 2>&1 &
|
||||
wait_process_started LTE_RAL_UE
|
||||
|
||||
# ** Next lines start the gioctl
|
||||
#wait_process_started oaisim_UE
|
||||
#sleep 7
|
||||
#$OPENAIR2_DIR/NAS/DRIVER/CELLULAR/CTL_TOOL/gioctl cx add 0 5
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+253
@@ -0,0 +1,253 @@
|
||||
#! /bin/bash
|
||||
#set -x
|
||||
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/log_rrm ./log_rrm.txt
|
||||
cp /tmp/log_oaiENB ./log_oaiENB.txt
|
||||
sleep 1
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up eNB interface"
|
||||
pkill oaisim_eNB
|
||||
pkill oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sudo /sbin/rmmod nascellrg
|
||||
#echo "REMOVING MULTICAST ROUTING RULE"
|
||||
#ip route del 239.0.0.160/28 dev eth3
|
||||
#sudo make naslite_netlink_ether oaisim
|
||||
#make naslite_netlink_ether oaisim
|
||||
sudo /sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASRG/nascellrg.ko
|
||||
echo "eNB interface network driver started"
|
||||
sleep 1
|
||||
|
||||
echo " Configuring ipv6 dad.."
|
||||
sudo sysctl -w net.ipv6.conf.default.dad_transmits=0
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
sudo sysctl -w net.ipv6.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
#ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
#macchanger oai0 -m 90:f6:52:0c:60:aa
|
||||
#sleep 3
|
||||
|
||||
sudo ip link set oai0 up
|
||||
sleep 1
|
||||
echo "CONFIGURING eNB INTERFACE"
|
||||
sudo ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "eNB interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
sudo ip addr add dev oai0 2001:660:382:14::1/64
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
#echo " ADDING MULTICAST ROUTING RULE"
|
||||
#ip route add 239.0.0.160/28 dev eth3
|
||||
|
||||
#rm -f /tmp/lte_enb.log
|
||||
#rm -f rrm_log.txt
|
||||
sleep 1
|
||||
echo "Starting RRM module"
|
||||
exec $OPENAIR_TARGETS/SIMU/USER/cell_rrm > /tmp/log_rrm 2>&1 &
|
||||
sleep 2
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
$OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -l6 > /tmp/log_oaiENB 2>&1 &
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -l6
|
||||
#sudo nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -l6
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1234 -u0 -b1 -M0 -p2 -l6 > /dev/null 2>&1 &log_oaiENB
|
||||
#gdb --args /usr/local/src/trunk/targets/SIMU/USER/oaisim -E 1234 -u0 -M0 -p2 -g1 -l7
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.ip_forward=1
|
||||
#assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
|
||||
# ** Next lines start the RAL
|
||||
wait_process_started oaisim_eNB
|
||||
sleep 4
|
||||
$OPENAIR3_DIR/RAL-LTE/LTE_RAL_ENB/LTE_RAL_ENB
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+229
@@ -0,0 +1,229 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
sudo pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
sleep 1
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up UE interface"
|
||||
# ** Next lines clean remaining processes
|
||||
pkill oaisim_UE
|
||||
sudo /sbin/rmmod -w nascellmt
|
||||
#make oaisim rrc_cellular=1 UE_flag=1 NAS=1
|
||||
|
||||
# ** Next lines start the device driver
|
||||
sudo /sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASMT/nascellmt.ko nas_IMEI=3,5,6,0,1,4,9,1,5,0,0,0,0,0
|
||||
#sudo $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/start_mt_cellular
|
||||
echo "UE interface network driver started"
|
||||
|
||||
# ** Next lines configure the device driver
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
## ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
## ip route add 239.0.0.160/28 dev eth1
|
||||
sudo ip link set oai0 up
|
||||
echo "UE interface network driver up"
|
||||
sleep 1
|
||||
sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "UE interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
## ip addr add dev oai0 2001:1::3/64
|
||||
##
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#sudo bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sudo sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
# ** Next lines start the Access Stratum
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1234 -u1 -b0 -M1 -p2 -l6 > /dev/null 2>&1
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
$OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -l6 > /tmp/log_oaiUE 2>&1 &
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -l6
|
||||
#sudo nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -l6 &
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g1 -l3
|
||||
|
||||
# ** Next lines start the RAL
|
||||
wait_process_started oaisim_UE
|
||||
sleep 4
|
||||
$OPENAIR3_DIR/RAL-LTE/LTE_RAL_UE/LTE_RAL_UE
|
||||
|
||||
# ** Next lines start the gioctl
|
||||
#wait_process_started oaisim_UE
|
||||
#sleep 7
|
||||
#$OPENAIR2_DIR/NAS/DRIVER/CELLULAR/CTL_TOOL/gioctl cx add 0 5
|
||||
#sleep 40
|
||||
#$OPENAIR2_DIR/NAS/DRIVER/CELLULAR/CTL_TOOL/gioctl cx del 0
|
||||
echo "End"
|
||||
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
#! /bin/bash
|
||||
#set -x
|
||||
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/log_rrm ./log_rrm.txt
|
||||
cp /tmp/log_oaiENB ./log_oaiENB.txt
|
||||
cp /tmp/log_lteralenb ./log_lteralenb.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up eNB interface"
|
||||
pkill oaisim_eNB
|
||||
pkill cell_rrm
|
||||
/sbin/rmmod nascellrg
|
||||
echo "REMOVING MULTICAST ROUTING RULE"
|
||||
ip route del 239.0.0.160/28 dev eth3
|
||||
#sudo make naslite_netlink_ether oaisim
|
||||
#make naslite_netlink_ether oaisim
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASRG/nascellrg.ko
|
||||
echo "eNB interface network driver started"
|
||||
sleep 1
|
||||
|
||||
echo " Configuring ipv6 dad.."
|
||||
#sysctl -w net.ipv6.conf.default.dad_transmits=0
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
#sysctl -w net.ipv6.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
#ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
#macchanger oai0 -m 90:f6:52:0c:60:aa
|
||||
#sleep 3
|
||||
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
echo "CONFIGURING eNB INTERFACE"
|
||||
ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "eNB interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:660:382:14::1/64
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
echo " ADDING MULTICAST ROUTING RULE"
|
||||
ip route add 239.0.0.160/28 dev eth3
|
||||
|
||||
#rm -f /tmp/lte_enb.log
|
||||
#rm -f rrm_log.txt
|
||||
sleep 1
|
||||
echo "Starting RRM module"
|
||||
exec $OPENAIR_TARGETS/SIMU/USER/cell_rrm > /tmp/log_rrm 2>&1 &
|
||||
sleep 2
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g1 -l6 > /tmp/log_oaiENB 2>&1 &
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g2 -l6
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -g1 -l6
|
||||
|
||||
#sudo nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1 -u0 -b1 -M0 -p2 -l6
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_eNB -E 1234 -u0 -b1 -M0 -p2 -l6 > /dev/null 2>&1 &log_oaiENB
|
||||
#gdb --args /usr/local/src/trunk/targets/SIMU/USER/oaisim -E 1234 -u0 -M0 -p2 -g1 -l7
|
||||
wait_process_started oaisim_eNB
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.ip_forward=1
|
||||
#assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
#echo " Enabling ipv4 forwarding.."
|
||||
#sudo sysctl -w net.ipv4.conf.all.forwarding=1
|
||||
#assert "`sudo sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
|
||||
#Activate next line to start with MIH-LTE-SAP
|
||||
#sleep 4
|
||||
#$OPENAIR3_DIR/RAL-LTE/LTE_RAL_ENB/LTE_RAL_ENB > /tmp/log_lteralenb 2>&1 &
|
||||
|
||||
#while true; do sleep 10000; done
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+233
@@ -0,0 +1,233 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill LTE_RAL_UE
|
||||
wait_process_ended LTE_RAL_UE
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
cp /tmp/log_lteralue ./log_lteralue.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring up UE interface"
|
||||
pkill oaisim_UE
|
||||
/sbin/rmmod -w nascellmt
|
||||
ip route del 239.0.0.160/28 dev eth1
|
||||
|
||||
#make oaisim rrc_cellular=1 UE_flag=1
|
||||
/sbin/insmod $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/NASMT/nascellmt.ko nas_IMEI=3,5,6,0,1,4,9,1,5,0,0,0,0,0
|
||||
#sudo $OPENAIR2_DIR/NAS/DRIVER/CELLULAR/start_mt_cellular
|
||||
echo "UE interface network driver started"
|
||||
|
||||
#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
|
||||
## ip link set oai0 broadcast ff:ff:ff:ff:ff:ff
|
||||
ip route add 239.0.0.160/28 dev eth1
|
||||
ip link set oai0 up
|
||||
echo "UE interface network driver up"
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
echo "UE interface network driver IPv4 address configured"
|
||||
sleep 1
|
||||
## ip addr add dev oai0 2001:660:382:14:235:60ff:fe14:9150/64
|
||||
ip addr add dev oai0 2001:660:382:14:235:60ff:fe14:9150/64
|
||||
|
||||
##
|
||||
|
||||
#echo " Enabling ping broadcast"
|
||||
#sudo bash_exec "sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0"
|
||||
#assert "`sudo sysctl -n net.ipv4.icmp_echo_ignore_broadcasts` -eq 0" $LINENO
|
||||
|
||||
# ** Next lines start the Access Stratum
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1234 -u1 -b0 -M1 -p2 -l6 > /dev/null 2>&1
|
||||
echo "Starting OAI Access Stratum ..."
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g2 -l6 > /tmp/log_oaiUE 2>&1 &
|
||||
#$OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g1 -l6
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim_UE -E 1 -u1 -b0 -M1 -p2 -g1 -l6
|
||||
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g1 -l3
|
||||
|
||||
# ** Next lines start the RAL
|
||||
#wait_process_started oaisim_UE
|
||||
#sleep 4
|
||||
#$OPENAIR3_DIR/RAL-LTE/LTE_RAL_UE/LTE_RAL_UE > /tmp/log_lteralue 2>&1 &
|
||||
#wait_process_started LTE_RAL_UE
|
||||
|
||||
# ** Next lines start the gioctl
|
||||
wait_process_started oaisim_UE
|
||||
sleep 7
|
||||
$OPENAIR2_DIR/NAS/DRIVER/CELLULAR/CTL_TOOL/gioctl cx add 0 5
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down eNB interface"
|
||||
pkill LTE_RAL_ENB
|
||||
wait_process_ended LTE_RAL_ENB
|
||||
sleep 1
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/log_rrm ./log_rrm.txt
|
||||
cp /tmp/log_oaiENB ./log_oaiENB.txt
|
||||
cp /tmp/log_lteralenb ./log_lteralenb.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down UE interface"
|
||||
pkill LTE_RAL_UE
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_lteralue ./log_lteralue.txt
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
echo "End"
|
||||
|
||||
Executable
+192
@@ -0,0 +1,192 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
sleep 2
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down eNB interface"
|
||||
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/rrm_log ./log_rrm.txt
|
||||
cp /tmp/oaiENB_log ./log_oaiENB.txt
|
||||
sleep 1
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod nascellrg
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
sleep 1
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down UE interface"
|
||||
sudo pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
sleep 1
|
||||
sudo ip link set oai0 down
|
||||
sudo /sbin/rmmod -w nascellmt
|
||||
echo "End"
|
||||
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down eNB interface"
|
||||
#pkill LTE_RAL_ENB
|
||||
#wait_process_ended LTE_RAL_ENB
|
||||
#sleep 1
|
||||
pkill oaisim_eNB
|
||||
wait_process_ended oaisim_eNB
|
||||
pkill cell_rrm
|
||||
sleep 1
|
||||
cp /tmp/log_rrm ./log_rrm.txt
|
||||
cp /tmp/log_oaiENB ./log_oaiENB.txt
|
||||
#cp /tmp/log_lteralenb ./log_lteralenb.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod nascellrg
|
||||
|
||||
echo "End"
|
||||
|
||||
Executable
+190
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
###########################################################
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
trim ()
|
||||
{
|
||||
echo "$1" | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'
|
||||
}
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
trap control_c SIGINT
|
||||
#set_openair
|
||||
echo "OPENAIR1_DIR="$OPENAIR1_DIR
|
||||
echo "OPENAIR2_DIR="$OPENAIR2_DIR
|
||||
echo "OPENAIR3_DIR="$OPENAIR3_DIR
|
||||
echo "OPENAIR_TARGETS="$OPENAIR_TARGETS
|
||||
|
||||
echo "Bring down UE interface"
|
||||
#pkill LTE_RAL_UE
|
||||
pkill oaisim_UE
|
||||
wait_process_ended oaisim_UE
|
||||
sleep 1
|
||||
#cp /tmp/log_lteralue ./log_lteralue.txt
|
||||
cp /tmp/log_oaiUE ./log_oaiUE.txt
|
||||
sleep 1
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod -w nascellmt
|
||||
echo "End"
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys, warnings
|
||||
import serial
|
||||
|
||||
def sendToTTY(lineP):
|
||||
sys.stdout.write("\nSend:\n" + lineP+"\n")
|
||||
g_ser.write(lineP)
|
||||
g_ser.flush()
|
||||
|
||||
|
||||
|
||||
g_ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
|
||||
|
||||
buffer = ''
|
||||
while True:
|
||||
buffer += g_ser.read(1)
|
||||
#sys.stdout.write("buffer is now:\n" + buffer+"\n")
|
||||
buffer = buffer.lstrip('\r')
|
||||
if '\r' in buffer:
|
||||
at_received, buffer = buffer.split('\r')[-2:]
|
||||
|
||||
at_received = at_received.strip('\n')
|
||||
at_received = at_received.strip('\r')
|
||||
|
||||
if at_received == '\n' or at_received == '' or at_received == '\r':
|
||||
break
|
||||
else:
|
||||
sys.stdout.write("Receive stripped:\n" + at_received+"\n")
|
||||
# Q0 = enable codes
|
||||
# Q1 = disable codes
|
||||
if at_received == 'ATE0Q0V1':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# ATS0, Automatic Answer
|
||||
# This S-parameter controls the automatic answering feature of the modem
|
||||
# 0 automatic answering is disabled
|
||||
# 1 - 255 enable automatic answering on the ring number specified
|
||||
# here value received is 0
|
||||
elif at_received.startswith('ATS0='):
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# AT+CMEEReport mobile equipment error
|
||||
#0 Disable +CME ERROR result code. Use ERROR instead.
|
||||
#1 Enable +CME ERROR result code and use numeric<err> values
|
||||
#2 Enable +CME ERROR result code and use verbose<err> values
|
||||
# here value received is 1
|
||||
elif at_received.startswith('AT+CMEE='):
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# Network registration events
|
||||
# AT+CREGNetwork registration (ver. 2)
|
||||
# Description:
|
||||
# Controls the presentation of an unsolicited result code +CREG : <stat>
|
||||
# when <n>=1 and there is a change in the ME network registration status or
|
||||
# code +CREG: <stat>[,<lac>,<ci>] when <n>=2 and there is a change of thenetwork cell.
|
||||
# Read command returns the status of result code presentation and an integer <stat>,
|
||||
# which shows whether the network has currently indicated the registration of the ME.
|
||||
# Location information elements <lac> and <ci> are returned only when <n>=2 and ME
|
||||
# is registered in the network.
|
||||
# <n>:
|
||||
# 0 Disable network registration unsolicited result code. Default value
|
||||
# 1 Enable network registration unsolicited result code,+CREG: <stat>
|
||||
# 2 Enable network registration and location information unsolicited result code, +CREG:<stat>[,<lac>,<ci>]
|
||||
# <stat>:
|
||||
# 0 not registered new operator to registered and not searching
|
||||
# 1 registered, home network
|
||||
# 2 not registered, currently searching a new operator to register with
|
||||
# 3 registration denied
|
||||
# 4 unknown
|
||||
# 5 registered, roaming
|
||||
elif at_received == 'AT+CREG=2':
|
||||
sendToTTY('\rOK\r')
|
||||
sendToTTY('+CREG: 1,00C3,01021A02 \r')
|
||||
|
||||
elif at_received == 'AT+CREG=1':
|
||||
sendToTTY('\rOK\r')
|
||||
sendToTTY('+CREG: 1\r')
|
||||
|
||||
elif at_received == 'AT+CREG?':
|
||||
sendToTTY('+CREG: 1,00C3,01021A02\r\nOK\r')
|
||||
|
||||
|
||||
|
||||
# GPRS registration events
|
||||
# +CGREGNetwork registration reporting
|
||||
# Packet domain network registration status AT+CGPADDRShow PDP address
|
||||
# Description:
|
||||
# Controls the presentation of the unsolicited result code +CGREG: <stat>
|
||||
# when <n>='1' and there is a change in the ME GPRS network registration status or
|
||||
# +CGREG: <stat>[,<lac>,<ci>] when <n>='2' and there is achange of the network cell.
|
||||
# ---
|
||||
# Note: If the GPRS MT also supports circuit mode services,
|
||||
# AT+CREG and the +CREG result code apply to the registration status and location
|
||||
# information for those services. The read command returns the status of result
|
||||
# code presentation and an integer <stat> which shows whether the network has
|
||||
# currently indicated the registration of the ME.
|
||||
# Location information elements <lac> and <ci> are returned only when <n>=2
|
||||
# and ME is registered in the network.
|
||||
elif at_received == 'AT+CGREG=1':
|
||||
sendToTTY('\rOK\r')
|
||||
sendToTTY('+CGREG: 1\r')
|
||||
|
||||
elif at_received == 'AT+CGREG?':
|
||||
sendToTTY('+CGREG: 0,1\r\nOK\r')
|
||||
|
||||
|
||||
|
||||
# Call Waiting notifications
|
||||
elif at_received == 'AT+CCWA=1':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# Alternating voice/data off
|
||||
elif at_received == 'AT+CMOD=0':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# +CSSU unsolicited supp service notifications
|
||||
elif at_received == 'AT+CSSN=0,1':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# no connected at_received identification
|
||||
elif at_received == 'AT+COLP=0':
|
||||
sendToTTY('+COLP:0\r\nOK\r')
|
||||
|
||||
# HEX character set
|
||||
# AT+CSCSSelect TE character set (ver. 3)
|
||||
elif at_received == 'AT+CSCS=\"HEX\"':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# USSD unsolicited
|
||||
# AT+CUSD Unstructured supplementary service data (ver. 2)
|
||||
# <n>
|
||||
# 0 Disable result code presentation in the TA.Defaultvalue
|
||||
# 1 Enable result code presentation in the TA
|
||||
# 2 Terminate (abort) USSD dialogue. This value is not applicable to the read command response. Notsupported
|
||||
elif at_received == 'AT+CUSD=1':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# Enable +CGEV GPRS event notifications, but don't buffer
|
||||
# AT+CGEREPPacket domain event reporting (ver. 1)
|
||||
elif at_received == 'AT+CGEREP=1,0':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# SMS PDU mode
|
||||
# AT+CMGF Message format (ver. 1)
|
||||
elif at_received == 'AT+CMGF=0':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
elif at_received == 'AT+CPIN?':
|
||||
sendToTTY('\r+CPIN: READY\r\nOK\r')
|
||||
#sendToTTY('\rOK\r')
|
||||
|
||||
# AT+CFUNSet phone functionality (ver. 2)
|
||||
# 0 Minimum functionality, that is, the phone is turnedoff. Default value
|
||||
# 1 Full functionality, that is, the phone is turned on
|
||||
# 2 Disable phone transmit RF circuits only. Notsupported
|
||||
# 3 Disable phone receive RF circuits only. Notsupported
|
||||
# 4 Disable phone transmit and receive RF circuits.Note: This is often referred to as "flight mode"
|
||||
# 5 GSM only (WCDMA radio off)
|
||||
# 6 WCDMA only (GSM radio off)
|
||||
elif at_received == 'AT+CFUN?':
|
||||
sendToTTY('+CFUN: 1\r\nOK\r')
|
||||
|
||||
elif at_received == 'AT+CFUN=1':
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
# AT+CLCCList current calls
|
||||
# Description:
|
||||
# Returns the list of current calls. If command succeeds but no calls areavailable, no information response is sent to TE
|
||||
elif at_received == 'AT+CLCC':
|
||||
sendToTTY('+CLCC: \r\nOK\r')
|
||||
|
||||
# AT+COPSOperator selection (ver. 2)
|
||||
# AT+COPS=[<mode>[,<format>[,<oper>[,AcT]]]]
|
||||
#
|
||||
# <mode> Description
|
||||
# 0 Automatic (<oper> field is ignored.) Default value
|
||||
# 1 Manual (<oper> field will be present)
|
||||
# 2 Deregister from network. Not supported
|
||||
# 3 Set only <format> (for read command +COPS?), donot attempt registration/deregistration (<oper> field is ignored).
|
||||
# This value is not applicable in readcommand response
|
||||
# 4 Manual/automatic (<oper> field will be present). Ifmanual selection fails, automatic mode (<mode>=0)is entered
|
||||
elif at_received == 'AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS?':
|
||||
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
|
||||
|
||||
elif at_received == 'AT+COPS?':
|
||||
#sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
|
||||
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\nOK\r')
|
||||
|
||||
elif at_received == 'AT+COPS=0':
|
||||
#sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\n+COPS: 0,1, \"Free\"\r\n+COPS: 0,2, \"310170\"\r\nOK\r')
|
||||
sendToTTY('+COPS: 0,0, \"Free - Mobile\"\r\nOK\r')
|
||||
|
||||
# IMEI
|
||||
elif at_received == 'AT+CGSN':
|
||||
sendToTTY('+CGSN:534500314160207\r\nOK\r')
|
||||
|
||||
# Signal quality (ver.1)
|
||||
# Returns received signal strength indication <rssi> and channel bit errorrate <ber> from the phone.
|
||||
elif at_received == 'AT+CSQ':
|
||||
#31,7
|
||||
sendToTTY('+CSQ:8,7\r\nOK\r')
|
||||
|
||||
|
||||
|
||||
else:
|
||||
sendToTTY('\rOK\r')
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
all: oaisim naslite_netlink_ether remserial
|
||||
|
||||
oaisim:
|
||||
(cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 -j4)
|
||||
|
||||
naslite_netlink_ether:
|
||||
(cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko)
|
||||
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make)
|
||||
|
||||
|
||||
remserial:
|
||||
(cd $(OPENAIR3_DIR)/UTILS/REMSERIAL-1.4.UDP && make all)
|
||||
(cp -upv $(OPENAIR3_DIR)/UTILS/REMSERIAL-1.4.UDP/remserial /usr/bin/remserial.udp)
|
||||
|
||||
one_eNB_one_UE: oaisim naslite_netlink_ether
|
||||
|
||||
userclean: clean oaisim naslite_netlink_ether
|
||||
|
||||
clean:
|
||||
(cd $(OPENAIR_TARGETS)/SIMU/USER && make clean)
|
||||
(cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean)
|
||||
(cd $(OPENAIR2_DIR) && make clean)
|
||||
+361
@@ -0,0 +1,361 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#------------------------------------------------
|
||||
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
|
||||
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
|
||||
IP_DRIVER_NAME=oai_nw_drv
|
||||
###########################################################
|
||||
# CONFIGURE OPTIONS
|
||||
EMULIF="eth1"
|
||||
LTEIF="oai0"
|
||||
EXTIF="eth0"
|
||||
INTIF=$LTEIF
|
||||
#----------------------------------------------------------
|
||||
LTE_NETWORK_CIDR="10.0.1.0/24"
|
||||
ENB_IPv4="10.0.1.1"
|
||||
ENB_IPv6="2001:1::1"
|
||||
ENB_IPv6_CIDR=$ENB_IPv6"/64"
|
||||
ENB_IPv4_CIDR=$ENB_IPv4"/24"
|
||||
ENB_IF_ID="3,9,1,8,3,6,6,2,0,0,0,0,0,0"
|
||||
#----------------------------------------------------------
|
||||
UE_IPv4="10.0.1.2"
|
||||
UE_IPv6="2001:1::2"
|
||||
UE_IPv6_CIDR=$UE_IPv6"/64"
|
||||
UE_IPv4_CIDR=$UE_IPv4"/24"
|
||||
#----------------------------------------------------------
|
||||
|
||||
# +-------+ +-------+
|
||||
# | eNB | EMULIF | UE |
|
||||
# | +---------------------+ |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | LTEIF | |
|
||||
# | +.................... + |
|
||||
# | |ENB_IPv4 UE_IPv4_CIDR| |
|
||||
# +-------+ LTE link over +-------+
|
||||
# UDP over ethernet
|
||||
###########################################################
|
||||
IPTABLES=/sbin/iptables
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
declare -x OPENAIR_DIR=""
|
||||
declare -x OPENAIR1_DIR=""
|
||||
declare -x OPENAIR2_DIR=""
|
||||
declare -x OPENAIR3_DIR=""
|
||||
declare -x OPENAIR_TARGETS=""
|
||||
###########################################################
|
||||
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
wait_process_ended () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
pkill $1
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -eq 0 ]; do
|
||||
echo_warning "WAITING FOR $1 END"
|
||||
pkill $1
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 ENDED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
control_c()
|
||||
# run if user hits control-c
|
||||
{
|
||||
echo -en "\n*** Exiting ***\n"
|
||||
pkill oaisim
|
||||
wait_process_ended oaisim
|
||||
sleep 2
|
||||
ip link set oai0 down
|
||||
/sbin/rmmod $IP_DRIVER_NAME
|
||||
exit $?
|
||||
bash_exec "$IPTABLES -P INPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F INPUT"
|
||||
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F OUTPUT"
|
||||
bash_exec "$IPTABLES -P FORWARD DROP"
|
||||
bash_exec "$IPTABLES -F FORWARD"
|
||||
bash_exec "$IPTABLES -t nat -F"
|
||||
bash_exec "$IPTABLES -t mangle -F"
|
||||
bash_exec "$IPTABLES -t filter -F"
|
||||
}
|
||||
|
||||
|
||||
set_openair
|
||||
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
|
||||
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
|
||||
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
|
||||
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
|
||||
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
|
||||
|
||||
trap ctrl_c INT
|
||||
|
||||
|
||||
echo "Bringup UE interface"
|
||||
bash_exec "rmmod $IP_DRIVER_NAME"
|
||||
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET....." $green
|
||||
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET"
|
||||
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$ENB_IF_ID"
|
||||
|
||||
|
||||
echo " Enabling proxy ARP.."
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.proxy_arp=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.proxy_arp` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_forward=1"
|
||||
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling DynamicAddr.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_dynaddr=1"
|
||||
assert " `sysctl -n net.ipv4.ip_dynaddr` -eq 1" $LINENO
|
||||
|
||||
bash_exec "ip route flush cache"
|
||||
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
|
||||
|
||||
bash_exec "ip link set $LTEIF broadcast ff:ff:ff:ff:ff:ff"
|
||||
bash_exec "ip link set $LTEIF up"
|
||||
sleep 1
|
||||
|
||||
|
||||
assert " -x $IPTABLES " $LINENO
|
||||
|
||||
bash_exec "$IPTABLES -P INPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F INPUT"
|
||||
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F OUTPUT"
|
||||
bash_exec "$IPTABLES -P FORWARD DROP"
|
||||
bash_exec "$IPTABLES -F FORWARD"
|
||||
bash_exec "$IPTABLES -t nat -F"
|
||||
bash_exec "$IPTABLES -t mangle -F"
|
||||
bash_exec "$IPTABLES -t filter -F"
|
||||
|
||||
|
||||
|
||||
echo " External Interface: $EXTIF"
|
||||
echo " Internal Interface: $INTIF"
|
||||
|
||||
bash_exec "modprobe ip_tables"
|
||||
bash_exec "modprobe ip_conntrack"
|
||||
bash_exec "modprobe ip_conntrack_ftp"
|
||||
bash_exec "modprobe nf_conntrack_h323"
|
||||
bash_exec "modprobe nf_conntrack_irc"
|
||||
bash_exec "modprobe nf_conntrack_pptp"
|
||||
bash_exec "modprobe nf_conntrack_proto_gre"
|
||||
bash_exec "modprobe nf_conntrack_proto_sctp"
|
||||
bash_exec "modprobe nf_conntrack_tftp"
|
||||
bash_exec "modprobe nf_conntrack_sip"
|
||||
bash_exec "modprobe iptable_nat"
|
||||
bash_exec "modprobe x_tables"
|
||||
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$LTEIF.log_martians` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$EXTIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$EXTIF.log_martians` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$INTIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$INTIF.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 "sysctl -w net.ipv4.conf.$LTEIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$LTEIF.rp_filter` -eq 0" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$EXTIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$EXTIF.rp_filter` -eq 0" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$INTIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$INTIF.rp_filter` -eq 0" $LINENO
|
||||
|
||||
bash_exec "$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT"
|
||||
bash_exec "$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT"
|
||||
bash_exec "$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE"
|
||||
|
||||
bash_exec "ip route flush cache"
|
||||
|
||||
bash_exec "ip addr add dev $LTEIF $ENB_IPv4_CIDR"
|
||||
sleep 1
|
||||
bash_exec "ip addr add dev $LTEIF $ENB_IPv6_CIDR"
|
||||
sleep 1
|
||||
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $ENB_IPv6 -y $UE_IPv6 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s $ENB_IPv4/32 -t $UE_IPv4/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3"
|
||||
sleep 1
|
||||
|
||||
echo "#####################################################################"
|
||||
echo "iptables -t nat -nvL"
|
||||
echo "---------------------------------------------------------------------"
|
||||
iptables -t nat -nvL
|
||||
echo "#####################################################################"
|
||||
echo "ip route show table main"
|
||||
echo "---------------------------------------------------------------------"
|
||||
ip route show table main
|
||||
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 -D $EMULIF > /dev/null 2>&1
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -u0 -M0 -p2 -g3 -l3 -D $EMULIF
|
||||
|
||||
control_c
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#------------------------------------------------
|
||||
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
|
||||
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
|
||||
IP_DRIVER_NAME=oai_nw_drv
|
||||
###########################################################
|
||||
# CONFIGURE OPTIONS
|
||||
EMULIF="eth0"
|
||||
LTEIF="oai0"
|
||||
|
||||
#----------------------------------------------------------
|
||||
LTE_NETWORK_CIDR="10.0.1.0/24"
|
||||
ENB_IPv4="10.0.1.1"
|
||||
ENB_IPv6="2001:1::1"
|
||||
#----------------------------------------------------------
|
||||
UE_IPv4="10.0.1.2"
|
||||
UE_IPv6="2001:1::2"
|
||||
UE_IPv6_CIDR=$UE_IPv6"/64"
|
||||
UE_IPv4_CIDR=$UE_IPv4"/24"
|
||||
UE_IMEI="3,9,1,8,3,6,7,3,0,2,0,0,0,0"
|
||||
#----------------------------------------------------------
|
||||
|
||||
# +-------+ +-------+
|
||||
# | eNB | EMULIF | UE |
|
||||
# | +---------------------+ +
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | |
|
||||
# | | | +
|
||||
# | | | |
|
||||
# | | LTEIF | |
|
||||
# | +.................... + |
|
||||
# | |ENB_IPv4 UE_IPv4_CIDR| |
|
||||
# +-------+ LTE link over +-------+
|
||||
|
||||
###########################################################
|
||||
IPTABLES=/sbin/iptables
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
declare -x OPENAIR_DIR=""
|
||||
declare -x OPENAIR1_DIR=""
|
||||
declare -x OPENAIR2_DIR=""
|
||||
declare -x OPENAIR3_DIR=""
|
||||
declare -x OPENAIR_TARGETS=""
|
||||
###########################################################
|
||||
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
ctrl_c() {
|
||||
bash_exec "pkill oaisim"
|
||||
bash_exec "ip link set $LTEIF down"
|
||||
|
||||
bash_exec "rmmod $IP_DRIVER_NAME"
|
||||
|
||||
bash_exec "$IPTABLES -P INPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F INPUT"
|
||||
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F OUTPUT"
|
||||
bash_exec "$IPTABLES -P FORWARD ACCEPT"
|
||||
bash_exec "$IPTABLES -F FORWARD"
|
||||
bash_exec "$IPTABLES -t nat -F"
|
||||
bash_exec "$IPTABLES -t mangle -F"
|
||||
bash_exec "$IPTABLES -t filter -F"
|
||||
bash_exec "ip route flush cache"
|
||||
}
|
||||
|
||||
#bash_exec "set_openair"
|
||||
set_openair
|
||||
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
|
||||
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
|
||||
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
|
||||
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
|
||||
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
|
||||
|
||||
echo "Bringup UE interface"
|
||||
bash_exec "rmmod $IP_DRIVER_NAME"
|
||||
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green
|
||||
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET "
|
||||
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$UE_IMEI"
|
||||
|
||||
bash_exec "ip route flush cache"
|
||||
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
|
||||
|
||||
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"
|
||||
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $UE_IPv6/128 -y $ENB_IPv6/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s $UE_IPv4/32 -t $ENB_IPv4/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3"
|
||||
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"
|
||||
|
||||
echo "#####################################################################"
|
||||
echo "ip route show table main"
|
||||
echo "---------------------------------------------------------------------"
|
||||
ip route show table main
|
||||
|
||||
trap ctrl_c INT
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g3 -l3 -D $EMULIF > /dev/null 2>&1
|
||||
echo "End"
|
||||
ctrl_c
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#------------------------------------------------
|
||||
MAKE_IP_DRIVER_TARGET="naslite_netlink_ether"
|
||||
MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim"
|
||||
MAKE_REMSERIAL_TARGET="remserial"
|
||||
IP_DRIVER_NAME=oai_nw_drv
|
||||
###########################################################
|
||||
# CONFIGURE OPTIONS
|
||||
EMULIF="eth0"
|
||||
LTEIF="oai0"
|
||||
|
||||
INTIF="ppp0"
|
||||
EXTIF=$LTEIF
|
||||
#----------------------------------------------------------
|
||||
LTE_NETWORK_CIDR="10.0.1.0/24"
|
||||
ENB_IPv4="10.0.1.1"
|
||||
ENB_IPv6="2001:1::1"
|
||||
#----------------------------------------------------------
|
||||
UE_IPv4="10.0.1.2"
|
||||
UE_IPv6="2001:1::2"
|
||||
UE_IPv6_CIDR=$UE_IPv6"/64"
|
||||
UE_IPv4_CIDR=$UE_IPv4"/24"
|
||||
UE_IMEI="3,9,1,8,3,6,7,3,0,0,0,0,0,0"
|
||||
#----------------------------------------------------------
|
||||
USE_PPP="yes"
|
||||
PPP_OPTIONS="proxyarp passive nodetach ipcp-accept-remote"
|
||||
PPP_DEVICE="ttyPPP_DROID"
|
||||
PPP_SPEED="460800"
|
||||
UE_PPP_IPv4="192.168.15.1"
|
||||
TERMINAL_PPP_IPv4="192.168.15.175"
|
||||
REMSERIAL_UDP_PORT="23001"
|
||||
#----------------------------------------------------------
|
||||
|
||||
# +-------+ +-------+ +-------+
|
||||
# | eNB | EMULIF | UE |INTIF |ANDROID|
|
||||
# | +---------------------+ +---------------------+ TERMIN|
|
||||
# | | | | ppp link over | AL |
|
||||
# | | | | UDP over ethernet | |
|
||||
# | | | | (remserial) | |
|
||||
# | | | | | |
|
||||
# | | | +---serial link-------+ |
|
||||
# | | | | for AT commands | |
|
||||
# | | LTEIF | | | |
|
||||
# | +.................... + | | |
|
||||
# | |ENB_IPv4 UE_IPv4_CIDR| | | |
|
||||
# +-------+ LTE link over +-------+ +-------+
|
||||
|
||||
###########################################################
|
||||
IPTABLES=/sbin/iptables
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
declare -x OPENAIR_DIR=""
|
||||
declare -x OPENAIR1_DIR=""
|
||||
declare -x OPENAIR2_DIR=""
|
||||
declare -x OPENAIR3_DIR=""
|
||||
declare -x OPENAIR_TARGETS=""
|
||||
###########################################################
|
||||
|
||||
|
||||
black='\E[30m'
|
||||
red='\E[31m'
|
||||
green='\E[32m'
|
||||
yellow='\E[33m'
|
||||
blue='\E[34m'
|
||||
magenta='\E[35m'
|
||||
cyan='\E[36m'
|
||||
white='\E[37m'
|
||||
|
||||
ROOT_UID=0
|
||||
E_NOTROOT=67
|
||||
|
||||
|
||||
cecho() # Color-echo
|
||||
# arg1 = message
|
||||
# arg2 = color
|
||||
{
|
||||
local default_msg="No Message."
|
||||
message=${1:-$default_msg}
|
||||
color=${2:-$black}
|
||||
echo -e "$color"
|
||||
echo -n "$message"
|
||||
tput sgr0
|
||||
echo
|
||||
return
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $red
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $yellow
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
local my_string=""
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
my_string="$my_string$1"
|
||||
shift
|
||||
done
|
||||
cecho "$my_string" $green
|
||||
}
|
||||
|
||||
set_openair() {
|
||||
path=`pwd`
|
||||
declare -i length_path
|
||||
declare -i index
|
||||
length_path=${#path}
|
||||
|
||||
index=`echo $path | grep -b -o 'targets' | cut -d: -f1`
|
||||
#echo ${path%$token*}
|
||||
if [[ $index -lt $length_path && index -gt 0 ]]
|
||||
then
|
||||
declare -x OPENAIR_DIR
|
||||
index=`expr $index - 1`
|
||||
openair_path=`echo $path | cut -c1-$index`
|
||||
#openair_path=`echo ${path:0:$index}`
|
||||
export OPENAIR_DIR=$openair_path
|
||||
export OPENAIR1_DIR=$openair_path/openair1
|
||||
export OPENAIR2_DIR=$openair_path/openair2
|
||||
export OPENAIR3_DIR=$openair_path/openair3
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
return 0
|
||||
fi
|
||||
return -1
|
||||
}
|
||||
|
||||
bash_exec() {
|
||||
output=$($1 2>&1)
|
||||
result=$?
|
||||
if [ $result -eq 0 ]
|
||||
then
|
||||
echo_success "$1"
|
||||
else
|
||||
echo_error "$1: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
while [ $? -ne 0 ]; do
|
||||
echo_warning "WAITING FOR $1 START"
|
||||
sleep 2
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
done
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
assert() {
|
||||
# If condition false
|
||||
# exit from script with error message
|
||||
E_PARAM_ERR=98
|
||||
E_PARAM_FAILED=99
|
||||
|
||||
if [ -z "$2" ] # Not enought parameters passed.
|
||||
then
|
||||
return $E_PARAM_ERR
|
||||
fi
|
||||
|
||||
lineno=$2
|
||||
if [ ! $1 ]
|
||||
then
|
||||
echo "Assertion failed: \"$1\""
|
||||
echo "File \"$0\", line $lineno"
|
||||
exit $E_ASSERT_FAILED
|
||||
fi
|
||||
}
|
||||
|
||||
ctrl_c() {
|
||||
bash_exec "pkill oaisim"
|
||||
if [ "$USE_PPP"x = yesx ]; then
|
||||
bash_exec "pkill remserial.bash"
|
||||
bash_exec "pkill ppp_android.bash"
|
||||
fi
|
||||
bash_exec "pkill AT_serial_bouchon.py"
|
||||
bash_exec "ip link set $LTEIF down"
|
||||
|
||||
bash_exec "ip route del default via $ENB_IPv4 dev $EXTIF table int2lte"
|
||||
bash_exec "ip route flush table int2lte"
|
||||
bash_exec "ip rule del prio 1000"
|
||||
|
||||
bash_exec "rmmod $IP_DRIVER_NAME"
|
||||
|
||||
bash_exec "$IPTABLES -P INPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F INPUT"
|
||||
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F OUTPUT"
|
||||
bash_exec "$IPTABLES -P FORWARD ACCEPT"
|
||||
bash_exec "$IPTABLES -F FORWARD"
|
||||
bash_exec "$IPTABLES -t nat -F"
|
||||
bash_exec "$IPTABLES -t mangle -F"
|
||||
bash_exec "$IPTABLES -t filter -F"
|
||||
bash_exec "ip route flush cache"
|
||||
}
|
||||
|
||||
#bash_exec "set_openair"
|
||||
set_openair
|
||||
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
|
||||
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
|
||||
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
|
||||
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
|
||||
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
|
||||
|
||||
echo "Bringup UE interface"
|
||||
bash_exec "rmmod $IP_DRIVER_NAME"
|
||||
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET $MAKE_REMSERIAL_TARGET....." $green
|
||||
bash_exec "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET $MAKE_REMSERIAL_TARGET"
|
||||
bash_exec "insmod $OPENAIR2_DIR/NAS/DRIVER/LITE/$IP_DRIVER_NAME.ko oai_nw_drv_IMEI=$UE_IMEI"
|
||||
|
||||
|
||||
echo " Enabling ipv4 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_forward=1"
|
||||
assert "`sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
echo " Enabling ipv6 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv6.conf.all.forwarding=1"
|
||||
assert "`sysctl -n net.ipv6.conf.all.forwarding` -eq 1" $LINENO
|
||||
|
||||
|
||||
if [ "$USE_PPP"x = yesx ]; then
|
||||
echo " PPP enabled.."
|
||||
command -v pppd > /dev/null 2>&1 || { echo_error "pppd executable needed - please install it"; exit 1;}
|
||||
command -v remserial.udp > /dev/null 2>&1 || { echo_error "remserial.udp executable needed - please install it"; exit 1;}
|
||||
#generate pppd script
|
||||
rm -f /tmp/ppp_android.bash
|
||||
bash_exec "touch /tmp/ppp_android.bash"
|
||||
if [ ! -f /tmp/ppp_android.bash ]; then
|
||||
echo_error "Cannot generate /tmp/ppp_android.bash file, exiting"
|
||||
exit 1
|
||||
fi
|
||||
echo "#!/bin/bash" >> /tmp/ppp_android.bash
|
||||
echo "pppd $PPP_OPTIONS $UE_PPP_IPv4:$TERMINAL_PPP_IPv4 /dev/$PPP_DEVICE $PPP_SPEED" >> /tmp/ppp_android.bash
|
||||
bash_exec "chmod 777 /tmp/ppp_android.bash"
|
||||
assert " -x /tmp/ppp_android.bash " $LINENO
|
||||
|
||||
#generate remserial script
|
||||
rm -f /tmp/remserial.bash
|
||||
bash_exec "touch /tmp/remserial.bash"
|
||||
if [ ! -f /tmp/remserial.bash ]; then
|
||||
echo_error "Cannot generate /tmp/remserial.bash file, exiting"
|
||||
exit 1
|
||||
fi
|
||||
echo "#!/bin/bash" >> /tmp/remserial.bash
|
||||
echo "remserial.udp -s \"$PPP_SPEED raw\" -p $REMSERIAL_UDP_PORT -l /dev/$PPP_DEVICE /dev/ptmx" >> /tmp/remserial.bash
|
||||
bash_exec "chmod 777 /tmp/remserial.bash"
|
||||
assert " -x /tmp/remserial.bash " $LINENO
|
||||
fi
|
||||
|
||||
xterm -e $THIS_SCRIPT_PATH/AT_serial_bouchon.py &
|
||||
wait_process_started AT_serial_bouchon.py
|
||||
|
||||
if [ "$USE_PPP"x = yesx ]; then
|
||||
xterm -e /tmp/remserial.bash &
|
||||
wait_process_started remserial.bash
|
||||
|
||||
xterm -e /tmp/ppp_android.bash &
|
||||
wait_process_started ppp_android.bash
|
||||
fi
|
||||
|
||||
|
||||
assert " -x $IPTABLES " $LINENO
|
||||
|
||||
bash_exec "ip route del default via $ENB_IPv4 dev $EXTIF table int2lte"
|
||||
bash_exec "ip route flush table int2lte"
|
||||
bash_exec "ip rule del prio 1000"
|
||||
|
||||
bash_exec "$IPTABLES -P INPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F INPUT"
|
||||
bash_exec "$IPTABLES -P OUTPUT ACCEPT"
|
||||
bash_exec "$IPTABLES -F OUTPUT"
|
||||
bash_exec "$IPTABLES -P FORWARD DROP"
|
||||
bash_exec "$IPTABLES -F FORWARD"
|
||||
bash_exec "$IPTABLES -t nat -F"
|
||||
bash_exec "$IPTABLES -t mangle -F"
|
||||
bash_exec "$IPTABLES -t filter -F"
|
||||
|
||||
bash_exec "ip route flush cache"
|
||||
bash_exec "ip route add 239.0.0.160/28 dev $EMULIF"
|
||||
|
||||
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"
|
||||
|
||||
echo " Enabling proxy ARP.."
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.proxy_arp=1"
|
||||
assert "`sysctl -n net.ipv4.conf.all.proxy_arp` -eq 1" $LINENO
|
||||
|
||||
|
||||
# -a -> Add RB
|
||||
# -d -> Delete RB
|
||||
# -cxx -> lcr
|
||||
# -ixx -> instance
|
||||
# -zxx -> dscp
|
||||
# -fxxx -> classref (uid of a classifier entry) if fn is used , fn is used for send classifier and n+1 for receive classifier
|
||||
# -sxxx -> source ipv4 address
|
||||
# -txxx -> destination ipv4 address
|
||||
# -x -> source ipv6 address
|
||||
# -y -> destination ipv6 address
|
||||
# -r -> radio bearer id
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f0 -i0 -z0 -x $UE_IPv6/128 -y $ENB_IPv6/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f2 -i0 -z0 -s $UE_IPv4/32 -t $ENB_IPv4/32 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f4 -i0 -z64 -x 0::0/128 -y 0::0/128 -r 3"
|
||||
bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -f6 -i0 -z64 -s 0.0.0.0/32 -t 0.0.0.0/32 -r 3"
|
||||
sleep 1
|
||||
|
||||
echo " External Interface: $EXTIF"
|
||||
echo " Internal Interface: $INTIF"
|
||||
|
||||
bash_exec "modprobe ip_tables"
|
||||
bash_exec "modprobe ip_conntrack"
|
||||
bash_exec "modprobe ip_conntrack_ftp"
|
||||
bash_exec "modprobe nf_conntrack_h323"
|
||||
bash_exec "modprobe nf_conntrack_irc"
|
||||
bash_exec "modprobe nf_conntrack_pptp"
|
||||
bash_exec "modprobe nf_conntrack_proto_gre"
|
||||
bash_exec "modprobe nf_conntrack_proto_sctp"
|
||||
bash_exec "modprobe nf_conntrack_tftp"
|
||||
bash_exec "modprobe nf_conntrack_sip"
|
||||
bash_exec "modprobe iptable_nat"
|
||||
bash_exec "modprobe x_tables"
|
||||
|
||||
echo " Enabling DynamicAddr.."
|
||||
bash_exec "sysctl -w net.ipv4.ip_dynaddr=1"
|
||||
assert " `sysctl -n net.ipv4.ip_dynaddr` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$LTEIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$LTEIF.log_martians` -eq 1" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$EMULIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$EMULIF.log_martians` -eq 1" $LINENO
|
||||
|
||||
if [ ! "$USE_PPP"x = yesx ]; then
|
||||
bash_exec "sysctl -w net.ipv4.conf.$INTIF.log_martians=1"
|
||||
assert " `sysctl -n net.ipv4.conf.$INTIF.log_martians` -eq 1" $LINENO
|
||||
fi
|
||||
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 "sysctl -w net.ipv4.conf.$LTEIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$LTEIF.rp_filter` -eq 0" $LINENO
|
||||
|
||||
bash_exec "sysctl -w net.ipv4.conf.$EMULIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$EMULIF.rp_filter` -eq 0" $LINENO
|
||||
|
||||
if [ ! "$USE_PPP"x = yesx ]; then
|
||||
bash_exec "sysctl -w net.ipv4.conf.$INTIF.rp_filter=0"
|
||||
assert " `sysctl -n net.ipv4.conf.$INTIF.rp_filter` -eq 0" $LINENO
|
||||
fi
|
||||
|
||||
bash_exec "$IPTABLES -t mangle -A PREROUTING -i $INTIF -j MARK --set-mark 22"
|
||||
|
||||
bash_exec "$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT"
|
||||
bash_exec "$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT"
|
||||
bash_exec "$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE"
|
||||
|
||||
bash_exec "ip route add 127.0.0.0/8 dev lo table int2lte"
|
||||
bash_exec "ip route add $LTE_NETWORK_CIDR dev $EXTIF table int2lte scope link"
|
||||
bash_exec "ip route add default via $ENB_IPv4 dev $EXTIF table int2lte scope global"
|
||||
|
||||
bash_exec "ip route flush cache"
|
||||
|
||||
bash_exec "ip rule add fwmark 22 lookup int2lte prio 1000"
|
||||
|
||||
echo "#####################################################################"
|
||||
echo "iptables -t nat -nvL"
|
||||
echo "---------------------------------------------------------------------"
|
||||
iptables -t nat -nvL
|
||||
echo "#####################################################################"
|
||||
echo "iptables -t mangle -nvL"
|
||||
echo "---------------------------------------------------------------------"
|
||||
iptables -t mangle -nvL
|
||||
echo "#####################################################################"
|
||||
echo "iptables -t filter -nvL"
|
||||
echo "---------------------------------------------------------------------"
|
||||
iptables -t filter -nvL
|
||||
echo "#####################################################################"
|
||||
echo "ip rule show"
|
||||
echo "---------------------------------------------------------------------"
|
||||
ip rule show
|
||||
echo "#####################################################################"
|
||||
echo "ip route show table int2lte"
|
||||
echo "---------------------------------------------------------------------"
|
||||
ip route show table int2lte
|
||||
echo "#####################################################################"
|
||||
echo "ip route show table main"
|
||||
echo "---------------------------------------------------------------------"
|
||||
ip route show table main
|
||||
|
||||
trap ctrl_c INT
|
||||
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -b0 -M1 -p2 -g3 -l3 > /dev/null 2>&1
|
||||
echo "End"
|
||||
ctrl_c
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user