- Scripts for second testbed
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4021 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Executable
+316
@@ -0,0 +1,316 @@
|
||||
#!/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 eth0
|
||||
#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 eth0
|
||||
|
||||
rm -f /tmp/lte_enb.log
|
||||
|
||||
#nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -M0 -p3 -g1 -l7 2>&1 | grep PDCP &
|
||||
rm -f /tmp/enb.txt
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -b1 -M0 -p3 -g1 -l7 -Pwireshark -D192.168.100.200 > /tmp/ue.txt &
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -M0 -p3 -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:7::1/64
|
||||
ip link set oai0 promisc on
|
||||
|
||||
ip -6 addr add 5000::57/64 dev eth2
|
||||
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f0 -z0 -x 0::0/128 -y 2001:7::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:7::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/32 -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 -c0 -i0 -f14 -z64 -x 0::0/128 -y FE80:0:0:0:239:18FF:FE36:7302/64 -r 3"
|
||||
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f16 -z0 -x 0::0/128 -y 2001:7::6/128 -r 14"
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f18 -z0 -s 10.0.1.1/32 -t 10.0.1.7/32 -r 14"
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f20 -z64 -x 0::0/128 -y 2001:7::7/128 -r 14"
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f22 -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 -f24 -z64 -s 0.0.0.0/32 -t 10.0.1.7/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 10.0.1.255/32 -r 14"
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c1 -i0 -f28 -z64 -s 0.0.0.0/32 -t 224.0.0.0/8 -r 14"
|
||||
#bash_exec "$OPENAIR2_DIR/NAS/DRIVER/LITE/RB_TOOL/rb_tool -a -c0 -i0 -f30 -z64 -x 0::0/128 -y FE80:0:0:0:239:18FF:FE36:7305/64 -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 ipv4 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 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 ipv6 forwarding.."
|
||||
bash_exec "sysctl -w net.ipv6.conf.default.forwarding=1"
|
||||
assert "`sysctl -n net.ipv6.conf.default.forwarding` -eq 1" $LINENO
|
||||
|
||||
# route to server2 through corerouter
|
||||
|
||||
bash_exec "ip -6 route del 6000::/64 via 5000::1 dev eth2"
|
||||
bash_exec "ip -6 route add 6000::/64 via 5000::1 dev eth2"
|
||||
bash_exec "ip -6 route del default via 5000::1 dev eth2"
|
||||
bash_exec "ip -6 route add default via 5000::1 dev eth2"
|
||||
|
||||
bash_exec "/sbin/iptables -t mangle -F"
|
||||
bash_exec "/sbin/iptables -t nat -F"
|
||||
bash_exec "/sbin/iptables -t raw -F"
|
||||
bash_exec "/sbin/iptables -t filter -F"
|
||||
bash_exec "/sbin/ip6tables -t mangle -F"
|
||||
bash_exec "/sbin/ip6tables -t filter -F"
|
||||
bash_exec "/sbin/ip6tables -t raw -F"
|
||||
|
||||
#DOCOMO LINE
|
||||
#bash_exec "ip6tables -t mangle -A PREROUTING -j NFQUEUE --queue-num 1"
|
||||
|
||||
#EURECOM TRAFFIC SHAPPING LIMIT BW TO 3.8 MBits/S
|
||||
# Delete existing rules
|
||||
#bash_exec "tc class del dev oai0 parent 1:1 classid 1:20 htb"
|
||||
#bash_exec "tc class del dev oai0 parent 1:1 classid 1:30 htb"
|
||||
#bash_exec "tc class del dev oai0 parent 1: classid 1:1"
|
||||
#bash_exec "tc qdisc del dev oai0 root handle 1: htb"
|
||||
#bash_exec "tc qdisc del dev oai0 root"
|
||||
#bash_exec "tc qdisc del dev eth3 root"
|
||||
## Turn on queuing discipline
|
||||
#bash_exec "tc qdisc add dev oai0 root handle 1: htb default 30"
|
||||
#bash_exec "tc class add dev oai0 parent 1: classid 1:1 htb rate 3800kbit burst 15k"
|
||||
### Define 2 classes (v4, v6) with limitations i.e. set the allowed bandwidth to 2mbit
|
||||
### and burst bandwidth to 2500kbit for mark 1
|
||||
#bash_exec "tc class add dev oai0 parent 1:1 classid 1:10 htb rate 3800kbit ceil 4000kbit burst 15k"
|
||||
#bash_exec "tc class add dev oai0 parent 1:1 classid 1:20 htb rate 3800kbit ceil 4000kbit burst 15k"
|
||||
#bash_exec "tc class add dev oai0 parent 1:1 classid 1:30 htb rate 1kbit ceil 2mbit burst 15k"
|
||||
|
||||
##bash_exec "tc qdisc add dev oai0 parent 1:10 handle 10: sfq perturb 10"
|
||||
##bash_exec "tc qdisc add dev oai0 parent 1:20 handle 20: sfq perturb 10"
|
||||
##bash_exec "tc qdisc add dev oai0 parent 1:30 handle 30: sfq perturb 10"
|
||||
|
||||
##bash_exec "/sbin/tc class add dev oai0 parent 1:0 classid 1:4 htb rate 1024kbps ceil 2048kbps prio 0"
|
||||
bash_exec "/sbin/iptables -A OUTPUT -t mangle --destination 10.0.1.9 -j MARK --set-mark 3"
|
||||
bash_exec "/sbin/iptables -A OUTPUT -t mangle --destination 10.0.1.7 -j MARK --set-mark 14"
|
||||
bash_exec "/sbin/ebtables -t nat -A POSTROUTING -p arp --arp-ip-dst 10.0.1.9/32 -j mark --mark-set 3"
|
||||
bash_exec "/sbin/ebtables -t nat -A POSTROUTING -p arp --arp-ip-dst 10.0.1.7/32 -j mark --mark-set 14"
|
||||
bash_exec "/sbin/ip6tables -A POSTROUTING -t mangle --destination 2001:7::9 -j MARK --set-mark 3"
|
||||
bash_exec "/sbin/ip6tables -A POSTROUTING -t mangle --destination 2001:7::7 -j MARK --set-mark 14"
|
||||
bash_exec "/sbin/ip6tables -A POSTROUTING -t mangle --destination FE80:0:0:0:239:18FF:FE36:7302 -j MARK --set-mark 3"
|
||||
bash_exec "/sbin/ip6tables -A POSTROUTING -t mangle --destination FE80:0:0:0:239:18FF:FE36:7305 -j MARK --set-mark 14"
|
||||
#bash_exec "/sbin/iptables -A OUTPUT -t mangle -o oai0 -j MARK --set-mark 1"
|
||||
|
||||
##Finally, assign it to appropriate qdisc
|
||||
#bash_exec "tc filter add dev oai0 parent 1:0 prio 2 u32 match ip6 dst 2001:7::0/64 flowid 1:20"
|
||||
#bash_exec "tc filter add dev oai0 parent 1:0 protocol ip prio 1 handle 1 fw flowid 1:10"
|
||||
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 1234 -u0 -M0 -p3 -g1 -l3 -m18 -Deth2 -V
|
||||
|
||||
while true; do sleep 10000; done
|
||||
|
||||
echo "End"
|
||||
Executable
+186
@@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
declare -x OPENAIR_DIR="/usr/local/src/trunk"
|
||||
declare -x OPENAIR1_DIR="/usr/local/src/trunk/openair1"
|
||||
declare -x OPENAIR2_DIR="/usr/local/src/trunk/openair2"
|
||||
declare -x OPENAIR3_DIR="/usr/local/src/trunk/openair3"
|
||||
declare -x OPENAIR_TARGETS="/usr/local/src/trunk/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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
is_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo_success "PROCESS $1 NOT STARTED"
|
||||
return 1
|
||||
fi
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
set_openair
|
||||
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 eth0
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.7 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:7::7/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
|
||||
|
||||
ip -6 r d default via 2001:7::1 dev oai0
|
||||
ip -6 r a default via 2001:7::1 dev oai0
|
||||
|
||||
bash_exec "/sbin/iptables -A OUTPUT -t mangle -o oai0 -j MARK --set-mark 3"
|
||||
|
||||
echo "to see UE stats, pleasae run : watch_ue script"
|
||||
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l7 -b0 -M2 -p3 -g1 -Deth0"
|
||||
pkill oaisim
|
||||
# nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l3 -b0 -M2 -p3 -g1 -m18 -V -Pwireshark -Deth0 > /tmp/ue.txt 2>&1
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l7 -b0 -u1 -M2 -p3 -g1 -Pwireshark -Deth0 > /tmp/ue.txt
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l3 -b0 -M2 -p3 -g1 -m18 -Deth0
|
||||
echo "End"
|
||||
|
||||
Executable
+186
@@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
|
||||
###########################################################
|
||||
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
|
||||
declare -x OPENAIR_DIR="/usr/local/src/TEST2"
|
||||
declare -x OPENAIR1_DIR="/usr/local/src/TEST2/openair1"
|
||||
declare -x OPENAIR2_DIR="/usr/local/src/TEST2/openair2"
|
||||
declare -x OPENAIR3_DIR="/usr/local/src/TEST2/openair3"
|
||||
declare -x OPENAIR_TARGETS="/usr/local/src/TEST2/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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
is_process_started () {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo_error "WAITING FOR PROCESS START: NO PROCESS"
|
||||
return 1
|
||||
fi
|
||||
ps -C $1 > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo_success "PROCESS $1 NOT STARTED"
|
||||
return 1
|
||||
fi
|
||||
echo_success "PROCESS $1 STARTED"
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
set_openair
|
||||
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 eth1
|
||||
ip link set oai0 up
|
||||
sleep 1
|
||||
ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
|
||||
sleep 1
|
||||
ip addr add dev oai0 2001:7::9/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
|
||||
|
||||
ip -6 r d default via 2001:7::1 dev oai0
|
||||
ip -6 r a default via 2001:7::1 dev oai0
|
||||
|
||||
bash_exec "/sbin/iptables -A OUTPUT -t mangle -o oai0 -j MARK --set-mark 3"
|
||||
|
||||
echo "to see UE stats, pleasae run : watch_ue script"
|
||||
echo "$OPENAIR_TARGETS/SIMU/USER/oaisim -b0 -M1 -p3 -g1 -Pwireshark -l7"
|
||||
pkill oaisim
|
||||
# nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l3 -b0 -M2 -p3 -g1 -m18 -V -Pwireshark -Deth0 > /tmp/ue.txt 2>&1
|
||||
nice --adjustment=-10 $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5431 -l5 -b0 -u1 -M1 -p3 -g1 -Pwireshark -Deth1 > /tmp/ue.txt
|
||||
#gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -E 5432 -l3 -b0 -M2 -p3 -g1 -m18 -Deth0
|
||||
echo "End"
|
||||
|
||||
Reference in New Issue
Block a user