#!/bin/sh
echo "Bringup UE interface"
sudo rmmod nasmesh
make all
sudo insmod  $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko 

#avoid conflict with reserved multicast addresses (224.0.0.11,224.0.0.13, 224.0.0.16)
#sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
sudo ip route add 239.0.0.160/28 dev eth0


sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255

$OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1

#xterm -T UE1 -hold -e ping 10.0.1.1& 

if   [ -z $1 ]; then 
echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l3 > /dev/null"
nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l3 > /dev/null
else
    if [ $1 = "all" ]; then 
        echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l7" 
        nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l7
    else
        echo "nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l7 | grep -i $1" 
        nice -10 $OPENAIR_TARGETS/SIMU/USER/oaisim  -b0 -M1 -p3  -g3 -l7 | grep -i $1
    fi
fi

echo "End"
