2 #******************************************************************************
4 # Copyright (c) 2020 Intel.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 #******************************************************************************/
20 """This script runs test cases with O-DU and O-RU
31 from itertools import dropwhile
32 from datetime import datetime
33 from time import gmtime, strftime
35 from threading import Timer
38 timeout_sec = 60*5 #5 min max
40 nLteNumRbsPerSymF1 = [
41 # 5MHz 10MHz 15MHz 20 MHz
42 [25, 50, 75, 100] # LTE Numerology 0 (15KHz)
46 # 5MHz 10MHz 15MHz 20 MHz 25 MHz 30 MHz 40 MHz 50MHz 60 MHz 70 MHz 80 MHz 90 MHz 100 MHz
47 [25, 52, 79, 106, 133, 160, 216, 270, 0, 0, 0, 0, 0], # Numerology 0 (15KHz)
48 [11, 24, 38, 51, 65, 78, 106, 133, 162, 0, 217, 245, 273], # Numerology 1 (30KHz)
49 [0, 11, 18, 24, 31, 38, 51, 65, 79, 0, 107, 121, 135] # Numerology 2 (60KHz)
53 # 50Mhz 100MHz 200MHz 400MHz
54 [66, 132, 264, 0], # Numerology 2 (60KHz)
55 [32, 66, 132, 264] # Numerology 3 (120KHz)
59 nRChBwOptions_keys = ['5','10','15','20', '25', '30', '40', '50', '60','70', '80', '90', '100', '200', '400']
60 nRChBwOptions_values = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
61 nRChBwOptions = dict(zip(nRChBwOptions_keys, nRChBwOptions_values))
63 nRChBwOptions_keys_mu2and3 = ['50', '100', '200', '400']
64 nRChBwOptions_values_mu2and3 = [0,1,2,3]
65 nRChBwOptions_mu2and3 = dict(zip(nRChBwOptions_keys_mu2and3, nRChBwOptions_values_mu2and3))
69 # values for Jenkins server
70 vf_addr_o_xu_jenkins = [
71 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c vf_addr_o_xu_d
72 ["0000:18:01.0,0000:18:01.1", "0000:18:09.0,0000:18:09.1", "0000:18:11.0,0000:18:11.1", "0000:18:19.0,0000:18:19.1" ], #O-DU
73 ["0000:af:01.0,0000:af:01.1", "0000:af:09.0,0000:af:09.1", "0000:af:11.0,0000:af:11.1", "0000:af:19.0,0000:af:19.1" ], #O-RU
76 vf_addr_o_xu_sc12 = [ # 2x2x25G with loopback FVL0:port0 to FVL1:port 0 FVL0:port1 to FVL1:port 1
77 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c
78 ["0000:88:02.0,0000:88:0a.0", "0000:88:02.1,0000:88:0a.1", "0000:88:02.2,0000:88:0a.2", "0000:88:02.3,0000:88:0a.3" ], #O-DU
79 ["0000:86:02.0,0000:86:0a.0", "0000:86:02.1,0000:86:0a.1", "0000:86:02.2,0000:86:0a.2", "0000:86:02.3,0000:86:0a.3" ], #O-RU
82 vf_addr_o_xu_sc12_cvl = [
83 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c
84 ["0000:af:01.0,0000:af:09.0", "0000:af:11.0,0000:af:19.0", "0000:1b:01.0,0000:1b:09.0", "0000:1b:11.0,0000:1b:19.0" ], #O-DU
85 ["0000:af:01.0,0000:af:09.0", "0000:af:11.0,0000:af:19.0", "0000:1a:01.0,0000:1a:09.0", "0000:1a:11.0,0000:1a:19.0" ], #O-RU
88 vf_addr_o_xu_scs1_30 = [
89 ["0000:65:01.0,0000:65:01.1,0000:65:01.2,0000:65:01.3", "0000:65:01.4,0000:65:01.5,0000:65:01.6,0000:65:01.7", "0000:65:02.0,0000:65:02.1,0000:65:02.2,0000:65:02.3", "0000:65:02.4,0000:65:02.5,0000:65:02.6,0000:65:02.7" ], #O-DU
90 ["0000:65:09.0,0000:65:09.1,0000:65:09.2,0000:65:09.3", "0000:65:09.4,0000:65:09.5,0000:65:09.6,0000:65:09.7", "0000:65:0a.0,0000:65:0a.1,0000:65:0a.2,0000:65:0a.3", "0000:65:0a.4,0000:65:0a.5,0000:65:0a.6,0000:65:0a.7" ], #O-RU
93 vf_addr_o_xu_scs1_repo = [
94 ["0000:18:01.0,0000:18:01.1,0000:18:01.2,0000:18:01.3", "0000:18:01.4,0000:18:01.5,0000:18:01.6,0000:18:01.7", "0000:18:02.0,0000:18:02.1,0000:18:02.2,0000:18:02.3", "0000:18:02.4,0000:18:02.5,0000:18:02.6,0000:18:02.7" ], #O-DU
95 ["0000:18:11.0,0000:18:11.1,0000:18:11.2,0000:18:11.3", "0000:18:11.4,0000:18:11.5,0000:18:11.6,0000:18:11.7", "0000:18:12.0,0000:18:12.1,0000:18:12.2,0000:18:12.3", "0000:18:12.4,0000:18:12.5,0000:18:12.6,0000:18:12.7" ], #O-RU
98 vf_addr_o_xu_icelake_scs1_1 = [
99 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c vf_addr_o_xu_d
100 ["0000:51:01.0,0000:51:09.0", "0000:51:11.0,0000:51:19.0", "0000:18:01.0,0000:18:09.0", "0000:18:01.1,0000:18:09.1" ], #O-DU
101 ["0000:17:01.0,0000:17:09.0", "0000:17:11.0,0000:17:19.0", "0000:65:01.0,0000:65:09.0", "0000:65:01.1,0000:65:09.1" ], #O-RU
104 vf_addr_o_xu_icx_npg_scs1_coyote4 = [
105 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c vf_addr_o_xu_d
106 ["0000:51:01.0,0000:51:09.0", "0000:51:11.0,0000:51:19.0", "0000:51:11.1,0000:51:19.1", "0000:51:01.1,0000:51:09.1" ], #O-DU
107 ["0000:17:01.0,0000:17:09.0", "0000:17:11.0,0000:17:19.0", "0000:17:11.1,0000:17:19.1", "0000:17:01.1,0000:17:09.1" ], #O-RU
110 vf_addr_o_xu_scs1_35 = [
111 ["0000:86:01.0,0000:86:01.1,0000:86:01.2,0000:86:01.3", "0000:86:01.4,0000:86:01.5,0000:86:01.6,0000:86:01.7", "0000:86:02.0,0000:86:02.1,0000:86:02.2,0000:86:02.3", "0000:86:02.4,0000:86:02.5,0000:86:02.6,0000:86:02.7" ], #O-DU
112 ["0000:86:11.0,0000:86:11.1,0000:86:11.2,0000:86:11.3", "0000:86:11.4,0000:86:11.5,0000:86:11.6,0000:86:11.7", "0000:86:12.0,0000:86:12.1,0000:86:12.2,0000:86:12.3", "0000:86:12.4,0000:86:12.5,0000:86:12.6,0000:86:12.7" ], #O-RU
115 vf_addr_o_xu_csl_npg_scs1_33 = [
116 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c
117 ["0000:1a:01.0,0000:1a:01.1", "0000:1a:01.2,0000:1a:01.3", "0000:1a:01.4,0000:1a:01.5", "0000:1a:01.6,0000:1a:01.7" ], #O-DU
118 ["0000:1a:11.0,0000:1a:11.1", "0000:1a:11.2,0000:1a:11.3", "0000:1a:11.4,0000:1a:11.5", "0000:1a:11.6,0000:1a:11.7" ], #O-RU
121 vf_addr_o_xu_skx_5gnr_sd6 = [
122 #vf_addr_o_xu_a vf_addr_o_xu_b vf_addr_o_xu_c vf_addr_o_xu_d
123 ["0000:af:01.0,0000:af:09.0", "0000:af:11.0,0000:af:19.0", "0000:af:11.1,0000:af:19.1", "0000:af:01.1,0000:af:09.1"], #O-DU
124 ["0000:18:01.0,0000:18:09.0", "0000:18:11.0,0000:18:19.0", "0000:18:11.1,0000:18:19.1", "0000:18:01.1,0000:18:09.1"], #O-RU
128 # table of all test cases
129 # (ran, cat, mu, bw, test case, "test case description")
131 NR_test_cases_A = [(0, 0, 0, 5, 0, "NR_Sub6_Cat_A_5MHz_1_Cell_0"),
132 (0, 0, 0, 10, 12, "NR_Sub6_Cat_A_10MHz_12_Cell_12"),
133 (0, 0, 0, 20, 12, "NR_Sub6_Cat_A_20MHz_12_Cell_12"),
134 (0, 0, 0, 20, 20, "NR_Sub6_Cat_A_20MHz_1_Cell_owd_req_resp"),
135 (0, 0, 1, 100, 0, "NR_Sub6_Cat_A_100MHz_1_Cell_0"),
136 (0, 0, 3, 100, 7, "NR_mmWave_Cat_A_100MHz_1_Cell_0_sc"),
139 NR_test_cases_A_ext = [(0, 0, 0, 5, 0, "NR_Sub6_Cat_A_5MHz_1_Cell_0"),
140 (0, 0, 0, 10, 0, "NR_Sub6_Cat_A_10MHz_1_Cell_0"),
141 (0, 0, 0, 10, 12, "NR_Sub6_Cat_A_10MHz_12_Cell_12"),
142 (0, 0, 0, 20, 0, "NR_Sub6_Cat_A_20MHz_1_Cell_0"),
143 (0, 0, 0, 20, 12, "NR_Sub6_Cat_A_20MHz_12_Cell_12"),
144 (0, 0, 0, 20, 20, "NR_Sub6_Cat_A_20MHz_1_Cell_owd_req_resp"),
145 (0, 0, 0, 20, 21, "NR_Sub6_Cat_A_20MHz_1_Cell_owd_rem_req"),
146 (0, 0, 0, 20, 22, "NR_Sub6_Cat_A_20MHz_1_Cell_owd_req_wfup"),
147 (0, 0, 0, 20, 23, "NR_Sub6_Cat_A_20MHz_1_Cell_owd_rem_req_wfup"),
148 (0, 0, 1, 100, 0, "NR_Sub6_Cat_A_100MHz_1_Cell_0"),
149 (0, 0, 3, 100, 0, "NR_mmWave_Cat_A_100MHz_1_Cell_0"),
150 (0, 0, 3, 100, 7, "NR_mmWave_Cat_A_100MHz_1_Cell_0_sc"),
153 j_test_cases_A = [(0, 0, 1, 100, 204,"NR_Sub6_Cat_A_100MHz_4_O_RU_2Ant"),
154 (0, 0, 1, 100, 404,"NR_Sub6_Cat_A_100MHz_4_O_RU_4Ant")
157 j_test_cases_A_ext = [(0, 0, 1, 100, 201,"NR_Sub6_Cat_A_100MHz_1_O_RU_2Ant"),
158 (0, 0, 1, 100, 202,"NR_Sub6_Cat_A_100MHz_2_O_RU_2Ant"),
159 (0, 0, 1, 100, 203,"NR_Sub6_Cat_A_100MHz_3_O_RU_2Ant"),
160 (0, 0, 1, 100, 204,"NR_Sub6_Cat_A_100MHz_4_O_RU_2Ant"),
161 (0, 0, 1, 100, 401,"NR_Sub6_Cat_A_100MHz_1_O_RU_4Ant"),
162 (0, 0, 1, 100, 402,"NR_Sub6_Cat_A_100MHz_2_O_RU_4Ant"),
163 (0, 0, 1, 100, 403,"NR_Sub6_Cat_A_100MHz_3_O_RU_4Ant"),
164 (0, 0, 1, 100, 404,"NR_Sub6_Cat_A_100MHz_4_O_RU_4Ant")
168 LTE_test_cases_A = [(1, 0, 0, 5, 0, "LTE_Cat_A_5Hz_1_Cell_0"),
169 (1, 0, 0, 10, 0, "LTE_Cat_A_10Hz_1_Cell_0"),
170 (1, 0, 0, 20, 0, "LTE_Cat_A_20Hz_1_Cell_0"),
173 DSS_test_cases_A = [(2, 0, 0, 20, 10, "DSS_Cat_A_20MHz_FDD_1_Cell"),
174 (2, 0, 0, 20, 11, "DSS_Cat_A_20MHz_TDD_1_Cell"),
175 (2, 0, 0, 20, 60, "DSS_Cat_A_20MHz_FDD_6_Cell"),
176 (2, 0, 0, 20, 61, "DSS_Cat_A_20MHz_TDD_6_Cell"),
177 (2, 0, 0, 10, 10, "DSS_Cat_A_10MHz_FDD_1_Cell"),
178 (2, 0, 0, 10, 11, "DSS_Cat_A_10MHz_TDD_1_Cell"),
179 (2, 0, 0, 10, 60, "DSS_Cat_A_10MHz_FDD_6_Cell"),
180 (2, 0, 0, 10, 61, "DSS_Cat_A_10MHz_TDD_6_Cell"),
181 (2, 0, 0, 5, 10, "DSS_Cat_A_5MHz_FDD_1_Cell"),
182 (2, 0, 0, 5, 11, "DSS_Cat_A_5MHz_TDD_1_Cell"),
183 (2, 0, 0, 5, 60, "DSS_Cat_A_5MHz_FDD_6_Cell"),
184 (2, 0, 0, 5, 61, "DSS_Cat_A_5MHz_TDD_6_Cell"),
188 NR_test_cases_B = [(0, 1, 1, 100, 0, "NR_Sub6_Cat_B_100MHz_1_Cell_0"),
189 (0, 1, 1, 100, 216, "NR_Sub6_Cat_B_100MHz_1_Cell_216"),
192 NR_test_cases_B_ext = [(0, 1, 1, 100, 0, "NR_Sub6_Cat_B_100MHz_1_Cell_0"),
193 (0, 1, 1, 100, 1, "NR_Sub6_Cat_B_100MHz_1_Cell_1"),
194 (0, 1, 1, 100, 2, "NR_Sub6_Cat_B_100MHz_1_Cell_1_ext1"),
195 (0, 1, 1, 100, 101, "NR_Sub6_Cat_B_100MHz_1_Cell_101"),
196 (0, 1, 1, 100, 102, "NR_Sub6_Cat_B_100MHz_1_Cell_102"),
197 (0, 1, 1, 100, 103, "NR_Sub6_Cat_B_100MHz_1_Cell_103"),
198 (0, 1, 1, 100, 104, "NR_Sub6_Cat_B_100MHz_1_Cell_104"),
199 (0, 1, 1, 100, 105, "NR_Sub6_Cat_B_100MHz_1_Cell_105"),
200 (0, 1, 1, 100, 106, "NR_Sub6_Cat_B_100MHz_1_Cell_106"),
201 (0, 1, 1, 100, 107, "NR_Sub6_Cat_B_100MHz_1_Cell_107"),
202 (0, 1, 1, 100, 108, "NR_Sub6_Cat_B_100MHz_1_Cell_108"),
203 (0, 1, 1, 100, 109, "NR_Sub6_Cat_B_100MHz_1_Cell_109"),
204 (0, 1, 1, 100, 201, "NR_Sub6_Cat_B_100MHz_1_Cell_201"),
205 (0, 1, 1, 100, 202, "NR_Sub6_Cat_B_100MHz_1_Cell_202"),
206 (0, 1, 1, 100, 203, "NR_Sub6_Cat_B_100MHz_1_Cell_203"),
207 (0, 1, 1, 100, 204, "NR_Sub6_Cat_B_100MHz_1_Cell_204"),
208 (0, 1, 1, 100, 205, "NR_Sub6_Cat_B_100MHz_1_Cell_205"),
209 (0, 1, 1, 100, 206, "NR_Sub6_Cat_B_100MHz_1_Cell_206"),
210 (0, 1, 1, 100, 211, "NR_Sub6_Cat_B_100MHz_1_Cell_211"),
211 (0, 1, 1, 100, 212, "NR_Sub6_Cat_B_100MHz_1_Cell_212"),
212 (0, 1, 1, 100, 213, "NR_Sub6_Cat_B_100MHz_1_Cell_213"),
213 (0, 1, 1, 100, 214, "NR_Sub6_Cat_B_100MHz_1_Cell_214"),
214 (0, 1, 1, 100, 215, "NR_Sub6_Cat_B_100MHz_1_Cell_215"),
215 (0, 1, 1, 100, 216, "NR_Sub6_Cat_B_100MHz_1_Cell_216"),
218 LTE_test_cases_B = [(1, 1, 0, 20, 0, "LTE_Cat_B_20MHz_1_Cell_0"),
221 LTE_test_cases_B_ext = [(1, 1, 0, 5, 0, "LTE_Cat_B_5MHz_1_Cell_0"),
222 (1, 1, 0, 10, 0, "LTE_Cat_B_10MHz_1_Cell_0"),
223 (1, 1, 0, 20, 0, "LTE_Cat_B_20MHz_1_Cell_0"),
224 (1, 1, 0, 5, 1, "LTE_Cat_B_5Hz_1_Cell_0_sc"),
225 (1, 1, 0, 10, 1, "LTE_Cat_B_10Hz_1_Cell_0_sc"),
226 (1, 1, 0, 20, 1, "LTE_Cat_B_20Hz_1_Cell_0_sc"),
232 # (0, 1, 1, 100, 301, "NR_Sub6_Cat_B_100MHz_1_Cell_301"),
233 (0, 1, 1, 100, 602, "NR_Sub6_Cat_B_100MHz_1_Cell_602_sc"),
236 V_test_cases_B_ext = [
237 (0, 1, 1, 100, 301, "NR_Sub6_Cat_B_100MHz_1_Cell_301"),
238 (0, 1, 1, 100, 302, "NR_Sub6_Cat_B_100MHz_1_Cell_302"),
239 (0, 1, 1, 100, 303, "NR_Sub6_Cat_B_100MHz_1_Cell_303"),
240 (0, 1, 1, 100, 304, "NR_Sub6_Cat_B_100MHz_1_Cell_304"),
241 (0, 1, 1, 100, 305, "NR_Sub6_Cat_B_100MHz_1_Cell_305"),
242 (0, 1, 1, 100, 306, "NR_Sub6_Cat_B_100MHz_1_Cell_306"),
243 (0, 1, 1, 100, 602, "NR_Sub6_Cat_B_100MHz_1_Cell_602_sc"),
247 V_test_cases_B_2xUL = [
248 # (0, 1, 1, 100, 311, "NR_Sub6_Cat_B_100MHz_1_Cell_311"),
249 (0, 1, 1, 100, 612, "NR_Sub6_Cat_B_100MHz_1_Cell_612_sc"),
253 V_test_cases_B_2xUL_ext = [
254 (0, 1, 1, 100, 311, "NR_Sub6_Cat_B_100MHz_1_Cell_311"),
255 (0, 1, 1, 100, 312, "NR_Sub6_Cat_B_100MHz_1_Cell_312"),
256 (0, 1, 1, 100, 313, "NR_Sub6_Cat_B_100MHz_1_Cell_313"),
257 (0, 1, 1, 100, 314, "NR_Sub6_Cat_B_100MHz_1_Cell_314"),
258 (0, 1, 1, 100, 315, "NR_Sub6_Cat_B_100MHz_1_Cell_315"),
259 (0, 1, 1, 100, 316, "NR_Sub6_Cat_B_100MHz_1_Cell_316"),
260 (0, 1, 1, 100, 612, "NR_Sub6_Cat_B_100MHz_1_Cell_612_sc"),
264 V_test_cases_B_mtu_1500 = [
265 (0, 1, 1, 100, 501, "NR_Sub6_Cat_B_100MHz_1_Cell_501"),
266 (0, 1, 1, 100, 502, "NR_Sub6_Cat_B_100MHz_1_Cell_502"),
267 (0, 1, 1, 100, 503, "NR_Sub6_Cat_B_100MHz_1_Cell_503"),
268 (0, 1, 1, 100, 504, "NR_Sub6_Cat_B_100MHz_1_Cell_504"),
269 (0, 1, 1, 100, 505, "NR_Sub6_Cat_B_100MHz_1_Cell_505"),
270 (0, 1, 1, 100, 506, "NR_Sub6_Cat_B_100MHz_1_Cell_506"),
271 (0, 1, 1, 100, 802, "NR_Sub6_Cat_B_100MHz_1_Cell_802_sc"),
274 V_test_cases_B_mtu_1500_2xUL = [
275 (0, 1, 1, 100, 511, "NR_Sub6_Cat_B_100MHz_1_Cell_511"),
276 (0, 1, 1, 100, 512, "NR_Sub6_Cat_B_100MHz_1_Cell_512"),
277 (0, 1, 1, 100, 513, "NR_Sub6_Cat_B_100MHz_1_Cell_513"),
278 (0, 1, 1, 100, 514, "NR_Sub6_Cat_B_100MHz_1_Cell_514"),
279 (0, 1, 1, 100, 515, "NR_Sub6_Cat_B_100MHz_1_Cell_515"),
280 (0, 1, 1, 100, 516, "NR_Sub6_Cat_B_100MHz_1_Cell_516"),
281 (0, 1, 1, 100, 812, "NR_Sub6_Cat_B_100MHz_1_Cell_812_sc"),
284 V_test_cases_B_3Cells = [
285 (0, 1, 1, 100, 3301, "NR_Sub6_Cat_B_100MHz_1_Cell_3301"),
286 (0, 1, 1, 100, 3311, "NR_Sub6_Cat_B_100MHz_1_Cell_3311")
289 V_test_cases_B_3Cells_mtu_1500 = [
290 (0, 1, 1, 100, 3501, "NR_Sub6_Cat_B_100MHz_1_Cell_3501"),
291 (0, 1, 1, 100, 3511, "NR_Sub6_Cat_B_100MHz_1_Cell_3511")
295 J_test_cases_B_4Cells = [
296 (0, 1, 1, 100, 1421, "NR_Sub6_Cat_B_100MHz_1_Cell_DL4UL2"),
297 (0, 1, 1, 100, 4424, "NR_Sub6_Cat_B_100MHz_4_Cell_DL4UL2")
300 J_test_cases_B_4Cells_ext = [
301 (0, 1, 1, 100, 1421, "NR_Sub6_Cat_B_100MHz_1_Cell_DL4UL2"),
302 (0, 1, 1, 100, 2422, "NR_Sub6_Cat_B_100MHz_2_Cell_DL4UL2"),
303 (0, 1, 1, 100, 3423, "NR_Sub6_Cat_B_100MHz_3_Cell_DL4UL2"),
304 (0, 1, 1, 100, 4424, "NR_Sub6_Cat_B_100MHz_4_Cell_DL4UL2")
307 Ext1_test_cases_B_4Cells = [
308 (0, 1, 1, 100, 142, "NR_Sub6_Cat_B_100MHz_ext1_1_Cell_DL4UL2"),
309 (0, 1, 1, 100, 242, "NR_Sub6_Cat_B_100MHz_ext1_2_Cell_DL4UL2"),
310 (0, 1, 1, 100, 342, "NR_Sub6_Cat_B_100MHz_ext1_3_Cell_DL4UL2"),
311 (0, 1, 1, 100, 442, "NR_Sub6_Cat_B_100MHz_ext1_4_Cell_DL4UL2")
316 #reduced duration test cycle
317 all_test_cases_short = NR_test_cases_A + LTE_test_cases_A + j_test_cases_A + LTE_test_cases_B + NR_test_cases_B + V_test_cases_B + V_test_cases_B_2xUL + J_test_cases_B_4Cells
319 all_test_cases_long = NR_test_cases_A_ext + LTE_test_cases_A + j_test_cases_A_ext + DSS_test_cases_A + LTE_test_cases_B_ext + NR_test_cases_B_ext + V_test_cases_B_ext + V_test_cases_B_2xUL_ext + J_test_cases_B_4Cells_ext + Ext1_test_cases_B_4Cells
321 dic_dir = dict({0:'DL', 1:'UL'})
322 dic_xu = dict({0:'o-du', 1:'o-ru'})
323 dic_ran_tech = dict({0:'5g_nr', 1:'lte', 2:'dss'})
325 def init_logger(console_level, logfile_level):
326 """Initializes console and logfile logger with given logging levels"""
328 logging.basicConfig(filename="runtests.log",
330 format="%(asctime)s: %(levelname)s: %(message)s",
333 logger = logging.getLogger()
334 handler = logging.StreamHandler()
335 handler.setLevel(console_level)
336 formatter = logging.Formatter("%(levelname)s: %(message)s")
337 handler.setFormatter(formatter)
338 logger.addHandler(handler)
340 def parse_args(args):
341 """Configures parser and parses command line configuration"""
342 # Parser configuration
343 parser = argparse.ArgumentParser(description="Run test cases: category numerology bandwidth test_num")
345 parser.add_argument("--rem_o_ru_host", type=str, default="", help="remote host to run O-RU", metavar="root@10.10.10.1", dest="rem_o_ru_host")
346 parser.add_argument("--ran", type=int, default=0, help="Radio Access Technology 0 (5G NR) , 1 (LTE) or 2 DSS (5G NR and LTE)", metavar="ran", dest="rantech")
347 parser.add_argument("--cat", type=int, default=0, help="Category: 0 (A) or 1 (B)", metavar="cat", dest="category")
348 parser.add_argument("--mu", type=int, default=0, help="numerology [0,1,3]", metavar="num", dest="numerology")
349 parser.add_argument("--bw", type=int, default=20, help="bandwidth [5,10,20,100]", metavar="bw", dest="bandwidth")
350 parser.add_argument("--testcase", type=int, default=0, help="test case number", metavar="testcase", dest="testcase")
351 parser.add_argument("--verbose", type=int, default=0, help="enable verbose output", metavar="verbose", dest="verbose")
355 options = parser.parse_args(args)
357 logging.info("Options: rem_o_ru_host=%s ran=%d category=%d num=%d bw=%d testcase=%d",
358 options.rem_o_ru_host, options.rantech, options.category, options.numerology, options.bandwidth, options.testcase)
362 """ function to check if a line
363 starts with some character.
366 # return true if a line starts with #
367 return s.startswith('#')
369 class GetOutOfLoops( Exception ):
372 def get_re_map(nRB, direction):
377 if 'nPrbElemDl' in globals():
379 for i in range(0, nPrbElm):
380 elm = str('PrbElemDl'+str(i))
383 PrbElemContent.insert(i,list(globals()[elm]))
384 xRBStart = PrbElemContent[i][0]
385 xRBSize = PrbElemContent[i][1]
386 #print(PrbElemContent,"RBStart: ", xRBStart, "RBSize: ",xRBSize, list(range(xRBStart, xRBStart + xRBSize)))
387 prb_map = prb_map + list(range(xRBStart*12, xRBStart*12 + xRBSize*12))
393 if 'nPrbElemUl' in globals():
395 for i in range(0, nPrbElm):
396 elm = str('PrbElemUl'+str(i))
398 if (elm in globals()):
399 PrbElemContent.insert(i,list(globals()[elm]))
400 xRBStart = PrbElemContent[i][0]
401 xRBSize = PrbElemContent[i][1]
402 #print(PrbElemContent,"RBStart: ", xRBStart, "RBSize: ",xRBSize, list(range(xRBStart, xRBStart + xRBSize)))
403 prb_map = prb_map + list(range(xRBStart*12, xRBStart*12 + xRBSize*12))
409 if 'nPrbElemSrs' in globals():
410 nPrbElm = nPrbElemSrs
411 for i in range(0, nPrbElm):
412 elm = str('PrbElemSrs'+str(i))
414 if (elm in globals()):
415 PrbElemContent.insert(i,list(globals()[elm]))
416 xRBStart = PrbElemContent[i][0]
417 xRBSize = PrbElemContent[i][1]
418 #print(PrbElemContent,"RBStart: ", xRBStart, "RBSize: ",xRBSize, list(range(xRBStart, xRBStart + xRBSize)))
419 prb_map = prb_map + list(range(xRBStart*12, xRBStart*12 + xRBSize*12))
424 prb_map = list(range(0, nRB*12))
428 def get_bfw_map(direction):
433 if 'nPrbElemDl' in globals():
436 for i in range(0, nPrbElm):
437 elm = str('ExtBfwDl'+str(i))
440 bfwElemContent.insert(i,list(globals()[elm]))
441 numBundPrb = bfwElemContent[i][0]
442 numsetBFW = bfwElemContent[i][1]
443 bfw_map = bfw_map + list(range(antElmTRx*numsetBFW_total, antElmTRx*numsetBFW_total + numsetBFW*antElmTRx))
444 numsetBFW_total += numsetBFW
448 bfw_map = list(range(0, (nPrbElm-1)*numsetBFW*antElmTRx))
450 return bfw_map, numsetBFW_total
452 def check_for_string_present_in_file(file_name, search_string):
454 with open(file_name, 'r') as read_obj:
455 for line in read_obj:
456 if search_string in line:
463 def check_owdm_test_results(xran_path, o_xu_id):
465 file_owd_oru = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-owd_results.txt"
466 file_owd_odu = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-owd_results.txt"
467 print("file_owd_oru :", file_owd_oru)
468 print("file_owd_odu :", file_owd_odu)
469 res = check_for_string_present_in_file(file_owd_oru, 'passed')
470 res = res or check_for_string_present_in_file(file_owd_odu, 'passed')
474 def compare_results(o_xu_id, rantech, cat, mu, bw, tcase, xran_path, test_cfg, direction):
479 nDlRB = nLteNumRbsPerSymF1[mu][nRChBwOptions.get(str(nDLBandwidth))]
480 nUlRB = nLteNumRbsPerSymF1[mu][nRChBwOptions.get(str(nULBandwidth))]
482 print("Incorrect arguments\n")
487 nDlRB = nLteNumRbsPerSymF1[mu][nRChBwOptions.get(str(nDLBandwidth))]
488 nUlRB = nLteNumRbsPerSymF1[mu][nRChBwOptions.get(str(nULBandwidth))]
490 print("Incorrect arguments\n")
495 nDlRB = nNumRbsPerSymF1[mu][nRChBwOptions.get(str(nDLBandwidth))]
496 nUlRB = nNumRbsPerSymF1[mu][nRChBwOptions.get(str(nULBandwidth))]
497 elif (mu >=2) & (mu <= 3):
498 nDlRB = nNumRbsPerSymF2[mu - 2][nRChBwOptions_mu2and3.get(str(nDLBandwidth))]
499 nUlRB = nNumRbsPerSymF2[mu - 2][nRChBwOptions_mu2and3.get(str(nULBandwidth))]
502 print("Incorrect arguments\n")
506 if 'compression' in globals():
511 if 'srsEnable' in globals():
516 if 'rachEnable' in globals():
521 if 'extType' in globals():
526 print("O-RU {} compare results: {} [compression {}]\n".format(o_xu_id, dic_dir.get(direction), comp))
529 # print("WARNING: Skip checking IQs and BF Weights for CAT B for now\n")
533 if nFrameDuplexType == 1:
535 for i in range(nTddPeriod):
537 SlotConfig.insert(i, sSlotConfig0)
539 SlotConfig.insert(i, sSlotConfig1)
541 SlotConfig.insert(i, sSlotConfig2)
543 SlotConfig.insert(i, sSlotConfig3)
545 SlotConfig.insert(i, sSlotConfig4)
547 SlotConfig.insert(i, sSlotConfig5)
549 SlotConfig.insert(i, sSlotConfig6)
551 SlotConfig.insert(i, sSlotConfig7)
553 SlotConfig.insert(i, sSlotConfig8)
555 SlotConfig.insert(i, sSlotConfig9)
557 raise Exception('i should not exceed nTddPeriod %d. The value of i was: {}'.format(nTddPeriod, i))
558 #print(SlotConfig, type(sSlotConfig0))
562 if (direction == 1) & (cat == 1): #UL
563 flowId = ccNum*antNumUL
565 flowId = ccNum*antNum
568 re_map = get_re_map(nDlRB, direction)
570 re_map = get_re_map(nUlRB, direction)
572 raise Exception('Direction is not supported %d'.format(direction))
574 for i in range(0, flowId):
575 #read ref and test files
581 file_tst = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-rx_log_ant"+str(i)+".txt"
582 file_ref = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-play_ant"+str(i)+".txt"
586 file_tst = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-rx_log_ant"+str(i)+".txt"
587 file_ref = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-play_ant"+str(i)+".txt"
589 raise Exception('Direction is not supported %d'.format(direction))
591 print("test result :", file_tst)
592 print("test reference:", file_ref)
593 if os.path.exists(file_tst):
595 file_tst = open(file_tst, 'r')
597 print ("Could not open/read file:", file_tst)
600 print(file_tst, "doesn't exist")
603 if os.path.exists(file_ref):
605 file_ref = open(file_ref, 'r')
607 print ("Could not open/read file:", file_ref)
610 print(file_tst, "doesn't exist")
614 tst = file_tst.readlines()
615 ref = file_ref.readlines()
625 #skip last slot for UL as we stop on PPS boundary (OTA) and all symbols might not be received by O-DU
626 for slot_idx in range(0, numSlots - (1*direction)):
627 for sym_idx in range(0, 14):
628 if nFrameDuplexType==1:
632 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
637 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
641 #print("Check:","[",i,"]", slot_idx, sym_idx)
642 for line_idx in re_map:
643 offset = (slot_idx*nRB*12*14) + sym_idx*nRB*12 + line_idx
645 line_tst = tst[offset].rstrip()
648 print("FAIL:","IndexError on tst: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(tst))
651 line_ref = ref[offset].rstrip()
654 print("FAIL:","IndexError on ref: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(ref))
658 # discard LSB bits as BFP compression is not "bit exact"
659 tst_i_value = int(line_tst.split(" ")[0]) & 0xFF80
660 tst_q_value = int(line_tst.split(" ")[1]) & 0xFF80
661 ref_i_value = int(line_ref.split(" ")[0]) & 0xFF80
662 ref_q_value = int(line_ref.split(" ")[1]) & 0xFF80
664 #print("check:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
665 if (tst_i_value != ref_i_value) or (tst_q_value != ref_q_value) :
666 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
671 #print("Check:", offset,"[",i,"]", slot_idx, sym_idx,":",line_tst, line_ref)
672 if line_ref != line_tst:
673 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst:", line_tst, "ref:", line_ref)
676 except GetOutOfLoops:
679 if (direction == 1) & (rach == 1) & 0: #UL
680 print("O-RU {} compare results: {} [compression {}]\n".format(o_xu_id, 'PRACH', comp))
685 re_map = range(0, 144)
687 elif nFrameDuplexType==0: #FR1 FDD
688 if prachConfigIndex < 87:
689 re_map = range(0, 840)
692 re_map = range(0, 144)
695 if prachConfigIndex < 67:
696 re_map = range(0, 144)
699 re_map = range(0, 840)
702 flowId = ccNum*antNumUL
704 flowId = ccNum*antNum
706 for i in range(0, flowId):
707 #read ref and test files
711 file_tst = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-prach_log_ant"+str(i)+".txt"
712 file_ref = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-play_prach_ant"+str(i)+".txt"
713 print("test result :", file_tst)
714 print("test reference:", file_ref)
715 if os.path.exists(file_tst):
717 file_tst = open(file_tst, 'r')
719 print ("Could not open/read file:", file_tst)
722 print(file_tst, "doesn't exist")
725 if os.path.exists(file_ref):
727 file_ref = open(file_ref, 'r')
729 print ("Could not open/read file:", file_ref)
732 print(file_tst, "doesn't exist")
736 tst = file_tst.readlines()
737 ref = file_ref.readlines()
747 #skip last slot for UL as we stop on PPS boundary (OTA) and all symbols might not be received by O-DU
748 for slot_idx in range(0, numSlots - (1*direction)):
749 for sym_idx in range(0, 14):
750 if nFrameDuplexType==1:
754 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
759 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
763 #print("Check:","[",i,"]", slot_idx, sym_idx)
764 for line_idx in re_map:
765 offset = (slot_idx*nRB*12*14) + sym_idx*nRB*12 + line_idx
767 line_tst = tst[offset].rstrip()
770 print("FAIL:","IndexError on tst: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(tst))
773 line_ref = ref[offset].rstrip()
776 print("FAIL:","IndexError on ref: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(ref))
780 # discard LSB bits as BFP compression is not "bit exact"
781 tst_i_value = int(line_tst.split(" ")[0]) & 0xFF80
782 tst_q_value = int(line_tst.split(" ")[1]) & 0xFF80
783 ref_i_value = int(line_ref.split(" ")[0]) & 0xFF80
784 ref_q_value = int(line_ref.split(" ")[1]) & 0xFF80
786 #print("check:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
787 if (tst_i_value != ref_i_value) or (tst_q_value != ref_q_value) :
788 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
793 #print("Check:", offset,"[",i,"]", slot_idx, sym_idx,":",line_tst, line_ref)
794 if line_ref != line_tst:
795 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst:", line_tst, "ref:", line_ref)
798 except GetOutOfLoops:
801 if ((cat == 1) and (direction == 0) and (ext_type == 1)): #Cat B, DL and Extension type = 1
803 if (direction == 0) & (cat == 1): #DL
804 flowId = ccNum*antNum
806 bfw_map, numsetBFW_total = get_bfw_map(direction)
808 raise Exception('Direction is not supported %d'.format(direction))
810 for i in range(0, flowId):
811 #read ref and test files
816 file_tst = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-dl_bfw_log_ue"+str(i)+".txt"
817 file_ref = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-dl_bfw_ue"+str(i)+".txt"
819 raise Exception('Direction is not supported %d'.format(direction))
821 print("test result :", file_tst)
822 print("test reference:", file_ref)
823 if os.path.exists(file_tst):
825 file_tst = open(file_tst, 'r')
827 print ("Could not open/read file:", file_tst)
830 print(file_tst, "doesn't exist")
833 if os.path.exists(file_ref):
835 file_ref = open(file_ref, 'r')
837 print ("Could not open/read file:", file_ref)
840 print(file_tst, "doesn't exist")
844 tst = file_tst.readlines()
845 ref = file_ref.readlines()
855 for slot_idx in range(0, numSlots):
857 if nFrameDuplexType==1:
861 for sym_idx in range(0,14):
862 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
868 for line_idx in bfw_map:
869 offset = slot_idx * (nDlRB*antElmTRx) #(slot_idx*numsetBFW_total*antElmTRx) + line_idx
871 line_tst = tst[offset].rstrip()
874 print("FAIL:","IndexError on tst: ant:[",i,"]:",offset, slot_idx, line_idx, len(tst))
877 line_ref = ref[offset].rstrip()
880 print("FAIL:","IndexError on ref: ant:[",i,"]:",offset, slot_idx, line_idx, len(ref))
884 # discard LSB bits as BFP compression is not "bit exact"
885 tst_i_value = int(line_tst.split(" ")[0]) & 0xFF80
886 tst_q_value = int(line_tst.split(" ")[1]) & 0xFF80
887 ref_i_value = int(line_ref.split(" ")[0]) & 0xFF80
888 ref_q_value = int(line_ref.split(" ")[1]) & 0xFF80
890 tst_i_act = int(line_tst.split(" ")[0])
891 tst_q_act = int(line_tst.split(" ")[1])
892 ref_i_act = int(line_ref.split(" ")[0])
893 ref_q_act = int(line_ref.split(" ")[1])
895 #print("check:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
896 if (tst_i_value != ref_i_value) or (tst_q_value != ref_q_value) :
897 print("868 Actual:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst: ", tst_i_act, " ", tst_q_act, " " , "ref: ", ref_i_act, " ", ref_q_act, " ")
898 print("FAIL:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
903 #print("Check:", offset,"[",i,"]", slot_idx, sym_idx,":",line_tst, line_ref)
904 if line_ref != line_tst:
905 print("876 Actual:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst: ", tst_i_act, " ", tst_q_act, " " , "ref: ", ref_i_act, " ", ref_q_act, " ")
906 print("FAIL:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst:", line_tst, "ref:", line_ref)
909 except GetOutOfLoops:
910 res = 0 # Not treating it as a test case fail criteria for now
914 if (direction == 0) & (cat == 1): #DL
915 flowId = ccNum*antNumUL
917 bfw_map, numsetBFW_total = get_bfw_map(direction)
919 raise Exception('Direction is not supported %d'.format(direction))
921 for i in range(0, flowId):
922 #read ref and test files
927 file_tst = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-ul_bfw_log_ue"+str(i)+".txt"
928 file_ref = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-ul_bfw_ue"+str(i)+".txt"
930 raise Exception('Direction is not supported %d'.format(direction))
932 print("test result :", file_tst)
933 print("test reference:", file_ref)
934 if os.path.exists(file_tst):
936 file_tst = open(file_tst, 'r')
938 print ("Could not open/read file:", file_tst)
941 print(file_tst, "doesn't exist")
944 if os.path.exists(file_ref):
946 file_ref = open(file_ref, 'r')
948 print ("Could not open/read file:", file_ref)
951 print(file_tst, "doesn't exist")
955 tst = file_tst.readlines()
956 ref = file_ref.readlines()
966 for slot_idx in range(0, numSlots):
968 if nFrameDuplexType==1:
972 for sym_idx in range(0,14):
973 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
979 for line_idx in bfw_map:
980 offset = slot_idx * (nUlRB*antElmTRx) #(slot_idx*numsetBFW_total*antElmTRx) + line_idx
982 line_tst = tst[offset].rstrip()
985 print("FAIL:","IndexError on tst: ant:[",i,"]:",offset, slot_idx, line_idx, len(tst))
988 line_ref = ref[offset].rstrip()
991 print("FAIL:","IndexError on ref: ant:[",i,"]:",offset, slot_idx, line_idx, len(ref))
995 # discard LSB bits as BFP compression is not "bit exact"
996 tst_i_value = int(line_tst.split(" ")[0]) & 0xFF80
997 tst_q_value = int(line_tst.split(" ")[1]) & 0xFF80
998 ref_i_value = int(line_ref.split(" ")[0]) & 0xFF80
999 ref_q_value = int(line_ref.split(" ")[1]) & 0xFF80
1001 #print("check:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
1002 if (tst_i_value != ref_i_value) or (tst_q_value != ref_q_value) :
1003 print("FAIL:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
1008 #print("Check:", offset,"[",i,"]", slot_idx, sym_idx,":",line_tst, line_ref)
1009 if line_ref != line_tst:
1010 print("FAIL:","bfw:[",i,"]:",offset, slot_idx, line_idx,":","tst:", line_tst, "ref:", line_ref)
1013 except GetOutOfLoops:
1014 res = 0 # Not treating it as a test case fail criteria for now
1017 if (direction == 0) | (cat == 0) | (srs_enb == 0): #DL or Cat A
1021 print("O-RU {} compare results: {} [compression {}]\n".format(o_xu_id, 'SRS', comp))
1025 if 'nPrbElemSrs' in globals():
1026 for i in range(0, nPrbElemSrs):
1027 elm = str('PrbElemSrs'+str(i))
1029 if (elm in globals()):
1030 PrbElemContent.insert(i,list(globals()[elm]))
1031 symbMask = 1 << PrbElemContent[i][2] # start symbol
1033 #print(PrbElemContent,"RBStart: ", xRBStart, "RBSize: ",xRBSize, list(range(xRBStart, xRBStart + xRBSize)))
1035 print("Cannot find SRS PRB map!")
1038 re_map = get_re_map(nUlRB, 2)
1040 flowId = ccNum*antElmTRx
1041 for i in range(0, flowId):
1042 #read ref and test files
1049 file_tst = xran_path+"/app/logs/"+"o-du"+str(o_xu_id)+"-srs_log_ant"+str(i)+".txt"
1050 file_ref = xran_path+"/app/logs/"+"o-ru"+str(o_xu_id)+"-play_srs_ant"+str(i)+".txt"
1052 raise Exception('Direction is not supported %d'.format(direction))
1054 print("test result :", file_tst)
1055 print("test reference:", file_ref)
1056 if os.path.exists(file_tst):
1058 file_tst = open(file_tst, 'r')
1060 print ("Could not open/read file:", file_tst)
1063 print(file_tst, "doesn't exist")
1066 if os.path.exists(file_ref):
1068 file_ref = open(file_ref, 'r')
1070 print ("Could not open/read file:", file_ref)
1073 print(file_tst, "doesn't exist")
1077 tst = file_tst.readlines()
1078 ref = file_ref.readlines()
1088 for slot_idx in range(0, numSlots - (1*direction)):
1089 for sym_idx in range(0, 14):
1090 if symbMask & (1 << sym_idx) and slot_idx%nTddPeriod == srsSlot:
1091 print("SRS check sym ", slot_idx, sym_idx)
1092 if nFrameDuplexType==1:
1096 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
1099 elif direction == 1:
1101 sym_dir = SlotConfig[slot_idx%nTddPeriod][sym_idx]
1102 # ignore if DL symbol for now
1106 print("Check:","[",i,"]", slot_idx, sym_idx)
1107 for line_idx in re_map:
1108 offset = (slot_idx*nRB*12*14) + sym_idx*nRB*12 + line_idx
1110 line_tst = tst[offset].rstrip()
1113 print("FAIL:","IndexError on tst: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(tst))
1116 line_ref = ref[offset].rstrip()
1119 print("FAIL:","IndexError on ref: ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx, len(ref))
1123 # discard LSB bits as BFP compression is not "bit exact"
1124 tst_i_value = int(line_tst.split(" ")[0]) & 0xFF80
1125 tst_q_value = int(line_tst.split(" ")[1]) & 0xFF80
1126 ref_i_value = int(line_ref.split(" ")[0]) & 0xFF80
1127 ref_q_value = int(line_ref.split(" ")[1]) & 0xFF80
1129 #print("check:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
1130 if (tst_i_value != ref_i_value) or (tst_q_value != ref_q_value) :
1131 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst: ", tst_i_value, " ", tst_q_value, " " , "ref: ", ref_i_value, " ", ref_q_value, " ")
1136 #print("Check:", offset,"[",i,"]", slot_idx, sym_idx,":",line_tst, line_ref)
1137 if line_ref != line_tst:
1138 print("FAIL:","ant:[",i,"]:",offset, slot_idx, sym_idx, line_idx,":","tst:", line_tst, "ref:", line_ref)
1141 except GetOutOfLoops:
1142 #don't threat SRS as error for now
1149 def parse_usecase_cfg(rantech, cat, mu, bw, tcase, xran_path, usecase_cfg):
1151 logging.info("parse config files %s\n", usecase_cfg[0])
1154 with open(usecase_cfg[0],'r') as fh:
1155 for curline in dropwhile(is_comment, fh):
1156 my_line = curline.rstrip().split(sep, 1)[0].strip()
1158 lineList.append(my_line)
1163 for line in lineList:
1164 exe_line = line.replace(":", ",0x")
1165 if exe_line.find("../") > 0 :
1166 exe_line = exe_line.replace('../', "'../")
1167 exe_line = exe_line+"'"
1168 elif exe_line.find("./") > 0 :
1169 exe_line = exe_line.replace('./', "'./")
1170 exe_line = exe_line+"'"
1172 code = compile(str(exe_line), '<string>', 'exec')
1173 exec (code, global_env, local_env)
1175 for k, v in local_env.items():
1179 print("Number of O-RU:", oXuNum)
1183 def parse_dat_file(rantech, cat, mu, bw, tcase, xran_path, test_cfg):
1185 logging.info("parse config files %s\n", test_cfg[0])
1189 with open(test_cfg[0],'r') as fh:
1190 for curline in dropwhile(is_comment, fh):
1191 my_line = curline.rstrip().split(sep, 1)[0].strip()
1193 lineList.append(my_line)
1197 for line in lineList:
1198 exe_line = line.replace(":", ",0x")
1199 if exe_line.find("../") > 0 :
1200 exe_line = exe_line.replace('../', "'../")
1201 exe_line = exe_line+"'"
1202 elif exe_line.find("./") > 0 :
1203 exe_line = exe_line.replace('./', "'./")
1204 exe_line = exe_line+"'"
1206 code = compile(str(exe_line), '<string>', 'exec')
1207 exec (code, global_env, local_env)
1209 for k, v in local_env.items():
1215 def del_dat_file_vars(local_env):
1217 for k, v in local_env.items():
1222 def make_copy_mlog(rantech, cat, mu, bw, tcase, xran_path):
1225 src_bin = xran_path+"/app/mlog-o-du.bin"
1226 src_csv = xran_path+"/app/mlog-o-du_hist.csv"
1227 dst_bin = xran_path+"/app/mlog-o-du-ran"+str(rantech)+"-cat"+str(cat)+"-mu"+str(mu)+"-bw"+str(bw)+"-tcase"+str(tcase)+".bin"
1228 dst_csv = xran_path+"/app/mlog-o-du_hist-ran"+str(rantech)+"-cat"+str(cat)+"-mu"+str(mu)+"-bw"+str(bw)+"-tcase"+str(tcase)+".csv"
1231 d_bin = shutil.copyfile(src_bin, dst_bin)
1232 d_csv = shutil.copyfile(src_csv, dst_csv)
1234 logging.info("O-DU MLog is not present\n")
1238 logging.info("O-DU Mlog was copied\n")
1241 print("Destination path:", d_bin)
1242 print("Destination path:", d_csv)
1244 d_bin = shutil.copyfile(src_bin, dst_bin)
1245 d_csv = shutil.copyfile(src_csv, dst_csv)
1247 src_bin = xran_path+"/app/mlog-o-ru.bin"
1248 src_csv = xran_path+"/app/mlog-o-ru_hist.csv"
1249 dst_bin = xran_path+"/app/mlog-o-ru-ran"+str(rantech)+"-cat"+str(cat)+"-mu"+str(mu)+"-bw"+str(bw)+"-tcase"+str(tcase)+".bin"
1250 dst_csv = xran_path+"/app/mlog-o-ru_hist-ran"+str(rantech)+"-cat"+str(cat)+"-mu"+str(mu)+"-bw"+str(bw)+"-tcase"+str(tcase)+".csv"
1252 d_bin = shutil.copyfile(src_bin, dst_bin)
1253 d_csv = shutil.copyfile(src_csv, dst_csv)
1256 d_bin = shutil.copyfile(src_bin, dst_bin)
1257 d_csv = shutil.copyfile(src_csv, dst_csv)
1259 logging.info("O-RU MLog is not present\n")
1263 logging.info("O-RU Mlog was copied\n")
1268 def run_tcase(rem_o_ru_host, rantech, cat, mu, bw, tcase, verbose, xran_path, vf_addr_o_xu):
1270 if rantech == 2: #LTE and #5G NR
1272 test_config =xran_path+"/app/usecase/dss/mu{0:d}_{1:d}mhz".format(mu, bw)
1274 print("Incorrect cat argument\n")
1276 elif rantech == 1: #LTE
1278 test_config =xran_path+"/app/usecase/lte_b/mu{0:d}_{1:d}mhz".format(mu, bw)
1280 test_config =xran_path+"/app/usecase/lte_a/mu{0:d}_{1:d}mhz".format(mu, bw)
1282 print("Incorrect cat arguments\n")
1284 elif rantech == 0: #5G NR
1286 test_config =xran_path+"/app/usecase/cat_b/mu{0:d}_{1:d}mhz".format(mu, bw)
1288 test_config =xran_path+"/app/usecase/cat_a/mu{0:d}_{1:d}mhz".format(mu, bw)
1290 print("Incorrect cat argument\n")
1293 print("Incorrect rantech argument\n")
1297 test_config = test_config+"/"+str(tcase)
1299 app = [xran_path+"/app/build/sample-app", xran_path+"/app/build-oru/sample-app-ru"]
1301 logging.debug("run: %s %s", app, test_config)
1302 logging.debug("Started script: master.py, XRAN path %s", xran_path)
1305 global oXuOwdmEnabled
1306 oXuOwdmEnabled = 0 #Default is owdm measurements are disabled
1307 REM_O_RU_HOST=rem_o_ru_host
1309 if(os.system('lscpu | grep -q -i AVX512IFMA') == 0):
1315 if REM_O_RU_HOST == "":
1318 if ((os.path.isfile(test_config+"/usecase_du_icx.cfg")) & (os.path.isfile(test_config+"/usecase_ru_icx.cfg"))):
1319 test_cfg.append(test_config+"/usecase_du_icx.cfg")
1320 test_cfg.append(test_config+"/usecase_ru_icx.cfg")
1322 test_cfg.append(test_config+"/usecase_du.cfg")
1323 test_cfg.append(test_config+"/usecase_ru.cfg")
1325 if ((os.path.isfile(test_config+"/usecase_du_csx.cfg")) & (os.path.isfile(test_config+"/usecase_ru_csx.cfg"))):
1326 test_cfg.append(test_config+"/usecase_du_csx.cfg")
1327 test_cfg.append(test_config+"/usecase_ru_csx.cfg")
1329 test_cfg.append(test_config+"/usecase_du.cfg")
1330 test_cfg.append(test_config+"/usecase_ru.cfg")
1331 else: # O-RU remote always CSX-SP
1333 if (os.path.isfile(test_config+"/usecase_du_icx.cfg")):
1334 test_cfg.append(test_config+"/usecase_du_icx.cfg")
1336 test_cfg.append(test_config+"/usecase_du.cfg")
1337 if (os.path.isfile(test_config+"/usecase_ru_csx.cfg")):
1338 test_cfg.append(test_config+"/usecase_ru_csx.cfg")
1340 test_cfg.append(test_config+"/usecase_ru.cfg")
1342 if ((os.path.isfile(test_config+"/usecase_du_csx.cfg")) & (os.path.isfile(test_config+"/usecase_ru_csx.cfg"))):
1343 test_cfg.append(test_config+"/usecase_du_csx.cfg")
1344 test_cfg.append(test_config+"/usecase_ru_csx.cfg")
1346 test_cfg.append(test_config+"/usecase_du.cfg")
1347 test_cfg.append(test_config+"/usecase_ru.cfg")
1349 usecase_dirname = os.path.dirname(os.path.realpath(test_cfg[0]))
1350 print(usecase_dirname)
1353 os.chdir(xran_path+"/app/")
1360 os.system('pkill -9 "sample-app"')
1361 os.system('pkill -9 "sample-app-ru"')
1362 os.system('rm -rf ./logs')
1364 usecase_cfg = parse_usecase_cfg(rantech, cat, mu, bw, tcase, xran_path, test_cfg)
1369 log_file_name.append("sampleapp_log_{}_{}_cat_{}_mu{}_{}mhz_tst_{}.log".format(dic_ran_tech.get(rantech), dic_xu.get(i),cat, mu, bw, tcase))
1370 with open(log_file_name[i], "w") as f:
1371 run_cmd = [app[i], "--usecasefile", test_cfg[i], "--num_eth_vfs", "8", "--vf_addr_o_xu_a", vf_addr_o_xu[i][0], "--vf_addr_o_xu_b", vf_addr_o_xu[i][1],"--vf_addr_o_xu_c", vf_addr_o_xu[i][2],"--vf_addr_o_xu_d", vf_addr_o_xu[i][3]]
1372 #, stdout=f, stderr=f
1374 if i == 0 or REM_O_RU_HOST == "":
1375 p = subprocess.Popen(run_cmd)
1377 CMD = ' '.join([str(elem) for elem in run_cmd])
1378 ssh = ["ssh", "%s" % REM_O_RU_HOST, "cd " + xran_path + "/app"+"; hostname; pwd; pkill -9 sample-app; rm -rf ./logs; ulimit -c unlimited; echo 1 > /proc/sys/kernel/core_uses_pid; " + CMD]
1380 print("my_cmd: ", ' '.join([str(elem) for elem in ssh]))
1381 p = subprocess.Popen(ssh, shell=False)
1383 if i == 0 or REM_O_RU_HOST == "":
1384 p = subprocess.Popen(run_cmd, stdout=f, stderr=f)
1386 CMD = ' '.join([str(elem) for elem in run_cmd])
1387 ssh = ["ssh", "%s" % REM_O_RU_HOST, "cd " + xran_path + "/app"+"; hostname; pwd; pkill -9 sample-app; rm -rf ./logs; ulimit -c unlimited; echo 1 > /proc/sys/kernel/core_uses_pid; " + CMD]
1388 p = subprocess.Popen(ssh, shell=False, stdout=f, stderr=f)
1389 #stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1391 t = Timer(timeout_sec, p.kill)
1394 logfile_xu.insert(i, f)
1395 processes.append((p, logfile_xu[i]))
1397 logging.info("Running O-DU and O-RU see output in:\n O-DU: %s\n O-RU: %s\n", xran_path+"/app/"+logfile_xu[0].name, xran_path+"/app/"+logfile_xu[1].name)
1398 #while (gmtime().tm_sec % 30) <> 0:
1400 print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
1402 for p, f in processes:
1406 except (KeyboardInterrupt, SystemExit):
1410 for pp, ff in processes:
1411 pp.send_signal(signal.SIGINT)
1415 if p.returncode != 0:
1416 print("Application {} failed p.returncode:{}".format(dic_xu.get(i), p.returncode))
1418 #logging.info("FAIL\n")
1420 #sys.exit(p.returncode)
1428 logging.info("O-DU and O-RU are done\n")
1431 sys_cmd = "scp -r "+REM_O_RU_HOST+":"+ xran_path+"/app/logs/*.txt "+ xran_path+"/app/logs/"
1434 sys_cmd = "scp -r "+REM_O_RU_HOST+":"+ xran_path+"/app/mlog-o-ru* "+ xran_path+"/app/"
1438 make_copy_mlog(rantech, cat, mu, bw, tcase, xran_path)
1439 #oXuNum check only O-RU 0 for now
1440 if 'oXuOwdmEnabled==1' in globals():
1445 for o_xu_id in range(0, oXuNum):
1448 o_xu_test_cfg.append(usecase_dirname+"/"+oXuCfgFile0)
1450 o_xu_test_cfg.append(usecase_dirname+"/"+oXuCfgFile1)
1452 o_xu_test_cfg.append(usecase_dirname+"/"+oXuCfgFile2)
1454 o_xu_test_cfg.append(usecase_dirname+"/"+oXuCfgFile3)
1456 logging.info("O-RU %d parse config files %s\n", o_xu_id, o_xu_test_cfg)
1458 usecase_cfg_per_o_ru = parse_dat_file(rantech, cat, mu, bw, tcase, xran_path, o_xu_test_cfg)
1460 res = compare_results(o_xu_id,rantech, cat, mu, bw, tcase, xran_path, o_xu_test_cfg, 0)
1462 # overwrite PASS/FAIL in res if the owd tests have failed
1463 res1 = check_owdm_test_results(xran_path, o_xu_id)
1464 print("res1 :", res1)
1470 del_dat_file_vars(usecase_cfg_per_o_ru)
1473 res = compare_results(o_xu_id, rantech, cat, mu, bw, tcase, xran_path, o_xu_test_cfg, 1)
1477 del_dat_file_vars(usecase_cfg_per_o_ru)
1483 del_dat_file_vars(usecase_cfg_per_o_ru)
1496 tcase_description = "n/a"
1498 """Processes input files to produce IACA files"""
1500 if os.getenv("XRAN_DIR") is not None:
1501 xran_path = os.getenv("XRAN_DIR")
1503 print("please set 'export XRAN_DIR' in the OS")
1506 # Set up logging with given level (DEBUG, INFO, ERROR) for console end logfile
1507 init_logger(logging.INFO, logging.DEBUG)
1508 host_name = socket.gethostname()
1509 logging.info("host: %s Started script: master.py from XRAN path %s",host_name, xran_path)
1511 options = parse_args(sys.argv[1:])
1512 rem_o_ru_host = options.rem_o_ru_host
1514 all_test_cases = all_test_cases_long
1515 if host_name == "sc12-xran-sub6":
1517 vf_addr_o_xu = vf_addr_o_xu_sc12_cvl
1519 vf_addr_o_xu = vf_addr_o_xu_sc12
1520 elif host_name == "csl-npg-scs1-30":
1521 vf_addr_o_xu = vf_addr_o_xu_scs1_30
1522 elif host_name == "npg-scs1-repo.la.intel.com":
1523 vf_addr_o_xu = vf_addr_o_xu_scs1_repo
1524 elif host_name == "icelake-scs1-1":
1525 vf_addr_o_xu = vf_addr_o_xu_icelake_scs1_1
1526 elif host_name == "icx-npg-scs1-coyote4":
1527 vf_addr_o_xu = vf_addr_o_xu_icx_npg_scs1_coyote4
1528 elif host_name == "csl-npg-scs1-35":
1529 vf_addr_o_xu = vf_addr_o_xu_scs1_35
1530 elif host_name == "csl-npg-scs1-33":
1531 vf_addr_o_xu = vf_addr_o_xu_csl_npg_scs1_33
1532 elif host_name == "skx-5gnr-sd6":
1533 vf_addr_o_xu = vf_addr_o_xu_skx_5gnr_sd6
1535 vf_addr_o_xu = vf_addr_o_xu_jenkins
1536 all_test_cases = all_test_cases_short
1538 print(vf_addr_o_xu[0][0],vf_addr_o_xu[0][1],vf_addr_o_xu[0][2],vf_addr_o_xu[0][3])
1539 print(vf_addr_o_xu[1][0],vf_addr_o_xu[1][1],vf_addr_o_xu[1][2],vf_addr_o_xu[1][3])
1541 # Parse input arguments
1542 if len(sys.argv) == 1 or (len(sys.argv) == 3 and rem_o_ru_host):
1543 run_total = len(all_test_cases)
1545 print("Run All test cases {}\n".format(run_total))
1547 rantech = options.rantech
1548 cat = options.category
1549 mu = options.numerology
1550 bw = options.bandwidth
1551 tcase = options.testcase
1552 verbose = options.verbose
1554 print(rem_o_ru_host)
1557 for test_run_ix in range(0, run_total):
1558 rantech = all_test_cases[test_run_ix][0]
1559 cat = all_test_cases[test_run_ix][1]
1560 mu = all_test_cases[test_run_ix][2]
1561 bw = all_test_cases[test_run_ix][3]
1562 tcase = all_test_cases[test_run_ix][4]
1563 tcase_description = all_test_cases[test_run_ix][5]
1566 logging.info("Test# %d out of %d [PASS %d FAIL %d]: ran %d cat %d mu %d bw %d test case %d [%s]\n",test_run_ix, run_total, test_pass_cnt, test_fail_cnt, rantech, cat, mu, bw, tcase, tcase_description)
1567 res = run_tcase(rem_o_ru_host, rantech, cat, mu, bw, tcase, verbose, xran_path, vf_addr_o_xu)
1570 test_results.append((rantech, cat, mu, bw, tcase,'FAIL', tcase_description))
1574 test_results.append((rantech, cat, mu, bw, tcase,'PASS', tcase_description))
1576 res = run_tcase(rem_o_ru_host, rantech, cat, mu, bw, tcase, verbose, xran_path, vf_addr_o_xu)
1578 test_results.append((rantech, cat, mu, bw, tcase,'FAIL'))
1580 test_results.append((rantech, cat, mu, bw, tcase,'PASS'))
1582 with open('testresult.txt', 'w') as reshandle:
1583 json.dump(test_results, reshandle)
1587 if __name__ == '__main__':
1588 print("Python version")
1590 print("Version info.")
1591 print (sys.version_info)
1592 if (sys.version_info[0] < 3):
1593 raise Exception ("Must be Python 3")
1594 START_TIME = datetime.now()
1596 END_TIME = datetime.now()
1597 logging.debug("Start time: %s, end time: %s", START_TIME, END_TIME)
1598 logging.info("Execution time: %s", END_TIME - START_TIME)