blob: a56f7e6a533407749bd5f26b30e121f68230da0a [file] [log] [blame]
Harald Welte09538f82019-08-01 09:50:25 +02001module BSC_Tests_CBSP {
2
3/* CBSP Integration Tests for OsmoBSC
4 * (C) 2019 by Harald Welte <laforge@gnumonks.org>
5 * All rights reserved.
6 *
7 * Released under the terms of GNU General Public License, Version 2 or
8 * (at your option) any later version.
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 *
12 * This test suite tests OsmoBSC while emulating the CBC (Cell Broadcast Centre)
13 */
14
15import from General_Types all;
16import from Osmocom_Types all;
17import from GSM_Types all;
18import from IPL4asp_Types all;
19import from BSSAP_Types all;
20import from BSSMAP_Templates all;
21
22import from BSC_Tests all;
23
24import from IPA_Emulation all;
25import from IPA_CodecPort all;
26import from IPA_Types all;
27
Harald Welte187f7a92019-09-05 11:15:20 +020028import from MobileL3_Types all;
29import from MobileL3_RRM_Types all;
30import from L3_Templates all;
31
Harald Welte09538f82019-08-01 09:50:25 +020032import from RSL_Types all;
33import from RSL_Emulation all;
34
35import from CBSP_Types all;
36import from CBSP_Templates all;
37import from CBSP_Adapter all;
38import from CBSP_CodecPort all;
39
40modulepar {
41 charstring mp_cbc_ip := "0.0.0.0";
42 integer mp_cbc_port := 48049;
43 integer mp_bsc_cbsp_port := 48050;
44
Harald Welte49a61e62020-03-30 20:13:32 +020045 /* BTS 0: 001-01-1-0 with CBCH
46 * BTS 1: 001-01-1-1 with CBCH
47 * BTS 2: 001-01-2-1 with CBCH
48 * BTS 3: 001-01-2-3 without CBCH */
49 GsmCgiAbstract mp_cgi_bts0 := { '001'H, '01'H, 1, 0 };
50 GsmCgiAbstract mp_cgi_bts1 := { '001'H, '01'H, 1, 1 };
51 GsmCgiAbstract mp_cgi_bts2 := { '001'H, '01'H, 2, 1 };
52 GsmCgiAbstract mp_cgi_bts3 := { '001'H, '01'H, 2, 3 };
Harald Welte09538f82019-08-01 09:50:25 +020053}
54
55private type record GsmCgiAbstract {
56 GsmMcc mcc,
57 GsmMnc mnc,
58 GsmLac lac,
59 GsmCellId ci
60};
61private template (value) BSSMAP_FIELD_CellIdentification_CGI bssmap_cgi(GsmCgiAbstract cgi) :=
62 ts_BSSMAP_CI_CGI(cgi.mcc, cgi.mnc, cgi.lac, cgi.ci);
63private template (value) BSSMAP_FIELD_CellIdentification_LAC_CI bssmap_lac_ci(GsmCgiAbstract cgi) :=
64 ts_BSSMAP_CI_LAC_CI(cgi.lac, cgi.ci);
65private template (value) BSSMAP_FIELD_CellIdentification_LAI bssmap_lai(GsmCgiAbstract cgi) :=
66 ts_BSSMAP_CI_LAI(cgi.mcc, cgi.mnc, cgi.lac);
67private template (value) OCT2 bssmap_lac(GsmCgiAbstract cgi) := ts_BSSMAP_CI_LAC(cgi.lac);
68private template (value) OCT2 bssmap_ci(GsmCgiAbstract cgi) := ts_BSSMAP_CI_CI(cgi.ci);
69
70type component cbsp_test_CT extends test_CT, CBSP_Adapter_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +020071 var uint16_t g_cbsp_msg_id := 0;
72 var uint16_t g_cbsp_ser_no := 0;
73}
74
75private function f_g_cbsp_next_msg_id_ser_no() runs on cbsp_test_CT
76{
77 g_cbsp_msg_id := g_cbsp_msg_id + 1;
78 g_cbsp_ser_no := g_cbsp_ser_no + 1;
79 log("g_cbsp_msg_id=", g_cbsp_msg_id, " g_cbsp_ser_no=", g_cbsp_ser_no);
Harald Welte09538f82019-08-01 09:50:25 +020080}
81
82private altstep as_IgnRSL(template RSL_Message tr) runs on cbsp_test_CT {
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +070083[] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { repeat; }
84[] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { repeat; }
85[] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { repeat; }
Harald Welte09538f82019-08-01 09:50:25 +020086}
87
88private altstep as_FailRSL() runs on cbsp_test_CT {
89var template RSL_Message tr := (tr_RSL_SMSCB_CMD);
90var ASP_RSL_Unitdata rx;
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +070091[] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) -> value rx {
Harald Welte09538f82019-08-01 09:50:25 +020092 setverdict(fail, "Received unexpected RSL ", rx);
93 mtc.stop;
94 }
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +070095[] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) -> value rx {
Harald Welte09538f82019-08-01 09:50:25 +020096 setverdict(fail, "Received unexpected RSL ", rx);
97 mtc.stop;
98 }
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +070099[] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) -> value rx {
Harald Welte09538f82019-08-01 09:50:25 +0200100 setverdict(fail, "Received unexpected RSL ", rx);
101 mtc.stop;
102 }
103}
104
Neels Hofmeyr579bfa82020-07-29 00:33:59 +0200105private function f_init(float guard_timeout := 30.0) runs on cbsp_test_CT {
106 BSC_Tests.f_init(guard_timeout := guard_timeout);
Harald Welte09538f82019-08-01 09:50:25 +0200107 activate(as_IgnRSL((tr_RSL_BCCH_INFO, tr_RSL_SACCH_FILL,
108 tr_RSL_NO_BCCH_INFO, tr_RSL_NO_SACCH_FILL,
109 tr_RSL_MsgTypeD(?))));
110 activate(as_FailRSL());
111}
112private function f_cbsp_init_client() runs on cbsp_test_CT {
113 f_init();
114 CBSP_Adapter.f_connect(mp_bsc_ip, mp_bsc_cbsp_port, "", -1);
Neels Hofmeyr289c36a2020-07-28 21:19:20 +0200115 /* FIXME: osmo-bsc should probably still send a CBSP RESTART, but to get the current tests running, let's first
116 * ignore this aspect */
117 setverdict(pass);
Harald Welte09538f82019-08-01 09:50:25 +0200118}
119
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200120private function f_cbsp_init_server(uint16_t cbsp_msg_id, uint16_t cbsp_ser_no, float guard_timeout := 30.0) runs on cbsp_test_CT {
Harald Welte09538f82019-08-01 09:50:25 +0200121 var ASP_Event asp_evt;
122 timer T := 10.0;
123
Neels Hofmeyr579bfa82020-07-29 00:33:59 +0200124 f_init(guard_timeout := guard_timeout);
Harald Welte09538f82019-08-01 09:50:25 +0200125 CBSP_Adapter.f_bind(mp_cbc_ip, mp_cbc_port);
126
127 T.start;
128 alt {
129 [] CBSP[0].receive(ASP_Event:{connOpened:=?}) -> value asp_evt {
130 g_cbsp_conn_id[0] := asp_evt.connOpened.connId;
131 }
132 [] T.timeout {
133 setverdict(fail, "Timeout waiting for incoming connection to CBSP Port");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200134 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200135 }
136 }
Neels Hofmeyr90a07522020-07-29 01:22:11 +0200137 f_expect_cbsp_restart();
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200138
139 g_cbsp_msg_id := cbsp_msg_id;
140 g_cbsp_ser_no := cbsp_ser_no;
141 log("g_cbsp_msg_id=", g_cbsp_msg_id, " g_cbsp_ser_no=", g_cbsp_ser_no);
Harald Welte09538f82019-08-01 09:50:25 +0200142}
Neels Hofmeyr90a07522020-07-29 01:22:11 +0200143private function f_expect_cbsp_restart() runs on cbsp_test_CT {
Harald Welte09538f82019-08-01 09:50:25 +0200144 interleave {
145 [] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_CBS, CBSP_RI_DATA_LOST)));
146 /* should we also expect a restart for emergency related messages? */
147 //[] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_EMERG, CBSP_RI_DATA_LOST)));
148 }
149}
150
Neels Hofmeyr4c365322020-07-29 00:36:37 +0200151/* Generate a CBSP payload: random size for payload_len == 0, or specific fixed size for payload_len > 0. */
152function f_gen_page(integer payload_len := 0) return CBSP_IE {
153 if (payload_len < 1) {
154 /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page:
155 * the maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero
156 * length). Note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
157 payload_len := 1 + f_rnd_int(82);
158 }
159 log("Generating CBSP payload: ", payload_len, " octets");
160 var octetstring payload := f_rnd_octstring(payload_len);
161 return valueof(ts_CbspMsgContent(payload, payload_len));
Harald Welte09538f82019-08-01 09:50:25 +0200162}
163
164function f_cbsp_reset_bss(integer idx) runs on CBSP_Adapter_CT {
165 var template (value) CBSP_PDU tx;
166 timer T := 3.0;
167 tx := ts_CBSP_RESET(cell_list := ts_BSSMAP_CIL_BSS);
168 CBSP[idx].clear;
169 CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx));
170 T.start;
171 alt {
172 [] CBSP[idx].receive(tr_CBSP_Recv(?, tr_CBSP_RESET_COMPL(cell_list := ts_BSSMAP_CIL_BSS)));
173 [] CBSP[idx].receive {
174 setverdict(fail, "received unexpected CBSP");
175 mtc.stop;
176 }
177 [] T.timeout {
178 setverdict(fail, "timeout waiting for RESET COMPLETE");
179 mtc.stop;
180 }
181 }
182}
183
184/* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
Harald Welte187f7a92019-09-05 11:15:20 +0200185function f_cbsp_write_emerg(uint16_t msg_id, uint16_t ser_no,
186 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
187 template (value) uint8_t emerg_ind := 1,
188 template (value) uint16_t warn_type := oct2int('0780'O),
189 template (value) uint16_t warn_per := 5,
190 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
191 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
192 var template (value) CBSP_PDU tx;
193 var template CBSP_PDU rx;
194 var CBSP_IEs pages := {f_gen_page()};
195
196 tx := ts_CBSP_WRITE_EMERG(msg_id, ser_no, cell_list, emerg_ind, warn_type, warn_per);
197 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
198 if (istemplatekind(fail_list, "omit")) {
199 rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, omit);
200 } else {
201 rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, omit);
202 }
203 alt {
204 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
205 setverdict(pass);
206 }
207 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
208 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200209 mtc.stop;
Harald Welte187f7a92019-09-05 11:15:20 +0200210 }
211 }
212}
213
214/* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
Harald Welte09538f82019-08-01 09:50:25 +0200215function f_cbsp_write(uint16_t msg_id, uint16_t ser_no,
216 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
217 template (value) CBSP_Category category := CBSP_CATEG_NORMAL,
218 uint16_t rep_period := 10, uint16_t num_bcast_req := 1,
219 uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content,
220 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
221 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
222 var template (value) CBSP_PDU tx;
223 var template CBSP_PDU rx;
Harald Welte09538f82019-08-01 09:50:25 +0200224
225 tx := ts_CBSP_WRITE_CBS(msg_id, ser_no, cell_list, channel_ind, category,
226 rep_period, num_bcast_req, dcs, content);
227 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
228 if (istemplatekind(fail_list, "omit")) {
229 rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, channel_ind);
230 } else {
231 rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, channel_ind);
232 }
233 alt {
234 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
235 setverdict(pass);
236 }
237 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
238 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200239 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200240 }
241 }
242}
243
244/* send a REPLACE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
245function f_cbsp_replace(uint16_t msg_id, uint16_t new_ser_no, uint16_t old_ser_no,
246 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
247 template (value) CBSP_Category category := CBSP_CATEG_NORMAL,
248 uint16_t rep_period := 10, uint16_t num_bcast_req := 1,
249 uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content,
250 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
251 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
252 var template (value) CBSP_PDU tx;
253 var template CBSP_PDU rx;
Harald Welte09538f82019-08-01 09:50:25 +0200254
255 tx := ts_CBSP_REPLACE_CBS(msg_id, new_ser_no, old_ser_no, cell_list, channel_ind, category,
256 rep_period, num_bcast_req, dcs, content);
257 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
258 if (istemplatekind(fail_list, "omit")) {
259 rx := tr_CBSP_REPLACE_CBS_COMPL(msg_id, new_ser_no, old_ser_no, ?, success_list,
260 channel_ind);
261 } else {
262 rx := tr_CBSP_REPLACE_CBS_FAIL(msg_id, new_ser_no, old_ser_no, fail_list, *, success_list,
263 channel_ind);
264 }
265 alt {
266 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
267 setverdict(pass);
268 }
269 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
270 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200271 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200272 }
273 }
274}
275/* send a KILL CBS to the BSC; expect either COMPLETE or FAILURE in response*/
276function f_cbsp_kill(uint16_t msg_id, uint16_t ser_no, template (omit) uint8_t channel_ind := 0,
277 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
278 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
279 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT
280{
281 var template (value) CBSP_PDU tx;
282 var template CBSP_PDU rx;
283
284 tx := ts_CBSP_KILL(msg_id, ser_no, cell_list, channel_ind);
285 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
286 if (istemplatekind(fail_list, "omit")) {
287 rx := tr_CBSP_KILL_COMPL(msg_id, ser_no, compl_list:=*, cell_list:=success_list,
288 channel_ind:=channel_ind);
289 } else {
290 rx := tr_CBSP_KILL_FAIL(msg_id, ser_no, fail_list, compl_list:=*, cell_list:=success_list,
291 channel_ind:=channel_ind);
292 }
293 alt {
294 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
295 setverdict(pass);
296 }
297 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
298 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200299 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200300 }
301 }
302}
303
Harald Welte09538f82019-08-01 09:50:25 +0200304template (present) RSL_IE_CbCommandType
305tr_RslCbCmdType(template (present) uint2_t lblock := ?, template (present) RSL_CbCommand cmd := ?) := {
306 command := cmd,
307 default_bcast_null := ?,
308 spare := ?,
309 last_block := lblock
310}
311
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200312/* translate blocks count to RSL_CB_CMD_LASTBLOCK_1..4 values */
313private function f_cbsp_block_count_enc(integer num_blocks) return integer
314{
315 if (num_blocks < 1 or num_blocks > 4) {
316 setverdict(fail, "Invalid num_blocks: ", num_blocks);
317 mtc.stop;
318 }
319 if (num_blocks == 4) {
320 return 0;
321 }
322 return num_blocks;
323}
324
Harald Welte09538f82019-08-01 09:50:25 +0200325/* build a RSL_Message receive template from a CBSP page */
Neels Hofmeyr63e2e182020-08-12 11:42:01 +0000326private function f_page2rsl(CBSP_IE page, uint16_t msg_id, uint16_t ser_no, boolean ext_cbch := false,
327 template (present) integer expect_blocks := ?)
Harald Welte09538f82019-08-01 09:50:25 +0200328return template (present) RSL_Message
329{
330 var template RSL_Message tr;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200331 var integer len;
332 var integer num_blocks;
Harald Welte09538f82019-08-01 09:50:25 +0200333 var octetstring payload;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200334
Harald Welte09538f82019-08-01 09:50:25 +0200335 payload := int2oct(ser_no, 2) & int2oct(msg_id, 2) & '0011'O & page.body.msg_content.val;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200336 len := lengthof(payload);
337 num_blocks := len / 22;
338 if (len mod 22 > 0) {
339 num_blocks := num_blocks + 1;
340 }
341
Neels Hofmeyr63e2e182020-08-12 11:42:01 +0000342 if (not istemplatekind(expect_blocks, "omit") and not match(num_blocks, expect_blocks)) {
343 setverdict(fail, "mismatch: CBSP page expect_blocks == ", expect_blocks, ", but generated num_blocks == ", num_blocks);
344 mtc.stop;
345 }
346
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200347 var integer lblock := f_cbsp_block_count_enc(num_blocks);
348
Harald Welte09538f82019-08-01 09:50:25 +0200349 tr := tr_RSL_SMSCB_CMD(tr_RslCbCmdType(lblock), f_pad_oct(payload, 88, '00'O));
350 if (ext_cbch) {
351 tr.ies[3] := tr_RSL_IE(RSL_IE_Body:{smscb_chan_ind := 1});
352 tr.ies[4] := *;
353 }
354 return tr;
355}
356
357/***********************************************************************
358 * Test Cases
359 ***********************************************************************/
360
361/* Test if BSC (server) accepts connections from CBC (client) */
362testcase TC_cbsp_bsc_server() runs on cbsp_test_CT {
363 f_cbsp_init_client();
364 setverdict(pass);
365}
366
367/* Test if BSC (client) is connecting to CBC (server) */
368testcase TC_cbsp_bsc_client() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200369 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200370 setverdict(pass);
371}
372
373/* Test if a BSS-global RESET is executed successfully */
374testcase TC_cbsp_reset_bss() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200375 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200376
377 f_cbsp_reset_bss(0);
378 setverdict(pass);
379}
380
381testcase TC_cbsp_write() runs on cbsp_test_CT {
382 var template (value) CBSP_PDU tx;
383 var CBSP_IEs pages := {f_gen_page()};
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200384 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200385
386 tx := ts_CBSP_WRITE_CBS(msg_id:=23, new_ser_nr:=42, cell_list:=ts_BSSMAP_CIL_BSS,
387 channel_ind:=0, category:=CBSP_CATEG_NORMAL,
388 rep_period:=10, num_bcast_req:=1, dcs := 0,
389 content:=pages);
390
391 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
392 f_sleep(10.0);
393}
394
395/* Write to entire BSS; three cells succeed; one fails (no CBCH) */
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200396function f_tc_cbsp_write_bss(integer payload_len := -1, template (present) integer expect_blocks) runs on cbsp_test_CT {
397 var CBSP_IEs pages := {f_gen_page(payload_len := payload_len)};
Harald Welte09538f82019-08-01 09:50:25 +0200398 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
399 cell_list := ts_BSSMAP_CIL_BSS;
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200400 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200401 success_list:=tr_BSSMAP_CIL_CGI({?,?,?}), fail_list:={?});
402
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200403 var template RSL_Message tr := f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no, expect_blocks := expect_blocks);
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200404 log("RSL[0,1,2] EXPECTING ", tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200405 interleave {
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200406 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[0]"); }
407 [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[1]"); }
408 [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[2]"); }
Harald Welte09538f82019-08-01 09:50:25 +0200409 }
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200410 setverdict(pass);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200411
412 /* Make the next test run (if any) use different msg_id and ser_no */
413 f_g_cbsp_next_msg_id_ser_no();
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200414}
415testcase TC_cbsp_write_bss() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200416 f_cbsp_init_server(1001, 1501, guard_timeout := 60.0);
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200417 /* In the SMSCB message, there is a head followed by payload,
418 * and the resulting data is segmented in blocks of 22 octets (<= 4 blocks).
419 *
420 * [head][...payload....]|[....................]|[....................]|[....................]
421 * 0 |16 |38 |60 |82
422 * 0 5 |22 |44 |66 |88
423 *
424 * blocks count: 1 | 2 | 3 | 4
425 * payload octets count: 1..16 | 17..38 | 39..60 | 61..82
426 */
427 f_tc_cbsp_write_bss(payload_len := 1, expect_blocks := 1);
428 f_tc_cbsp_write_bss(payload_len := 2, expect_blocks := 1);
429 f_tc_cbsp_write_bss(payload_len := 16, expect_blocks := 1);
430 f_tc_cbsp_write_bss(payload_len := 17, expect_blocks := 2);
431 f_tc_cbsp_write_bss(payload_len := 23, expect_blocks := 2);
432 f_tc_cbsp_write_bss(payload_len := 38, expect_blocks := 2);
433 f_tc_cbsp_write_bss(payload_len := 39, expect_blocks := 3);
434 f_tc_cbsp_write_bss(payload_len := 42, expect_blocks := 3);
435 f_tc_cbsp_write_bss(payload_len := 60, expect_blocks := 3);
436 f_tc_cbsp_write_bss(payload_len := 61, expect_blocks := 4);
437 f_tc_cbsp_write_bss(payload_len := 77, expect_blocks := 4);
438 f_tc_cbsp_write_bss(payload_len := 82, expect_blocks := 4);
Harald Welte09538f82019-08-01 09:50:25 +0200439}
440
441/* Write to single BTS supporting CBCH: success */
442testcase TC_cbsp_write_bts_cgi() runs on cbsp_test_CT {
443 var CBSP_IEs pages := {f_gen_page()};
444 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
445 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200446 f_cbsp_init_server(2001, 2501);
447 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200448 success_list:=cell_list, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200449 var template RSL_Message tr := f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no);
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +0700450 IPA_RSL[0].receive(tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200451 f_sleep(5.0);
452}
453
454/* Write to single BTS not supporting CBCH: failure */
455testcase TC_cbsp_write_bts_no_cbch() runs on cbsp_test_CT {
456 var CBSP_IEs pages := {f_gen_page()};
457 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
458 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts3)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200459 f_cbsp_init_server(3001, 3501);
460 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200461 success_list:=omit, fail_list:={?});
462 f_sleep(5.0);
463}
464
465/* Write to single non-existant BTS */
466testcase TC_cbsp_write_unknown_bts() runs on cbsp_test_CT {
467 var CBSP_IEs pages := {f_gen_page()};
468 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
469 cell_list := ts_BSSMAP_CIL_CGI({ts_BSSMAP_CI_CGI(mp_cgi_bts0.mcc, mp_cgi_bts1.mnc, 22222, 33333)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200470 f_cbsp_init_server(4001, 4501);
471 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200472 success_list:=omit, fail_list:={?});
473 f_sleep(5.0);
474}
475
476/* Write to single BTS using LAC+CI */
477testcase TC_cbsp_write_lac_ci() runs on cbsp_test_CT {
478 var CBSP_IEs pages := {f_gen_page()};
479 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
480 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200481 f_cbsp_init_server(5001, 5501);
482 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200483 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200484 IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
Harald Welte09538f82019-08-01 09:50:25 +0200485 f_sleep(5.0);
486}
487
488/* Write to single BTS using CI */
489testcase TC_cbsp_write_ci() runs on cbsp_test_CT {
490 var CBSP_IEs pages := {f_gen_page()};
491 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
492 cell_list := ts_BSSMAP_CIL_CI({bssmap_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200493 f_cbsp_init_server(6001, 6501);
494 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200495 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200496 IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
Harald Welte09538f82019-08-01 09:50:25 +0200497 f_sleep(5.0);
498}
499
500/* Write to single BTS using LAI */
501testcase TC_cbsp_write_lai() runs on cbsp_test_CT {
502 var CBSP_IEs pages := {f_gen_page()};
503 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
Neels Hofmeyrf5148482020-07-31 16:56:02 +0200504 /* bts0 and bts1 have the same LAI (only differ in cell identity).
505 * bts2 and bts3 also have the same LAI, but only bts2 has a CBCH.
506 * Target only bts2.
507 */
508 cell_list := ts_BSSMAP_CIL_LAI({bssmap_lai(mp_cgi_bts2)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200509 f_cbsp_init_server(7001, 7501);
510 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200511 success_list:=?, fail_list:=omit);
Neels Hofmeyrf5148482020-07-31 16:56:02 +0200512 IPA_RSL[2].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
Harald Welte09538f82019-08-01 09:50:25 +0200513 f_sleep(5.0);
514}
515
516/* Write to two BTS using LAC */
517testcase TC_cbsp_write_lac() runs on cbsp_test_CT {
518 var CBSP_IEs pages := {f_gen_page()};
519 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
520 cell_list := ts_BSSMAP_CIL_LAC({bssmap_lac(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200521 f_cbsp_init_server(8001, 8501);
522 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200523 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200524 var template RSL_Message tr := f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no);
Harald Welte09538f82019-08-01 09:50:25 +0200525 interleave {
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +0700526 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr));
527 [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200528 }
529 f_sleep(5.0);
530}
531
532/* Write a message, then replace it */
533testcase TC_cbsp_write_then_replace() runs on cbsp_test_CT {
534 var CBSP_IEs pages := {f_gen_page()};
535 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
536 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200537 f_cbsp_init_server(9001, 9501);
538 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, num_bcast_req:=10, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200539 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200540
Neels Hofmeyr62d5da32020-07-31 16:56:14 +0200541 IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200542
543 /* Replace: keep the same msg_id, use a new ser_no */
544 var uint16_t old_ser_no := g_cbsp_ser_no;
545 g_cbsp_ser_no := g_cbsp_ser_no + 1;
546 f_cbsp_replace(g_cbsp_msg_id, g_cbsp_ser_no, old_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200547 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200548
Neels Hofmeyr62d5da32020-07-31 16:56:14 +0200549 IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
550 f_sleep(1.0);
551 setverdict(pass);
Harald Welte09538f82019-08-01 09:50:25 +0200552}
553
554/* Replace a message that doesn't exist: failure */
555testcase TC_cbsp_replace_nonexist() runs on cbsp_test_CT {
556 var CBSP_IEs pages := {f_gen_page()};
557 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
558 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200559 f_cbsp_init_server(10001, 10501);
560 f_cbsp_replace(10, 10023, 10042, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200561 success_list:=omit, fail_list:=?);
562}
563
564/* Write more messages than can be scheduled */
565testcase TC_cbsp_write_too_many() runs on cbsp_test_CT {
566 /* repeating three pages at an interval of 1 is impossible */
567 var CBSP_IEs pages := {f_gen_page(), f_gen_page(), f_gen_page()};
568 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
569 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200570 f_cbsp_init_server(11001, 11501);
571 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, rep_period:=1, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200572 success_list:=omit, fail_list:=?);
573}
574
575/* Kill message that doesn't exist: failure */
576testcase TC_cbsp_kill_nonexist() runs on cbsp_test_CT {
577 var CBSP_IEs pages := {f_gen_page()};
578 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
579 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200580 f_cbsp_init_server(12001, 12501);
581 f_cbsp_kill(g_cbsp_msg_id, g_cbsp_ser_no, 0, cell_list, success_list:=omit, fail_list:=?);
Harald Welte09538f82019-08-01 09:50:25 +0200582}
583/* Write a message, then kill it */
584testcase TC_cbsp_write_then_kill() runs on cbsp_test_CT {
585 var CBSP_IEs pages := {f_gen_page()};
586 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
587 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200588 f_cbsp_init_server(13001, 13501);
589 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages, success_list:=?, fail_list:=omit);
590 f_cbsp_kill(g_cbsp_msg_id, g_cbsp_ser_no, 0, cell_list, success_list:=?, fail_list:=omit);
Harald Welte09538f82019-08-01 09:50:25 +0200591}
592
593/* Write a message, then reset all messages */
594testcase TC_cbsp_write_then_reset() runs on cbsp_test_CT {
595 var CBSP_IEs pages := {f_gen_page()};
596 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
597 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200598 f_cbsp_init_server(14001, 14501);
599 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages, success_list:=?, fail_list:=omit);
Harald Welte09538f82019-08-01 09:50:25 +0200600 f_cbsp_reset_bss(0);
601}
602
Harald Welte187f7a92019-09-05 11:15:20 +0200603private const octetstring c_ETWS_sec_default :=
604 '00000000000000000000000000000000000000000000000000'O &
605 '00000000000000000000000000000000000000000000000000'O;
606function f_gen_etws_pn(uint16_t ser_nr, uint16_t msg_id, OCT2 msg_type := '0780'O,
607 octetstring sec_inf := c_ETWS_sec_default) return octetstring {
608 return int2oct(ser_nr, 2) & int2oct(msg_id, 2) & msg_type & sec_inf;
609}
610
611/* Write ETWS PN to single BTS; verify it arrives on DCHAN */
612testcase TC_cbsp_emerg_write_bts_cgi_dchan() runs on cbsp_test_CT {
613 var CBSP_IEs pages := {f_gen_page()};
614 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
615 var ASP_RSL_Unitdata rx_rsl_ud;
616
617 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200618 f_cbsp_init_server(15001, 15501);
Harald Welte187f7a92019-09-05 11:15:20 +0200619
620 /* first establish a dedicated channel */
621 var DchanTuple dt := f_est_dchan('23'O, 23, '00010203040506'O);
622
623 /* then send ETWS PN */
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200624 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
625 var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_msg_id, g_cbsp_ser_no);
Harald Welte187f7a92019-09-05 11:15:20 +0200626 timer T := 5.0;
627 T.start;
628 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700629 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(dt.rsl_chan_nr, ?, ?))) -> value rx_rsl_ud {
Harald Welte187f7a92019-09-05 11:15:20 +0200630 var RSL_IE_Body l3_ie;
631 if (f_rsl_find_ie(rx_rsl_ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) {
632 setverdict(fail, "RSL DATA REQ without L3?");
633 mtc.stop;
634 }
635 var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload);
636 var template (present) APDU_Flags_V tr_flags := {
637 lastSeg := '0'B,
638 firstSeg := '0'B,
639 cR := '0'B,
640 spare := '0'B
641 };
642 if (match(l3, tr_RR_APP_INFO('0001'B, tr_apdu, tr_flags))) {
643 setverdict(pass);
644 }
645 }
646 [] IPA_RSL[0].receive { repeat; }
647 [] T.timeout {
648 setverdict(fail, "Waiting for APP INFO");
649 }
650 }
651}
652
Harald Welte0b5e0f92019-09-07 08:30:25 +0200653/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
654testcase TC_cbsp_emerg_write_bts_cgi_cchan() runs on cbsp_test_CT {
655 var CBSP_IEs pages := {f_gen_page()};
656 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
657 var ASP_RSL_Unitdata rx_rsl_ud;
658
659 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200660 f_cbsp_init_server(16001, 16501);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200661
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200662 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
663 var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_msg_id, g_cbsp_ser_no);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200664 timer T := 5.0;
665 T.start;
666 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700667 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200668 setverdict(pass);
669 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700670 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200671 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200672 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200673 }
674 [] IPA_RSL[0].receive { repeat; }
675 [] T.timeout {
676 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200677 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200678 }
679 }
680}
681
682/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
683testcase TC_cbsp_emerg_write_bts_cgi_cchan_disable() runs on cbsp_test_CT {
684 var CBSP_IEs pages := {f_gen_page()};
685 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
686 var ASP_RSL_Unitdata rx_rsl_ud;
687
688 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200689 f_cbsp_init_server(17001, 17501);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200690
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200691 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200692
693 /* first expect the PN to be enabled */
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200694 var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_msg_id, g_cbsp_ser_no);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200695 timer T := 5.0;
696 T.start;
697 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700698 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200699 setverdict(pass);
700 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700701 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200702 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200703 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200704 }
705 [] IPA_RSL[0].receive { repeat; }
706 [] T.timeout {
707 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (enable)");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200708 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200709 }
710 }
711
712 /* then expect it to be disabled after the warning period (5s) */
713 T.start;
714 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700715 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), ''O))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200716 setverdict(pass);
717 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700718 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200719 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200720 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200721 }
722 [] IPA_RSL[0].receive { repeat; }
723 [] T.timeout {
724 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (disable)");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200725 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200726 }
727 }
728}
729
730
Harald Welte187f7a92019-09-05 11:15:20 +0200731
Harald Welte09538f82019-08-01 09:50:25 +0200732control {
733 execute( TC_cbsp_bsc_server() );
734 execute( TC_cbsp_bsc_client() );
735 execute( TC_cbsp_reset_bss() );
736
737 /* test various different types of Cell Identities */
738 execute( TC_cbsp_write_bss() );
739 execute( TC_cbsp_write_bts_cgi() );
740 execute( TC_cbsp_write_bts_no_cbch() );
741 execute( TC_cbsp_write_unknown_bts() );
742 execute( TC_cbsp_write_lac_ci() );
743 execute( TC_cbsp_write_ci() );
744 execute( TC_cbsp_write_lai() );
745 execute( TC_cbsp_write_lac() );
746
747 execute( TC_cbsp_write_then_replace() );
748 execute( TC_cbsp_replace_nonexist() );
749 execute( TC_cbsp_write_too_many() );
750 execute( TC_cbsp_kill_nonexist() );
751 execute( TC_cbsp_write_then_kill() );
752 execute( TC_cbsp_write_then_reset() );
Harald Welte187f7a92019-09-05 11:15:20 +0200753
754 execute( TC_cbsp_emerg_write_bts_cgi_dchan() );
Harald Welte0b5e0f92019-09-07 08:30:25 +0200755 execute( TC_cbsp_emerg_write_bts_cgi_cchan() );
756 execute( TC_cbsp_emerg_write_bts_cgi_cchan_disable() );
Harald Welte09538f82019-08-01 09:50:25 +0200757}
758
759
760}