-
Notifications
You must be signed in to change notification settings - Fork 1
/
ng-scope.sh
executable file
·90 lines (84 loc) · 2.53 KB
/
ng-scope.sh
1
2
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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
Help() {
echo "Usage: $0 [Options...]" >&2
echo " -i, --image <Image name> Name of the Docker image (e.g. j0lama/ng-scope:latest)"
echo " -x, --exp <Experiment name> Name of the experiment"
echo " -o, --out <Output folder> Output folder (will create if it does not exist)"
echo " -f, --frag <Seconds> Enable log fragmentation with <seconds> per log file"
echo " -e, --earfcn \"<EARFCN List>\" List of EARFCN (Use quotes)"
echo " -t, --timeout <Seconds> Stop NG-Scope after <seconds> of runtime"
echo " -h, --help Show help menu"
echo "Examples:"
echo " $0 --image j0lama/ng-scope:latest --earfcn \"700\""
echo " $0 --image j0lama/ng-scope:latest --earfcn \"700 300\""
echo " $0 --image j0lama/ng-scope:latest --frag 200 --earfcn \"700 300\""
echo " $0 --image j0lama/ng-scope:latest --frag 200 --earfcn \"700 300\" --out enb_logs"
echo " $0 --image j0lama/ng-scope:latest --frag 200 --earfcn \"700 300\" --out enb_logs --timeout 60"
exit 1
}
FRAG=0
TIMEOUT=0
IMAGE=princetonpaws/ng-scope:22.04
OUTPUT=.
while [[ $# -gt 0 ]]; do
case $1 in
-i|--image)
IMAGE="$2"
shift # past argument
shift # past value
;;
-x|--experiment)
EXPERIMENT_NAME="$2"
shift # past argument
shift # past value
;;
-f|--frag)
FRAG=$2
shift # past argument
shift # past value
;;
-e|--earfcn)
EARFCN=$2
shift # past argument
shift # past value
;;
-o|--out)
OUTPUT=$2
shift # past argument
shift # past value
;;
-t|--timeout)
TIMEOUT=$2
shift
shift
;;
-h|--help)
Help
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
# Checking arguments
if [[ -z "$IMAGE" ]]; then
echo "Error: Image name argument missing"
echo "Execute '$0 --help' for more help"
exit 1
fi
if [[ -z "$EXPERIMENT_NAME" ]]; then
echo "Error: Experiment name argument missing"
echo "Execute '$0 --help' for more help"
exit 1
fi
if [[ -z "$EARFCN" ]]; then
echo "Error: List of EARFCN missing"
echo "Execute '$0 --help' for more help"
exit 1
fi
LOGS=$(realpath $OUTPUT)
docker run -e HOST_HOSTNAME=`hostname` --name ng-scope -ti --privileged --rm -v $LOGS:/ng-scope/build/ngscope/src/logs/ -v /dev:/dev -v /proc:/proc $IMAGE ./start.sh $FRAG $TIMEOUT $EXPERIMENT_NAME $(echo "$EARFCN" | tr -d '"')
#if [[ ! -z "$OUTPUT" ]]; then
# mv logs/ $OUTPUT
#fi