start_lte-epc-ovs.bash 18.1 KB
Newer Older
Cedric Roux's avatar
 
Cedric Roux committed
1
#!/bin/bash
Lionel Gauthier's avatar
Lionel Gauthier committed
2 3 4 5 6
# Author Lionel GAUTHIER 01/20/2014
#
# This script start MME+S/P-GW (all in one executable, on one host) with openvswitch setting
# eNB executable have to be launched on the same host by your own (start_lte-enb-ovs.bash).
#
Lionel Gauthier's avatar
Lionel Gauthier committed
7 8
#                                                                           hss.eur
#                                                                             |
Cedric Roux's avatar
 
Cedric Roux committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#        +-----------+          +------+              +-----------+           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]    +--------------+
#
BRIDGE="vswitch"

###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
Lionel Gauthier's avatar
Lionel Gauthier committed
28
source $THIS_SCRIPT_PATH/utils.bash
Cedric Roux's avatar
 
Cedric Roux committed
29 30
###########################################################

Lionel Gauthier's avatar
Lionel Gauthier committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
test_command_install_package "gccxml" "gccxml" "--force-yes"
test_command_install_package "vconfig" "vlan"
test_command_install_package "iptables" "iptables"
test_command_install_package "ip" "iproute"
test_command_install_script   "ovs-vsctl" "$OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash"
test_command_install_script   "tunctl" "uml-utilities"
if [ ! -d /usr/local/etc/freeDiameter ]
    then
        cd $OPENAIRCN_DIR/S6A/freediameter && ./install_freediameter.sh
    else
        echo_success "freediameter is installed"
fi

test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash"

# One mor check about version of asn1c
ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24"
ASN1C_COMPILER_VERSION_MESSAGE=`asn1c -h 2>&1 | grep -i ASN\.1\ Compiler`
##ASN1C_COMPILER_VERSION_MESSAGE=`trim $ASN1C_COMPILER_VERSION_MESSAGE`
if [ "$ASN1C_COMPILER_VERSION_MESSAGE" != "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE" ]
then
    diff <(echo -n "$ASN1C_COMPILER_VERSION_MESSAGE") <(echo -n "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE")
    echo_error "Version of asn1c is not the required one, do you want to install the required one (overwrite installation) ? (Y/n)"
    echo_error "$ASN1C_COMPILER_VERSION_MESSAGE"
    while read -r -n 1 -s answer; do
        if [[ $answer = [YyNn] ]]; then
            [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash
            [[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1
            break
        fi
    done
fi
Cedric Roux's avatar
 
Cedric Roux committed
63

Lionel Gauthier's avatar
Lionel Gauthier committed
64 65 66 67
# May we have booted on a new kernel, not the one when we build vswitch kernel module
if [ ! -f /lib/modules/`uname -r`/extra/openvswitch.ko ]; then
    $OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash
fi
Lionel Gauthier's avatar
Lionel Gauthier committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

IPTABLES=`which iptables`

cd $OPENAIRCN_DIR
##################################
# Get or set OBJ DIR and compile #
##################################
# TEST IF EXIST
OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*`
if [ -n "$OBJ_DIR" ]
then
    OBJ_DIR=`basename $OBJ_DIR`
    if [ ! -f $OBJ_DIR/Makefile ]
    then
        cd ./$OBJ_DIR
        echo_success "Invoking configure"
        rm -f Makefile
85
        ../configure --enable-standalone-epc --enable-raw-socket-for-sgi  LDFLAGS=-L/usr/local/lib
Lionel Gauthier's avatar
Lionel Gauthier committed
86 87 88 89
    else
        cd ./$OBJ_DIR
    fi
else
90
    OBJ_DIR="objs"
Lionel Gauthier's avatar
Lionel Gauthier committed
91 92 93 94 95 96
    bash_exec "mkdir -m 777 ./$OBJ_DIR"
    echo_success "Created $OBJ_DIR directory"
    echo_success "Invoking autogen"
    bash_exec "./autogen.sh"
    cd ./$OBJ_DIR
    echo_success "Invoking configure"
97
    ../configure --enable-standalone-epc --enable-raw-socket-for-sgi  LDFLAGS=-L/usr/local/lib
Lionel Gauthier's avatar
Lionel Gauthier committed
98 99 100 101 102 103 104 105 106 107 108 109 110
fi
if [ -f Makefile ]
then
    echo_success "Compiling..."
    bash_exec "make"
else
    echo_error "Configure failed, exiting"
    exit 1
fi
cd $OPENAIRCN_DIR


cat $OPENAIRCN_DIR/$OBJ_DIR/Makefile | grep CFLAGS\ \=\  | grep DENABLE_USE_NETFILTER_FOR_SGI
Cedric Roux's avatar
 
Cedric Roux committed
111 112 113 114 115 116 117
if [ $? -ne 0 ]
then
    export ENABLE_USE_NETFILTER_FOR_SGI=0
else
    export ENABLE_USE_NETFILTER_FOR_SGI=1
fi

Lionel Gauthier's avatar
Lionel Gauthier committed
118
cat $OPENAIRCN_DIR/$OBJ_DIR/Makefile | grep CFLAGS\ \=\  | grep DENABLE_USE_RAW_FOR_SGI
Cedric Roux's avatar
 
Cedric Roux committed
119 120 121 122 123 124 125
if [ $? -ne 0 ]
then
    export ENABLE_USE_RAW_FOR_SGI=0
else
    export ENABLE_USE_RAW_FOR_SGI=1
fi

Lionel Gauthier's avatar
Lionel Gauthier committed
126
pkill oai_epc
Cedric Roux's avatar
 
Cedric Roux committed
127

Lionel Gauthier's avatar
Lionel Gauthier committed
128 129 130
#######################################################
# SOURCE $OPENAIRCN_DIR/UTILS/CONF/epc_$HOSTNAME.conf
#######################################################
Cedric Roux's avatar
 
Cedric Roux committed
131
rm -f /tmp/source.txt
Lionel Gauthier's avatar
Lionel Gauthier committed
132 133 134 135 136 137 138 139
if [ -f $OPENAIRCN_DIR/UTILS/CONF/epc_$HOSTNAME.conf ]
then
    cat $OPENAIRCN_DIR/UTILS/CONF/epc_$HOSTNAME.conf | tr -d " " > /tmp/source.txt
    source /tmp/source.txt
else
    echo_error "Missing config file $OPENAIRCN_DIR/UTILS/CONF/epc_$HOSTNAME.conf (Please write your own config file), exiting"
    exit 1
fi
Cedric Roux's avatar
 
Cedric Roux committed
140

Lionel Gauthier's avatar
Lionel Gauthier committed
141
#######################################################
142
# SOURCE $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf
Lionel Gauthier's avatar
Lionel Gauthier committed
143
#######################################################
Cedric Roux's avatar
 
Cedric Roux committed
144
rm -f /tmp/source.txt
Lionel Gauthier's avatar
Lionel Gauthier committed
145 146 147 148 149 150 151 152 153
if [ -f $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf ]
then
    cat $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf | tr -d " " > /tmp/source.txt
    source /tmp/source.txt
else
    echo_error "Missing config file $OPENAIRCN_DIR/UTILS/CONF/enb_$HOSTNAME.conf (Please write your own config file), exiting"
    exit 1
fi

Cedric Roux's avatar
 
Cedric Roux committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194

ping -c 1 hss.eur || { echo "hss.eur does not respond to ping" >&2 ; exit ; }
ping -c 1 router.eur || { echo "router.eur does not respond to ping" >&2 ; exit ; }
IP_ROUTER=`python -c 'import socket; print socket.gethostbyname("router.eur")'`
export MAC_ROUTER=`ip neigh show | grep $IP_ROUTER | cut -d ' '  -f5 | tr -d ':'`

echo_success "ROUTER MAC ADDRESS= $MAC_ROUTER"
bash_exec "modprobe tun"
bash_exec "modprobe ip_tables"
bash_exec "modprobe iptable_nat"
bash_exec "modprobe x_tables"

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 raw    -F"
bash_exec "$IPTABLES -t nat    -F"
bash_exec "$IPTABLES -t mangle -F"
bash_exec "$IPTABLES -t filter -F"

bash_exec "ip route flush cache"

echo "   Disabling forwarding"
bash_exec "sysctl -w net.ipv4.ip_forward=0"
assert "  `sysctl -n net.ipv4.ip_forward` -eq 0" $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 "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

195 196
#echo_warning "LG FORCED EXIT"
#exit
Cedric Roux's avatar
 
Cedric Roux committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364

start_openswitch_daemon
# REMINDER:
#        +-----------+          +------+              +-----------+
#        |  eNB      +------+   |  ovs | VLAN 1+------+    MME    |
#        |           |cpenb0+------------------+cpmme0|           |
#        |           +------+   |bridge|       +------+           |
#        |           |upenb0+-------+  |              |           |
#        +-----------+------+   |   |  |              +-----------+
#                               +---|--+                    |
#                                   |                 +-----------+
#                                   |                 |  S+P-GW   |
#                                   |  VLAN2   +------+           +-------+   +----+    +----+
#                                   +----------+upsgw0|           |pgwsgi0+---+br2 +----+eth0|
#                                              +------+           +-------+   +----+    +----+
#                                                     |           |
#                                                     +-----------+
#
##################################################
# del bridge between eNB and MME/SPGW
##################################################
bash_exec "tunctl -d $ENB_INTERFACE_NAME_FOR_S1_MME"
bash_exec "tunctl -d $ENB_INTERFACE_NAME_FOR_S1U"
bash_exec "tunctl -d $MME_INTERFACE_NAME_FOR_S1_MME"
bash_exec "tunctl -d $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP"
bash_exec "ovs-vsctl del-br       $BRIDGE"

##################################################
# build bridge between eNB and MME/SPGW
##################################################
bash_exec "tunctl -t $ENB_INTERFACE_NAME_FOR_S1_MME"
bash_exec "tunctl -t $ENB_INTERFACE_NAME_FOR_S1U"
bash_exec "tunctl -t $MME_INTERFACE_NAME_FOR_S1_MME"
bash_exec "tunctl -t $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP"

bash_exec "ovs-vsctl add-br       $BRIDGE"
bash_exec "ovs-vsctl add-port     $BRIDGE $ENB_INTERFACE_NAME_FOR_S1_MME        tag=1"
bash_exec "ovs-vsctl add-port     $BRIDGE $MME_INTERFACE_NAME_FOR_S1_MME        tag=1"
bash_exec "ovs-vsctl add-port     $BRIDGE $ENB_INTERFACE_NAME_FOR_S1U           tag=2"
bash_exec "ovs-vsctl add-port     $BRIDGE $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP tag=2"

bash_exec "ifconfig $MME_INTERFACE_NAME_FOR_S1_MME promisc up"
bash_exec "ifconfig $MME_INTERFACE_NAME_FOR_S1_MME $MME_IP_ADDRESS_FOR_S1_MME netmask `cidr2mask $MME_IP_NETMASK_FOR_S1_MME` promisc up"
bash_exec "ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP promisc up"
bash_exec "ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP $SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP netmask `cidr2mask $SGW_IP_NETMASK_FOR_S1U_S12_S4_UP` promisc up"

bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME promisc up"
bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME $ENB_IP_ADDRESS_FOR_S1_MME netmask `cidr2mask $ENB_IP_NETMASK_FOR_S1_MME` promisc up"
bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1U promisc up"
bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1U $ENB_IP_ADDRESS_FOR_S1U netmask `cidr2mask $ENB_IP_NETMASK_FOR_S1U` promisc up"

##################################################
# del bridge between SPGW and Internet
##################################################
#bash_exec "tunctl -d $PGW_INTERFACE_NAME_FOR_SGI"
#bash_exec "ovs-vsctl del-br       $SGI_BRIDGE"

##################################################
# build bridge between SPGW and Internet
##################################################

# # get ipv4 address from PGW_INTERFACE_NAME_FOR_SGI
# IP_ADDR=`ifconfig $PGW_INTERFACE_NAME_FOR_SGI | awk '/inet addr/ {split ($2,A,":"); print A[2]}' | tr '\n' ' ' | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'`
# if [ $IP_ADDR ]; then
#   bash_exec "ip -4 addr del $IP_ADDR dev $PGW_INTERFACE_NAME_FOR_SGI"
# fi
#
# # remove all ipv6 address from PGW_INTERFACE_NAME_FOR_SGI
# IP_ADDR="not empty"
# until [ "$IP_ADDR"x == "x" ]; do
#   IP_ADDR=`ifconfig $PGW_INTERFACE_NAME_FOR_SGI | grep 'inet6' | head -1 | tr '\n' ' ' | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}' | cut -d ' ' -f3`
#   if [ $IP_ADDR ]; then
#     bash_exec "ip -6 addr del $IP_ADDR dev $PGW_INTERFACE_NAME_FOR_SGI"
#   fi
# done

if [ $ENABLE_USE_NETFILTER_FOR_SGI -eq 1 ]; then

    bash_exec "modprobe nf_conntrack"
    bash_exec "modprobe nf_conntrack_ftp"

    ######################################################
    # PREROUTING
    ######################################################
    # We restore the mark following the CONNMARK mark. In fact, it does a simple MARK=CONNMARK
    # where MARK is the standard mark (usable by tc)
    # In French: Cette option de cible restaure le paquet marqué dans la marque de connexion
    # comme défini par CONNMARK. Un masque peut aussi être défini par l'option --mask.
    # Si une option mask est placée, seules les options masquées seront placées.
    # Notez que cette option de cible n'est valide que dans la table mangle.
    bash_exec "$IPTABLES -t mangle -A PREROUTING -j CONNMARK --restore-mark"

    # TEST bash_exec "$IPTABLES -t mangle -A PREROUTING -m mark --mark 0 -i $PGW_INTERFACE_NAME_FOR_SGI -j MARK --set-mark 15"
    # We set the mark of the initial packet as value of the conntrack mark for all the packets of the connection.
    # This mark will be restore for the other packets by the first rule of POSTROUTING --restore-mark).
    bash_exec "$IPTABLES -t mangle -A PREROUTING -j CONNMARK --save-mark"


    ######################################################
    # POSTROUTING
    ######################################################

    # MARK=CONNMARK
    bash_exec "iptables -A POSTROUTING -t mangle -o tap0 -j CONNMARK --restore-mark"
    # If we’ve got a mark no need to get further[
    bash_exec "iptables -A POSTROUTING -t mangle -o tap0 -m mark ! --mark 0 -j ACCEPT"

    #bash_exec "iptables -A POSTROUTING -p tcp --dport 21 -t mangle -j MARK --set-mark 1"
    #bash_exec "iptables -A POSTROUTING -p tcp --dport 80 -t mangle -j MARK --set-mark 2"

    # We set the mark of the initial packet as value of the conntrack mark for all the packets
    # of the connection. This mark will be restore for the other packets by the first rule
    # of POSTROUTING (–restore-mark).
    bash_exec "iptables -A POSTROUTING -t mangle -j CONNMARK --save-mark"

    bash_exec "iptables -A PREROUTING  -t mangle -j CONNMARK --restore-mark"

    # We restore the mark following the CONNMARK mark.
    # In fact, it does a simple MARK=CONNMARK where MARK is the standard mark (usable by tc)
    #bash_exec "$IPTABLES -A OUTPUT -t mangle -m mark ! --mark 0 -j CONNMARK --restore-mark"

    # If we’ve got a mark no need to get further[1]
    #TEST bash_exec "$IPTABLES -A OUTPUT -t mangle -p icmp -j MARK --set-mark 14"
    #bash_exec "$IPTABLES -A OUTPUT -t mangle -m mark ! --mark 0 -j ACCEPT"


    # We set the mark of the initial packet as value of the conntrack mark for all the packets of the connection.
    # This mark will be restore for the other packets by the first rule of OUTPUT (–restore-mark).
    #bash_exec "$IPTABLES -A OUTPUT -t mangle -j CONNMARK --save-mark"




    ######################################################
    # NETFILTER QUEUE
    ######################################################
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 5 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 6 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 7 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 8 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 9 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 10 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 11 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 12 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 13 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 14 -j NFQUEUE --queue-num 1"
    bash_exec "$IPTABLES -t mangle -A PREROUTING -i $PGW_INTERFACE_NAME_FOR_SGI -m connmark  --mark 15 -j NFQUEUE --queue-num 1"

    #echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables #To disable Iptables in the bridge.
    #Raw table: Some years ago appeared a new tables in Iptables.
    #This table can be used to avoid packets (connection really) to enter the NAT table:
    # iptables -t raw -I PREROUTING -i BRIDGE -s x.x.x.x -j NOTRACK.




    #bash_exec "$IPTABLES -t nat -A POSTROUTING -o $PGW_INTERFACE_NAME_FOR_SGI -j SNAT --to-source $PGW_IP_ADDR_FOR_SGI"
else
    # # get ipv4 address from PGW_INTERFACE_NAME_FOR_SGI
    #IP_ADDR=`ifconfig $PGW_INTERFACE_NAME_FOR_SGI | awk '/inet addr/ {split ($2,A,":"); print A[2]}' | tr '\n' ' ' | sed -n '1h;1!H;${;g;s/^[ \t]*//g;s/[ \t]*$//g;p;}'`

    #NETWORK=`echo $IP_ADDR | cut -d . -f 1,2,3`

    bash_exec "modprobe 8021q"

    for i in 5 6 7 8 9 10 11 12 13 14 15
    do
        # create vlan interface
365
        bash_exec "vconfig rem $PGW_INTERFACE_NAME_FOR_SGI.$i" > /dev/null 2>&1
Cedric Roux's avatar
 
Cedric Roux committed
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
        sync
        bash_exec "vconfig add $PGW_INTERFACE_NAME_FOR_SGI $i"
        sync
        # configure vlan interface
        #CIDR=$NETWORK'.'$i'/24'
        base=200
        NET=$(( $i + $base ))
        CIDR='10.0.'$NET'.2/8'
        bash_exec "ip -4 addr add  $CIDR dev $PGW_INTERFACE_NAME_FOR_SGI.$i"
    done
fi


bash_exec "ip link set $PGW_INTERFACE_NAME_FOR_SGI promisc on"
##################################################..

# LAUNCH MME + S+P-GW executable
##################################################
Lionel Gauthier's avatar
Lionel Gauthier committed
384 385 386 387 388 389 390 391 392 393 394 395 396
MME_CONFIG_FILE=$OPENAIRCN_DIR/UTILS/CONF/mme_default.conf
if [ -f $OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf ]; then
    MME_CONFIG_FILE=$OPENAIRCN_DIR/UTILS/CONF/mme_$HOSTNAME.conf
    echo_warning "MME config file found is now $MME_CONFIG_FILE"
else
    echo_warning "MME config file for host $HOSTNAME not found, trying default: $MME_CONFIG_FILE"
    if [ -f $MME_CONFIG_FILE ]; then
        echo_success "Default MME config file found: $MME_CONFIG_FILE"
    else
        echo_error "Default MME config file not found, exiting"
        exit 1
    fi
fi
397
cd $OPENAIRCN_DIR/$OBJ_DIR
398
$OPENAIRCN_DIR/$OBJ_DIR/OAI_EPC/oai_epc -c $MME_CONFIG_FILE
Cedric Roux's avatar
 
Cedric Roux committed
399
wait_process_started "oai_epc"