run.sh 2.26 KB
Newer Older
Rohan's avatar
Rohan committed
1
#!/bin/bash
Rohan's avatar
Rohan committed
2

Rohan's avatar
Rohan committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements.  See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1  (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# *      http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# *      contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
#   \author  Rohan KHARADE
#   \date 2021
#   \email: rohan.kharade@openairinterface.org
#*/
#"""

Rohan's avatar
Rohan committed
32
33
34
35
36
37
if [ $(id -u) -ne 0 ]; then
    exec sudo -E "$0" "$@"
fi

base=$(dirname $0)

Rohan's avatar
Rohan committed
38
39
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
Rohan's avatar
Rohan committed
40
41
42
43
44
45
46

USAGE="Usage: run.sh [-r] [ debug ]
       debug:	executes vpp under gdb"

while getopts ":r" opt; do
    case $opt in
	r)
Rohan's avatar
Rohan committed
47
48
	    APP="$base/bin/vpp"
	    ARGS="-c $base/etc/startup.conf"
Rohan's avatar
Rohan committed
49
50
51
52
53
54
55
56
	    ;;
	\?)
	    echo "Invalid option: -$OPTARG\n" >&2
	    echo "$USAGE" >&2
	    exit 1
	    ;;
    esac
done
Rohan's avatar
Rohan committed
57

Rohan's avatar
Rohan committed
58
59
60
shift $((OPTIND-1))

if test -z "$1"; then
Rohan's avatar
Rohan committed
61
    $APP $ARGS &
Rohan's avatar
Rohan committed
62
63
64
65
66
67
68
69
elif test "$1" = "debug"; then
    shift
    gdb -ex 'set print pretty on' -ex 'run' --args $APP $ARGS $@
else
    echo "$USAGE" >&2
    exit 1
fi

70
71
72
73
74
75
76
77
78
79
80
81
while : 
do
   echo "waiting for vpp-upf service"
   RES=$(bin/vppctl sh upf specification release | awk {'print $3'})
   echo $RES
   if [[ $RES =~ 16 ]]; then
       echo "vpp-upf service is running now"
       break
   fi
   sleep 3
done

Rohan's avatar
Rohan committed
82
83
84
85
86
if [[ ${REGISTER_NRF} == "yes" ]];then
    NRF_APP="$base/bin/nrf_client.py"
    NRF_ARGS=" --nrf_ip="$NRF_IP_ADDR" --nrf_port="$NRF_PORT" --http_version="$HTTP_VERSION
    python $NRF_APP $NRF_ARGS
fi
Rohan's avatar
Rohan committed
87
sleep infinity
Rohan's avatar
Rohan committed
88