blob: 497ff808bba7536e5dd67f6d8a2c9ba34872ad14 [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);
Neels Hofmeyrff8a9f22020-08-13 16:06:11 +0000142
143 f_cbsp_reset_bss(0);
Harald Welte09538f82019-08-01 09:50:25 +0200144}
Neels Hofmeyr90a07522020-07-29 01:22:11 +0200145private function f_expect_cbsp_restart() runs on cbsp_test_CT {
Harald Welte09538f82019-08-01 09:50:25 +0200146 interleave {
147 [] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_CBS, CBSP_RI_DATA_LOST)));
148 /* should we also expect a restart for emergency related messages? */
149 //[] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_EMERG, CBSP_RI_DATA_LOST)));
150 }
151}
152
Neels Hofmeyr4c365322020-07-29 00:36:37 +0200153/* Generate a CBSP payload: random size for payload_len == 0, or specific fixed size for payload_len > 0. */
154function f_gen_page(integer payload_len := 0) return CBSP_IE {
155 if (payload_len < 1) {
156 /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page:
157 * the maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero
158 * length). Note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
159 payload_len := 1 + f_rnd_int(82);
160 }
161 log("Generating CBSP payload: ", payload_len, " octets");
162 var octetstring payload := f_rnd_octstring(payload_len);
163 return valueof(ts_CbspMsgContent(payload, payload_len));
Harald Welte09538f82019-08-01 09:50:25 +0200164}
165
Neels Hofmeyrff8a9f22020-08-13 16:06:11 +0000166function f_cbsp_reset_bss(integer idx) runs on cbsp_test_CT {
167 /* Make sure no CBSP ETWS commands from a previous CBSP test remain in the RSL queue */
168 IPA_RSL[0].clear;
169 IPA_RSL[1].clear;
170 IPA_RSL[2].clear;
171
Harald Welte09538f82019-08-01 09:50:25 +0200172 var template (value) CBSP_PDU tx;
173 timer T := 3.0;
174 tx := ts_CBSP_RESET(cell_list := ts_BSSMAP_CIL_BSS);
175 CBSP[idx].clear;
176 CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx));
177 T.start;
178 alt {
179 [] CBSP[idx].receive(tr_CBSP_Recv(?, tr_CBSP_RESET_COMPL(cell_list := ts_BSSMAP_CIL_BSS)));
180 [] CBSP[idx].receive {
181 setverdict(fail, "received unexpected CBSP");
182 mtc.stop;
183 }
184 [] T.timeout {
185 setverdict(fail, "timeout waiting for RESET COMPLETE");
186 mtc.stop;
187 }
188 }
189}
190
191/* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
Harald Welte187f7a92019-09-05 11:15:20 +0200192function f_cbsp_write_emerg(uint16_t msg_id, uint16_t ser_no,
193 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
194 template (value) uint8_t emerg_ind := 1,
195 template (value) uint16_t warn_type := oct2int('0780'O),
196 template (value) uint16_t warn_per := 5,
197 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
198 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
199 var template (value) CBSP_PDU tx;
200 var template CBSP_PDU rx;
201 var CBSP_IEs pages := {f_gen_page()};
202
203 tx := ts_CBSP_WRITE_EMERG(msg_id, ser_no, cell_list, emerg_ind, warn_type, warn_per);
204 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
205 if (istemplatekind(fail_list, "omit")) {
206 rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, omit);
207 } else {
208 rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, omit);
209 }
210 alt {
211 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
212 setverdict(pass);
213 }
214 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
215 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200216 mtc.stop;
Harald Welte187f7a92019-09-05 11:15:20 +0200217 }
218 }
219}
220
221/* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
Harald Welte09538f82019-08-01 09:50:25 +0200222function f_cbsp_write(uint16_t msg_id, uint16_t ser_no,
223 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
224 template (value) CBSP_Category category := CBSP_CATEG_NORMAL,
225 uint16_t rep_period := 10, uint16_t num_bcast_req := 1,
226 uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content,
227 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
228 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
229 var template (value) CBSP_PDU tx;
230 var template CBSP_PDU rx;
Harald Welte09538f82019-08-01 09:50:25 +0200231
232 tx := ts_CBSP_WRITE_CBS(msg_id, ser_no, cell_list, channel_ind, category,
233 rep_period, num_bcast_req, dcs, content);
234 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
235 if (istemplatekind(fail_list, "omit")) {
236 rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, channel_ind);
237 } else {
238 rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, channel_ind);
239 }
240 alt {
241 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
242 setverdict(pass);
243 }
244 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
245 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200246 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200247 }
248 }
249}
250
251/* send a REPLACE CBS to the BSC; expect either COMPLETE or FAILURE in response*/
252function f_cbsp_replace(uint16_t msg_id, uint16_t new_ser_no, uint16_t old_ser_no,
253 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
254 template (value) CBSP_Category category := CBSP_CATEG_NORMAL,
255 uint16_t rep_period := 10, uint16_t num_bcast_req := 1,
256 uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content,
257 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
258 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT {
259 var template (value) CBSP_PDU tx;
260 var template CBSP_PDU rx;
Harald Welte09538f82019-08-01 09:50:25 +0200261
262 tx := ts_CBSP_REPLACE_CBS(msg_id, new_ser_no, old_ser_no, cell_list, channel_ind, category,
263 rep_period, num_bcast_req, dcs, content);
264 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
265 if (istemplatekind(fail_list, "omit")) {
266 rx := tr_CBSP_REPLACE_CBS_COMPL(msg_id, new_ser_no, old_ser_no, ?, success_list,
267 channel_ind);
268 } else {
269 rx := tr_CBSP_REPLACE_CBS_FAIL(msg_id, new_ser_no, old_ser_no, fail_list, *, success_list,
270 channel_ind);
271 }
272 alt {
273 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
274 setverdict(pass);
275 }
276 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
277 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200278 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200279 }
280 }
281}
282/* send a KILL CBS to the BSC; expect either COMPLETE or FAILURE in response*/
283function f_cbsp_kill(uint16_t msg_id, uint16_t ser_no, template (omit) uint8_t channel_ind := 0,
284 template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS,
285 template BSSMAP_FIELD_CellIdentificationList success_list := ?,
286 template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT
287{
288 var template (value) CBSP_PDU tx;
289 var template CBSP_PDU rx;
290
291 tx := ts_CBSP_KILL(msg_id, ser_no, cell_list, channel_ind);
292 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
293 if (istemplatekind(fail_list, "omit")) {
294 rx := tr_CBSP_KILL_COMPL(msg_id, ser_no, compl_list:=*, cell_list:=success_list,
295 channel_ind:=channel_ind);
296 } else {
297 rx := tr_CBSP_KILL_FAIL(msg_id, ser_no, fail_list, compl_list:=*, cell_list:=success_list,
298 channel_ind:=channel_ind);
299 }
300 alt {
301 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) {
302 setverdict(pass);
303 }
304 [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) {
305 setverdict(fail, "Received unexpected CBSP");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200306 mtc.stop;
Harald Welte09538f82019-08-01 09:50:25 +0200307 }
308 }
309}
310
Harald Welte09538f82019-08-01 09:50:25 +0200311template (present) RSL_IE_CbCommandType
312tr_RslCbCmdType(template (present) uint2_t lblock := ?, template (present) RSL_CbCommand cmd := ?) := {
313 command := cmd,
314 default_bcast_null := ?,
315 spare := ?,
316 last_block := lblock
317}
318
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200319/* translate blocks count to RSL_CB_CMD_LASTBLOCK_1..4 values */
320private function f_cbsp_block_count_enc(integer num_blocks) return integer
321{
322 if (num_blocks < 1 or num_blocks > 4) {
323 setverdict(fail, "Invalid num_blocks: ", num_blocks);
324 mtc.stop;
325 }
326 if (num_blocks == 4) {
327 return 0;
328 }
329 return num_blocks;
330}
331
Harald Welte09538f82019-08-01 09:50:25 +0200332/* build a RSL_Message receive template from a CBSP page */
Neels Hofmeyr63e2e182020-08-12 11:42:01 +0000333private function f_page2rsl(CBSP_IE page, uint16_t msg_id, uint16_t ser_no, boolean ext_cbch := false,
334 template (present) integer expect_blocks := ?)
Harald Welte09538f82019-08-01 09:50:25 +0200335return template (present) RSL_Message
336{
337 var template RSL_Message tr;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200338 var integer len;
339 var integer num_blocks;
Harald Welte09538f82019-08-01 09:50:25 +0200340 var octetstring payload;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200341
Harald Welte09538f82019-08-01 09:50:25 +0200342 payload := int2oct(ser_no, 2) & int2oct(msg_id, 2) & '0011'O & page.body.msg_content.val;
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200343 len := lengthof(payload);
344 num_blocks := len / 22;
345 if (len mod 22 > 0) {
346 num_blocks := num_blocks + 1;
347 }
348
Neels Hofmeyr63e2e182020-08-12 11:42:01 +0000349 if (not istemplatekind(expect_blocks, "omit") and not match(num_blocks, expect_blocks)) {
350 setverdict(fail, "mismatch: CBSP page expect_blocks == ", expect_blocks, ", but generated num_blocks == ", num_blocks);
351 mtc.stop;
352 }
353
Neels Hofmeyrdf659512020-07-29 00:41:42 +0200354 var integer lblock := f_cbsp_block_count_enc(num_blocks);
355
Harald Welte09538f82019-08-01 09:50:25 +0200356 tr := tr_RSL_SMSCB_CMD(tr_RslCbCmdType(lblock), f_pad_oct(payload, 88, '00'O));
357 if (ext_cbch) {
358 tr.ies[3] := tr_RSL_IE(RSL_IE_Body:{smscb_chan_ind := 1});
359 tr.ies[4] := *;
360 }
361 return tr;
362}
363
364/***********************************************************************
365 * Test Cases
366 ***********************************************************************/
367
368/* Test if BSC (server) accepts connections from CBC (client) */
369testcase TC_cbsp_bsc_server() runs on cbsp_test_CT {
370 f_cbsp_init_client();
371 setverdict(pass);
372}
373
374/* Test if BSC (client) is connecting to CBC (server) */
375testcase TC_cbsp_bsc_client() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200376 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200377 setverdict(pass);
378}
379
380/* Test if a BSS-global RESET is executed successfully */
381testcase TC_cbsp_reset_bss() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200382 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200383
384 f_cbsp_reset_bss(0);
385 setverdict(pass);
386}
387
388testcase TC_cbsp_write() runs on cbsp_test_CT {
389 var template (value) CBSP_PDU tx;
390 var CBSP_IEs pages := {f_gen_page()};
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200391 f_cbsp_init_server(0, 0);
Harald Welte09538f82019-08-01 09:50:25 +0200392
393 tx := ts_CBSP_WRITE_CBS(msg_id:=23, new_ser_nr:=42, cell_list:=ts_BSSMAP_CIL_BSS,
394 channel_ind:=0, category:=CBSP_CATEG_NORMAL,
395 rep_period:=10, num_bcast_req:=1, dcs := 0,
396 content:=pages);
397
398 CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx));
399 f_sleep(10.0);
400}
401
402/* Write to entire BSS; three cells succeed; one fails (no CBCH) */
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200403function f_tc_cbsp_write_bss(integer payload_len := -1, template (present) integer expect_blocks) runs on cbsp_test_CT {
404 var CBSP_IEs pages := {f_gen_page(payload_len := payload_len)};
Harald Welte09538f82019-08-01 09:50:25 +0200405 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
406 cell_list := ts_BSSMAP_CIL_BSS;
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200407 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200408 success_list:=tr_BSSMAP_CIL_CGI({?,?,?}), fail_list:={?});
409
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200410 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 +0200411 log("RSL[0,1,2] EXPECTING ", tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200412 interleave {
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200413 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[0]"); }
414 [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[1]"); }
415 [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[2]"); }
Harald Welte09538f82019-08-01 09:50:25 +0200416 }
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200417 setverdict(pass);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200418
419 /* Make the next test run (if any) use different msg_id and ser_no */
420 f_g_cbsp_next_msg_id_ser_no();
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200421}
422testcase TC_cbsp_write_bss() runs on cbsp_test_CT {
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200423 f_cbsp_init_server(1001, 1501, guard_timeout := 60.0);
Neels Hofmeyra16afdc2020-07-29 00:57:27 +0200424 /* In the SMSCB message, there is a head followed by payload,
425 * and the resulting data is segmented in blocks of 22 octets (<= 4 blocks).
426 *
427 * [head][...payload....]|[....................]|[....................]|[....................]
428 * 0 |16 |38 |60 |82
429 * 0 5 |22 |44 |66 |88
430 *
431 * blocks count: 1 | 2 | 3 | 4
432 * payload octets count: 1..16 | 17..38 | 39..60 | 61..82
433 */
434 f_tc_cbsp_write_bss(payload_len := 1, expect_blocks := 1);
435 f_tc_cbsp_write_bss(payload_len := 2, expect_blocks := 1);
436 f_tc_cbsp_write_bss(payload_len := 16, expect_blocks := 1);
437 f_tc_cbsp_write_bss(payload_len := 17, expect_blocks := 2);
438 f_tc_cbsp_write_bss(payload_len := 23, expect_blocks := 2);
439 f_tc_cbsp_write_bss(payload_len := 38, expect_blocks := 2);
440 f_tc_cbsp_write_bss(payload_len := 39, expect_blocks := 3);
441 f_tc_cbsp_write_bss(payload_len := 42, expect_blocks := 3);
442 f_tc_cbsp_write_bss(payload_len := 60, expect_blocks := 3);
443 f_tc_cbsp_write_bss(payload_len := 61, expect_blocks := 4);
444 f_tc_cbsp_write_bss(payload_len := 77, expect_blocks := 4);
445 f_tc_cbsp_write_bss(payload_len := 82, expect_blocks := 4);
Harald Welte09538f82019-08-01 09:50:25 +0200446}
447
448/* Write to single BTS supporting CBCH: success */
449testcase TC_cbsp_write_bts_cgi() runs on cbsp_test_CT {
450 var CBSP_IEs pages := {f_gen_page()};
451 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
452 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200453 f_cbsp_init_server(2001, 2501);
454 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200455 success_list:=cell_list, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200456 var template RSL_Message tr := f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no);
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +0700457 IPA_RSL[0].receive(tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200458 f_sleep(5.0);
459}
460
461/* Write to single BTS not supporting CBCH: failure */
462testcase TC_cbsp_write_bts_no_cbch() runs on cbsp_test_CT {
463 var CBSP_IEs pages := {f_gen_page()};
464 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
465 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts3)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200466 f_cbsp_init_server(3001, 3501);
467 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200468 success_list:=omit, fail_list:={?});
469 f_sleep(5.0);
470}
471
472/* Write to single non-existant BTS */
473testcase TC_cbsp_write_unknown_bts() runs on cbsp_test_CT {
474 var CBSP_IEs pages := {f_gen_page()};
475 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
476 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 +0200477 f_cbsp_init_server(4001, 4501);
478 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200479 success_list:=omit, fail_list:={?});
480 f_sleep(5.0);
481}
482
483/* Write to single BTS using LAC+CI */
484testcase TC_cbsp_write_lac_ci() runs on cbsp_test_CT {
485 var CBSP_IEs pages := {f_gen_page()};
486 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
487 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200488 f_cbsp_init_server(5001, 5501);
489 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200490 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200491 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 +0200492 f_sleep(5.0);
493}
494
495/* Write to single BTS using CI */
496testcase TC_cbsp_write_ci() runs on cbsp_test_CT {
497 var CBSP_IEs pages := {f_gen_page()};
498 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
499 cell_list := ts_BSSMAP_CIL_CI({bssmap_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200500 f_cbsp_init_server(6001, 6501);
501 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200502 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200503 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 +0200504 f_sleep(5.0);
505}
506
507/* Write to single BTS using LAI */
508testcase TC_cbsp_write_lai() runs on cbsp_test_CT {
509 var CBSP_IEs pages := {f_gen_page()};
510 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
Neels Hofmeyrf5148482020-07-31 16:56:02 +0200511 /* bts0 and bts1 have the same LAI (only differ in cell identity).
512 * bts2 and bts3 also have the same LAI, but only bts2 has a CBCH.
513 * Target only bts2.
514 */
515 cell_list := ts_BSSMAP_CIL_LAI({bssmap_lai(mp_cgi_bts2)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200516 f_cbsp_init_server(7001, 7501);
517 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200518 success_list:=?, fail_list:=omit);
Neels Hofmeyrf5148482020-07-31 16:56:02 +0200519 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 +0200520 f_sleep(5.0);
521}
522
523/* Write to two BTS using LAC */
524testcase TC_cbsp_write_lac() runs on cbsp_test_CT {
525 var CBSP_IEs pages := {f_gen_page()};
526 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
527 cell_list := ts_BSSMAP_CIL_LAC({bssmap_lac(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200528 f_cbsp_init_server(8001, 8501);
529 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200530 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200531 var template RSL_Message tr := f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no);
Harald Welte09538f82019-08-01 09:50:25 +0200532 interleave {
Vadim Yanitskiyca5c5202020-05-25 22:03:28 +0700533 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr));
534 [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr));
Harald Welte09538f82019-08-01 09:50:25 +0200535 }
536 f_sleep(5.0);
537}
538
539/* Write a message, then replace it */
540testcase TC_cbsp_write_then_replace() runs on cbsp_test_CT {
541 var CBSP_IEs pages := {f_gen_page()};
542 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
543 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200544 f_cbsp_init_server(9001, 9501);
545 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 +0200546 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200547
Neels Hofmeyr62d5da32020-07-31 16:56:14 +0200548 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 +0200549
550 /* Replace: keep the same msg_id, use a new ser_no */
551 var uint16_t old_ser_no := g_cbsp_ser_no;
552 g_cbsp_ser_no := g_cbsp_ser_no + 1;
553 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 +0200554 success_list:=?, fail_list:=omit);
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200555
Neels Hofmeyr62d5da32020-07-31 16:56:14 +0200556 IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], g_cbsp_msg_id, g_cbsp_ser_no)));
557 f_sleep(1.0);
558 setverdict(pass);
Harald Welte09538f82019-08-01 09:50:25 +0200559}
560
561/* Replace a message that doesn't exist: failure */
562testcase TC_cbsp_replace_nonexist() runs on cbsp_test_CT {
563 var CBSP_IEs pages := {f_gen_page()};
564 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
565 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200566 f_cbsp_init_server(10001, 10501);
567 f_cbsp_replace(10, 10023, 10042, cell_list, content:=pages,
Harald Welte09538f82019-08-01 09:50:25 +0200568 success_list:=omit, fail_list:=?);
569}
570
571/* Write more messages than can be scheduled */
572testcase TC_cbsp_write_too_many() runs on cbsp_test_CT {
573 /* repeating three pages at an interval of 1 is impossible */
574 var CBSP_IEs pages := {f_gen_page(), f_gen_page(), f_gen_page()};
575 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
576 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200577 f_cbsp_init_server(11001, 11501);
578 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 +0200579 success_list:=omit, fail_list:=?);
580}
581
582/* Kill message that doesn't exist: failure */
583testcase TC_cbsp_kill_nonexist() runs on cbsp_test_CT {
584 var CBSP_IEs pages := {f_gen_page()};
585 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
586 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200587 f_cbsp_init_server(12001, 12501);
588 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 +0200589}
590/* Write a message, then kill it */
591testcase TC_cbsp_write_then_kill() runs on cbsp_test_CT {
592 var CBSP_IEs pages := {f_gen_page()};
593 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
594 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200595 f_cbsp_init_server(13001, 13501);
596 f_cbsp_write(g_cbsp_msg_id, g_cbsp_ser_no, cell_list, content:=pages, success_list:=?, fail_list:=omit);
597 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 +0200598}
599
600/* Write a message, then reset all messages */
601testcase TC_cbsp_write_then_reset() runs on cbsp_test_CT {
602 var CBSP_IEs pages := {f_gen_page()};
603 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
604 cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200605 f_cbsp_init_server(14001, 14501);
606 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 +0200607 f_cbsp_reset_bss(0);
608}
609
Harald Welte187f7a92019-09-05 11:15:20 +0200610private const octetstring c_ETWS_sec_default :=
611 '00000000000000000000000000000000000000000000000000'O &
612 '00000000000000000000000000000000000000000000000000'O;
613function f_gen_etws_pn(uint16_t ser_nr, uint16_t msg_id, OCT2 msg_type := '0780'O,
614 octetstring sec_inf := c_ETWS_sec_default) return octetstring {
615 return int2oct(ser_nr, 2) & int2oct(msg_id, 2) & msg_type & sec_inf;
616}
617
618/* Write ETWS PN to single BTS; verify it arrives on DCHAN */
619testcase TC_cbsp_emerg_write_bts_cgi_dchan() runs on cbsp_test_CT {
620 var CBSP_IEs pages := {f_gen_page()};
621 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
622 var ASP_RSL_Unitdata rx_rsl_ud;
623
624 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200625 f_cbsp_init_server(15001, 15501);
Harald Welte187f7a92019-09-05 11:15:20 +0200626
627 /* first establish a dedicated channel */
628 var DchanTuple dt := f_est_dchan('23'O, 23, '00010203040506'O);
629
630 /* then send ETWS PN */
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200631 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
632 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 +0200633 timer T := 5.0;
634 T.start;
635 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700636 [] 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 +0200637 var RSL_IE_Body l3_ie;
638 if (f_rsl_find_ie(rx_rsl_ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) {
639 setverdict(fail, "RSL DATA REQ without L3?");
640 mtc.stop;
641 }
642 var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload);
643 var template (present) APDU_Flags_V tr_flags := {
644 lastSeg := '0'B,
645 firstSeg := '0'B,
646 cR := '0'B,
647 spare := '0'B
648 };
649 if (match(l3, tr_RR_APP_INFO('0001'B, tr_apdu, tr_flags))) {
650 setverdict(pass);
651 }
652 }
653 [] IPA_RSL[0].receive { repeat; }
654 [] T.timeout {
655 setverdict(fail, "Waiting for APP INFO");
656 }
657 }
658}
659
Harald Welte0b5e0f92019-09-07 08:30:25 +0200660/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
661testcase TC_cbsp_emerg_write_bts_cgi_cchan() runs on cbsp_test_CT {
662 var CBSP_IEs pages := {f_gen_page()};
663 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
664 var ASP_RSL_Unitdata rx_rsl_ud;
665
666 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200667 f_cbsp_init_server(16001, 16501);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200668
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200669 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
Neels Hofmeyrfbaca3f2020-08-13 13:57:43 +0000670 var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_ser_no, g_cbsp_msg_id);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200671 timer T := 5.0;
672 T.start;
673 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700674 [] 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 +0200675 setverdict(pass);
676 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700677 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200678 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200679 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200680 }
681 [] IPA_RSL[0].receive { repeat; }
682 [] T.timeout {
683 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200684 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200685 }
686 }
687}
688
689/* Write ETWS PN to single BTS; verify it arrives on CCHAN */
690testcase TC_cbsp_emerg_write_bts_cgi_cchan_disable() runs on cbsp_test_CT {
691 var CBSP_IEs pages := {f_gen_page()};
692 var template (value) BSSMAP_FIELD_CellIdentificationList cell_list;
693 var ASP_RSL_Unitdata rx_rsl_ud;
694
695 cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)});
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200696 f_cbsp_init_server(17001, 17501);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200697
Neels Hofmeyr4e63a012020-07-31 14:29:43 +0200698 f_cbsp_write_emerg(g_cbsp_msg_id, g_cbsp_ser_no, cell_list);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200699
700 /* first expect the PN to be enabled */
Neels Hofmeyrfbaca3f2020-08-13 13:57:43 +0000701 var template (present) octetstring tr_apdu := f_gen_etws_pn(g_cbsp_ser_no, g_cbsp_msg_id);
Harald Welte0b5e0f92019-09-07 08:30:25 +0200702 timer T := 5.0;
703 T.start;
704 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700705 [] 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 +0200706 setverdict(pass);
707 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700708 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200709 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200710 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200711 }
712 [] IPA_RSL[0].receive { repeat; }
713 [] T.timeout {
714 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (enable)");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200715 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200716 }
717 }
718
719 /* then expect it to be disabled after the warning period (5s) */
720 T.start;
721 alt {
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700722 [] 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 +0200723 setverdict(pass);
724 }
Vadim Yanitskiy9b4e3562020-05-25 21:40:52 +0700725 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) {
Harald Welte0b5e0f92019-09-07 08:30:25 +0200726 setverdict(fail, "Received unexpected OSMO_ETWS_CMD");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200727 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200728 }
729 [] IPA_RSL[0].receive { repeat; }
730 [] T.timeout {
731 setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (disable)");
Neels Hofmeyree3b9272020-07-28 21:20:15 +0200732 mtc.stop;
Harald Welte0b5e0f92019-09-07 08:30:25 +0200733 }
734 }
735}
736
737
Harald Welte187f7a92019-09-05 11:15:20 +0200738
Harald Welte09538f82019-08-01 09:50:25 +0200739control {
740 execute( TC_cbsp_bsc_server() );
741 execute( TC_cbsp_bsc_client() );
742 execute( TC_cbsp_reset_bss() );
743
744 /* test various different types of Cell Identities */
745 execute( TC_cbsp_write_bss() );
746 execute( TC_cbsp_write_bts_cgi() );
747 execute( TC_cbsp_write_bts_no_cbch() );
748 execute( TC_cbsp_write_unknown_bts() );
749 execute( TC_cbsp_write_lac_ci() );
750 execute( TC_cbsp_write_ci() );
751 execute( TC_cbsp_write_lai() );
752 execute( TC_cbsp_write_lac() );
753
754 execute( TC_cbsp_write_then_replace() );
755 execute( TC_cbsp_replace_nonexist() );
756 execute( TC_cbsp_write_too_many() );
757 execute( TC_cbsp_kill_nonexist() );
758 execute( TC_cbsp_write_then_kill() );
759 execute( TC_cbsp_write_then_reset() );
Harald Welte187f7a92019-09-05 11:15:20 +0200760
761 execute( TC_cbsp_emerg_write_bts_cgi_dchan() );
Harald Welte0b5e0f92019-09-07 08:30:25 +0200762 execute( TC_cbsp_emerg_write_bts_cgi_cchan() );
763 execute( TC_cbsp_emerg_write_bts_cgi_cchan_disable() );
Harald Welte09538f82019-08-01 09:50:25 +0200764}
765
766
767}