From 043ca1857e037c15af49eb41427d72bfbf7adeed Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Tue, 21 Jan 2014 16:23:17 +0000 Subject: [PATCH] Not complete, but comitted for sharing (missing /etc/ip_route2/rt_tables part) git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4924 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/SCRIPTS/start_lte-enb-ovs.bash | 146 ++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100755 openair-cn/SCRIPTS/start_lte-enb-ovs.bash diff --git a/openair-cn/SCRIPTS/start_lte-enb-ovs.bash b/openair-cn/SCRIPTS/start_lte-enb-ovs.bash new file mode 100755 index 0000000000..fbda43401d --- /dev/null +++ b/openair-cn/SCRIPTS/start_lte-enb-ovs.bash @@ -0,0 +1,146 @@ +#!/bin/bash +# Author Lionel GAUTHIER 01/20/2014 +# +# This script start ENB+UE (all in one executable, on one host) with openvswitch setting +# MME+SP-GW executable have to be launched on the same host by your own (start_lte-epc-ovs.bash). +# +# hss.eur +# | +# +-----------+ +------+ +-----------+ v +----------+ +# | eNB +------+ | ovs | VLAN 1+------+ MME +----+ +---+ HSS | +# | |cpenb0+------------------+cpmme0| | +------+ | | +# | +------+ |bridge| +------+ +----+ +---+ | +# | |upenb0+-------+ | | | +----------+ +# +-----------+------+ | | | +-----------+ +# +---|--+ | router.eur +# | +-----------+ | +--------------+ +# | | S+P-GW | v | ROUTER | +# | VLAN2 +------+ +-------+ +----+ +----+ +# +----------+upsgw0| |sgi +-...-+ | | +---...Internet +# +------+ +-------+ +----+ +----+ +# | | 11 VLANS | | +# +-----------+ ids=[5..15] +--------------+ +# +########################################################### +# Parameters +########################################################### +declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim ENABLE_ITTI=1 USE_MME=R10 NAS=1 Rel10=1" +declare MAKE_IP_DRIVER_TARGET="ue_ip.ko" +declare IP_DRIVER_NAME="ue_ip" +declare LTEIF="oip1" +declare UE_IPv4="10.0.0.8" +declare UE_IPv6="2001:1::8" +declare UE_IPv6_CIDR=$UE_IPv6"/64" +declare UE_IPv4_CIDR=$UE_IPv4"/24" +declare BRIDGE="vswitch" + + +########################################################### +THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) +source $THIS_SCRIPT_PATH/utils.bash +########################################################### + + +####################################################### +# SOURCE $OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf +####################################################### +rm -f /tmp/source.txt +if [ -f $OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf ] +then + echo_warning "Using config file $OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf" + cat $OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf | tr -d " " > /tmp/source.txt + source /tmp/source.txt +else + echo_warning "MME config file not found for host $HOSTNAME, using default: $OPENAIRCN_DIR/UTILS/CONF/mme_default.conf" + if [ -f $OPENAIRCN_DIR/UTILS/CONF/mme_default.conf ] + then + cat $OPENAIRCN_DIR/UTILS/CONF/mme_default.conf | tr -d " " > /tmp/source.txt + source /tmp/source.txt + else + echo_error "Default MME config file not found, exiting" + fi +fi + +####################################################### +# SOURCE $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf +####################################################### +rm -f /tmp/source.txt +if [ -f $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf ] +then + echo_warning "Using config file $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf" + cat $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf | tr -d " " > /tmp/source.txt + source /tmp/source.txt +else + echo_warning "eNB config file not found for host $HOSTNAME, using default: $OPENAIRCN_DIR/UTILS/CONF/enb_default.conf" + if [ -f $OPENAIRCN_DIR/UTILS/CONF/enb_default.conf ] + then + cat $OPENAIRCN_DIR/UTILS/CONF/enb_default.conf | tr -d " " > /tmp/source.txt + source /tmp/source.txt + else + echo_error "Default eNB config file not found, exiting" + fi +fi + +####################################################### +# USIM, NVRAM files +####################################################### +if [ ! -f $OPENAIRCN_DIR/bin/ue_data ]; then + make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS veryveryclean + make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS PROCESS=UE +fi +if [ ! -f $OPENAIRCN_DIR/bin/usim_data ]; then + make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS veryveryclean + make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS PROCESS=UE +fi +if [ ! -f .ue.nvram ]; then + # generate .ue_emm.nvram .ue.nvram + $OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/ue_data -g +fi + +if [ ! -f .usim.nvram ]; then + # generate .usim.nvram + $OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/usim_data -g +fi + +################################################## +# LAUNCH eNB + UE executable +################################################## +echo "Bringup UE interface" +pkill oaisim +bash_exec "rmmod $IP_DRIVER_NAME" > /dev/null 2>&1 + +cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green +#bash_exec "make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET " +make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET || exit 1 +#bash_exec "make --directory=$OPENAIR_TARGETS/SIMU/USER $MAKE_LTE_ACCESS_STRATUM_TARGET " +make --directory=$OPENAIR_TARGETS/SIMU/USER $MAKE_LTE_ACCESS_STRATUM_TARGET || exit 1 + +bash_exec "insmod $OPENAIR2_DIR/NETWORK_DRIVER/UE_IP/$IP_DRIVER_NAME.ko" + +bash_exec "ip route flush cache" + +bash_exec "ip link set $LTEIF up" +sleep 1 +bash_exec "ip addr add dev $LTEIF $UE_IPv4_CIDR" +bash_exec "ip addr add dev $LTEIF $UE_IPv6_CIDR" + +sleep 1 + +bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1" +assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO + +echo " Disabling reverse path filtering" +bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0" +assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO + + +bash_exec "ip route flush cache" + +# please add table 200 lte in/etc/iproute2/rt_tables +ip rule add fwmark 5 table lte +ip route add default dev $LTEIF table lte + +#gdb --args +$OPENAIR_TARGETS/SIMU/USER/oaisim -a -u1 -l7 -O $MME_IP_ADDRESS_FOR_S1_MME + + -- 2.26.2