-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·159 lines (151 loc) · 5.84 KB
/
run.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
_config_path=""
_oai_root=/root/OAI-5G
_oai_config_root=/root/OAI-5G-Docker
_oai_attack_root=/root/OAI-5G
_log_path=/logs/logs
_pcap_path=/logs/pcaps
_prefix=""
_pcap_args=""
_pcap_enabled=true
_find_route=false
_rfsim=false
_colosseum=false
_cmd=""
_usrp_args="type=x300"
_colosseum_prefix="numactl --cpunodebind=netdev:usrp0 --membind=netdev:usrp0"
mkdir -p $_log_path
mkdir -p $_pcap_path
for arg in "$@"; do
if [ "$arg" = "rfsim" ]; then
_rfsim=true
elif [ "$arg" = "colosseum" ]; then
_colosseum=true
fi
done
while [ -n "$1" ]; do
_arg="$1"; shift
case "$_arg" in
rfsim)
;;
colosseum)
;;
enb)
_find_route=true
_prefix="ENB"
_config_path="$_oai_config_root/lte-usrp/enb.conf"
_common_args="-O $_config_path --usrp-tx-thread-config 1"
_exec_path="./lte-softmodem"
;;
lteue)
_find_route=false
_prefix="LTEUE"
_usrp_args="type=x300"
_config_path="$_oai_config_root/lte-usrp/lteue.usim-ci.conf"
_common_args="-O $_config_path -C 2680000000 -r 25 --ue-scan-carrier --nokrnmod 1 --noS1 --ue-rxgain 120 --ue-txgain 30 --ue-max-power 0 --ue-nb-ant-tx 1 --ue-nb-ant-rx 1 --usrp-args \"$_usrp_args\" -d"
_exec_path="./lte-uesoftmodem"
;;
gnb)
_find_route=true
if $_rfsim; then
_prefix="GNB-RFSIM"
_config_path="$_oai_config_root/nr-rfsim/gnb.conf"
_common_args="-O $_config_path --sa -E --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 -E --continuous-tx 1 --rfsim"
else
_prefix="GNB"
_config_path="$_oai_config_root/nr-usrp/gnb.conf"
_common_args="-O $_config_path --sa -E --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 -E --continuous-tx 1"
fi
_exec_path="./nr-softmodem"
;;
gnb-cu)
_find_route=true
if $_rfsim; then
_prefix="GNB-CU-RFSIM"
_config_path="$_oai_config_root/nr-rfsim/gnb-cu.conf"
_common_args="-O $_config_path --sa -E --rfsim"
else
_prefix="GNB-CU"
_config_path="$_oai_config_root/nr-usrp/gnb-cu.conf"
_common_args="-O $_config_path --sa -E --gNBs.[0].min_rxtxtime 6"
fi
_exec_path="./nr-softmodem"
;;
gnb-du)
_find_route=true
if $_rfsim; then
_prefix="GNB-DU-RFSIM"
_config_path="$_oai_config_root/nr-rfsim/gnb-du.conf"
_common_args="-O $_config_path --sa -E --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 -E --continuous-tx 1 --rfsim"
else
_prefix="GNB-DU"
_config_path="$_oai_config_root/nr-usrp/gnb-du.conf"
_common_args="-O $_config_path --sa -E --gNBs.[0].min_rxtxtime 6 --usrp-tx-thread-config 1 -E --continuous-tx 1"
fi
_exec_path="./nr-softmodem"
;;
nrue*)
_find_route=false
if $_rfsim; then
_prefix="NR-UE-RFSIM"
_config_path="$_oai_config_root/nr-rfsim/nr-ues/$_arg.uicc.conf"
_common_args="-E --sa --rfsim -r 106 --numerology 1 -C 3619200000 -O $_config_path"
_exec_path="./nr-uesoftmodem"
else
_prefix="NR-UE"
_config_path="$_oai_config_root/nr-usrp/nr-ues/$_arg.uicc.conf"
_common_args="-O $_config_path --dlsch-parallel 8 --sa --usrp-args \"$_usrp_args\" -E --numerology 1 -r 106 --band 78 -C 3619200000 --nokrnmod 1 --ue-txgain 0 -A 2539 --ue-fo-compensation 1"
_exec_path="./nr-uesoftmodem"
fi
;;
nr-attack)
_find_route=false
_attack_args=$@
_oai_root=$_oai_attack_root
if $_rfsim; then
_prefix="NR-UE-ATTACK-RFSIM"
_config_path="$_oai_config_root/nr-rfsim/nr-ues/nrue.attack.uicc.conf"
_common_args="-E --sa --rfsim -r 106 --numerology 1 -C 3619200000 -O $_config_path $_attack_args"
_exec_path="./nr-uesoftmodem.attack"
else
_prefix="NR-UE_ATTACK"
_config_path="$_oai_config_root/nr-usrp/nr-ues/nrue.attack.uicc.conf"
_common_args="$_attack_args -O $_config_path --dlsch-parallel 8 --sa --usrp-args \"$_usrp_args\" -E --numerology 1 -r 106 --band 78 -C 3619200000 --nokrnmod 1 --ue-txgain 0 -A 2539 --ue-fo-compensation 1 $_attack_args"
_exec_path="$_colosseum_prefix ./nr-uesoftmodem.attack"
fi
break
;;
flexric)
_exec_path="$_oai_root/openair2/E2AP/flexric/build/examples/ric/nearRT-RIC"
$_exec_path
exit 0
;;
flexric-kpm-xapp)
_exec_path="$_oai_root/openair2/E2AP/flexric/build/examples/xApp/c/monitor/xapp_kpm_moni"
$_exec_path
exit 0
;;
*)
echo "ERROR: unrecognized option: \"$_arg\"."
exit 1
;;
esac
done
## Find route to core
if $_colosseum && $_find_route; then
#cd /root/
# Add route towards core network
python3 $_oai_config_root/set_route_to_cn.py -i col0
# Set IP address of col0 interface as IP to bind to in gNB config file
$_oai_config_root/set_ip_in_conf.sh $_config_path
fi
## Check if pcap is enabled
if $_pcap_enabled; then
_pcap_args="--opt.type pcap --opt.path $_pcap_path/${_prefix}-$(date +"%m%d%H%M").pcap"
fi
## RUN
cd $_oai_root
source oaienv
cd cmake_targets/ran_build/build/
echo "$_exec_path $_common_args"
$_exec_path $_common_args $_pcap_args 2>&1 | tee $_log_path/${_prefix}-$(date +"%m%d%H%M").log