Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 1 | module 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 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | import from GSM_Types all; |
| 18 | import from IPL4asp_Types all; |
| 19 | import from BSSAP_Types all; |
| 20 | import from BSSMAP_Templates all; |
| 21 | |
| 22 | import from BSC_Tests all; |
| 23 | |
| 24 | import from IPA_Emulation all; |
| 25 | import from IPA_CodecPort all; |
| 26 | import from IPA_Types all; |
| 27 | |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 28 | import from MobileL3_Types all; |
| 29 | import from MobileL3_RRM_Types all; |
| 30 | import from L3_Templates all; |
| 31 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 32 | import from RSL_Types all; |
| 33 | import from RSL_Emulation all; |
| 34 | |
| 35 | import from CBSP_Types all; |
| 36 | import from CBSP_Templates all; |
| 37 | import from CBSP_Adapter all; |
| 38 | import from CBSP_CodecPort all; |
| 39 | |
| 40 | modulepar { |
| 41 | charstring mp_cbc_ip := "0.0.0.0"; |
| 42 | integer mp_cbc_port := 48049; |
| 43 | integer mp_bsc_cbsp_port := 48050; |
| 44 | |
Harald Welte | 49a61e6 | 2020-03-30 20:13:32 +0200 | [diff] [blame] | 45 | /* 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 Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | private type record GsmCgiAbstract { |
| 56 | GsmMcc mcc, |
| 57 | GsmMnc mnc, |
| 58 | GsmLac lac, |
| 59 | GsmCellId ci |
| 60 | }; |
| 61 | private template (value) BSSMAP_FIELD_CellIdentification_CGI bssmap_cgi(GsmCgiAbstract cgi) := |
| 62 | ts_BSSMAP_CI_CGI(cgi.mcc, cgi.mnc, cgi.lac, cgi.ci); |
| 63 | private template (value) BSSMAP_FIELD_CellIdentification_LAC_CI bssmap_lac_ci(GsmCgiAbstract cgi) := |
| 64 | ts_BSSMAP_CI_LAC_CI(cgi.lac, cgi.ci); |
| 65 | private template (value) BSSMAP_FIELD_CellIdentification_LAI bssmap_lai(GsmCgiAbstract cgi) := |
| 66 | ts_BSSMAP_CI_LAI(cgi.mcc, cgi.mnc, cgi.lac); |
| 67 | private template (value) OCT2 bssmap_lac(GsmCgiAbstract cgi) := ts_BSSMAP_CI_LAC(cgi.lac); |
| 68 | private template (value) OCT2 bssmap_ci(GsmCgiAbstract cgi) := ts_BSSMAP_CI_CI(cgi.ci); |
| 69 | |
| 70 | type component cbsp_test_CT extends test_CT, CBSP_Adapter_CT { |
| 71 | } |
| 72 | |
| 73 | private altstep as_IgnRSL(template RSL_Message tr) runs on cbsp_test_CT { |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 74 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { repeat; } |
| 75 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { repeat; } |
| 76 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { repeat; } |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | private altstep as_FailRSL() runs on cbsp_test_CT { |
| 80 | var template RSL_Message tr := (tr_RSL_SMSCB_CMD); |
| 81 | var ASP_RSL_Unitdata rx; |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 82 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) -> value rx { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 83 | setverdict(fail, "Received unexpected RSL ", rx); |
| 84 | mtc.stop; |
| 85 | } |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 86 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) -> value rx { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 87 | setverdict(fail, "Received unexpected RSL ", rx); |
| 88 | mtc.stop; |
| 89 | } |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 90 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) -> value rx { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 91 | setverdict(fail, "Received unexpected RSL ", rx); |
| 92 | mtc.stop; |
| 93 | } |
| 94 | } |
| 95 | |
Neels Hofmeyr | 579bfa8 | 2020-07-29 00:33:59 +0200 | [diff] [blame] | 96 | private function f_init(float guard_timeout := 30.0) runs on cbsp_test_CT { |
| 97 | BSC_Tests.f_init(guard_timeout := guard_timeout); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 98 | activate(as_IgnRSL((tr_RSL_BCCH_INFO, tr_RSL_SACCH_FILL, |
| 99 | tr_RSL_NO_BCCH_INFO, tr_RSL_NO_SACCH_FILL, |
| 100 | tr_RSL_MsgTypeD(?)))); |
| 101 | activate(as_FailRSL()); |
| 102 | } |
| 103 | private function f_cbsp_init_client() runs on cbsp_test_CT { |
| 104 | f_init(); |
| 105 | CBSP_Adapter.f_connect(mp_bsc_ip, mp_bsc_cbsp_port, "", -1); |
Neels Hofmeyr | 289c36a | 2020-07-28 21:19:20 +0200 | [diff] [blame] | 106 | /* FIXME: osmo-bsc should probably still send a CBSP RESTART, but to get the current tests running, let's first |
| 107 | * ignore this aspect */ |
| 108 | setverdict(pass); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 109 | } |
| 110 | |
Neels Hofmeyr | 579bfa8 | 2020-07-29 00:33:59 +0200 | [diff] [blame] | 111 | private function f_cbsp_init_server(float guard_timeout := 30.0) runs on cbsp_test_CT { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 112 | var ASP_Event asp_evt; |
| 113 | timer T := 10.0; |
| 114 | |
Neels Hofmeyr | 579bfa8 | 2020-07-29 00:33:59 +0200 | [diff] [blame] | 115 | f_init(guard_timeout := guard_timeout); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 116 | CBSP_Adapter.f_bind(mp_cbc_ip, mp_cbc_port); |
| 117 | |
| 118 | T.start; |
| 119 | alt { |
| 120 | [] CBSP[0].receive(ASP_Event:{connOpened:=?}) -> value asp_evt { |
| 121 | g_cbsp_conn_id[0] := asp_evt.connOpened.connId; |
| 122 | } |
| 123 | [] T.timeout { |
| 124 | setverdict(fail, "Timeout waiting for incoming connection to CBSP Port"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 125 | mtc.stop; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 126 | } |
| 127 | } |
Neels Hofmeyr | 90a0752 | 2020-07-29 01:22:11 +0200 | [diff] [blame^] | 128 | f_expect_cbsp_restart(); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 129 | } |
Neels Hofmeyr | 90a0752 | 2020-07-29 01:22:11 +0200 | [diff] [blame^] | 130 | private function f_expect_cbsp_restart() runs on cbsp_test_CT { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 131 | interleave { |
| 132 | [] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_CBS, CBSP_RI_DATA_LOST))); |
| 133 | /* should we also expect a restart for emergency related messages? */ |
| 134 | //[] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_EMERG, CBSP_RI_DATA_LOST))); |
| 135 | } |
| 136 | } |
| 137 | |
Neels Hofmeyr | 4c36532 | 2020-07-29 00:36:37 +0200 | [diff] [blame] | 138 | /* Generate a CBSP payload: random size for payload_len == 0, or specific fixed size for payload_len > 0. */ |
| 139 | function f_gen_page(integer payload_len := 0) return CBSP_IE { |
| 140 | if (payload_len < 1) { |
| 141 | /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page: |
| 142 | * the maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero |
| 143 | * length). Note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */ |
| 144 | payload_len := 1 + f_rnd_int(82); |
| 145 | } |
| 146 | log("Generating CBSP payload: ", payload_len, " octets"); |
| 147 | var octetstring payload := f_rnd_octstring(payload_len); |
| 148 | return valueof(ts_CbspMsgContent(payload, payload_len)); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | function f_cbsp_reset_bss(integer idx) runs on CBSP_Adapter_CT { |
| 152 | var template (value) CBSP_PDU tx; |
| 153 | timer T := 3.0; |
| 154 | tx := ts_CBSP_RESET(cell_list := ts_BSSMAP_CIL_BSS); |
| 155 | CBSP[idx].clear; |
| 156 | CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx)); |
| 157 | T.start; |
| 158 | alt { |
| 159 | [] CBSP[idx].receive(tr_CBSP_Recv(?, tr_CBSP_RESET_COMPL(cell_list := ts_BSSMAP_CIL_BSS))); |
| 160 | [] CBSP[idx].receive { |
| 161 | setverdict(fail, "received unexpected CBSP"); |
| 162 | mtc.stop; |
| 163 | } |
| 164 | [] T.timeout { |
| 165 | setverdict(fail, "timeout waiting for RESET COMPLETE"); |
| 166 | mtc.stop; |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 172 | function f_cbsp_write_emerg(uint16_t msg_id, uint16_t ser_no, |
| 173 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 174 | template (value) uint8_t emerg_ind := 1, |
| 175 | template (value) uint16_t warn_type := oct2int('0780'O), |
| 176 | template (value) uint16_t warn_per := 5, |
| 177 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 178 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT { |
| 179 | var template (value) CBSP_PDU tx; |
| 180 | var template CBSP_PDU rx; |
| 181 | var CBSP_IEs pages := {f_gen_page()}; |
| 182 | |
| 183 | tx := ts_CBSP_WRITE_EMERG(msg_id, ser_no, cell_list, emerg_ind, warn_type, warn_per); |
| 184 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 185 | if (istemplatekind(fail_list, "omit")) { |
| 186 | rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, omit); |
| 187 | } else { |
| 188 | rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, omit); |
| 189 | } |
| 190 | alt { |
| 191 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 192 | setverdict(pass); |
| 193 | } |
| 194 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 195 | setverdict(fail, "Received unexpected CBSP"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 196 | mtc.stop; |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 202 | function f_cbsp_write(uint16_t msg_id, uint16_t ser_no, |
| 203 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 204 | template (value) CBSP_Category category := CBSP_CATEG_NORMAL, |
| 205 | uint16_t rep_period := 10, uint16_t num_bcast_req := 1, |
| 206 | uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content, |
| 207 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 208 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT { |
| 209 | var template (value) CBSP_PDU tx; |
| 210 | var template CBSP_PDU rx; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 211 | |
| 212 | tx := ts_CBSP_WRITE_CBS(msg_id, ser_no, cell_list, channel_ind, category, |
| 213 | rep_period, num_bcast_req, dcs, content); |
| 214 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 215 | if (istemplatekind(fail_list, "omit")) { |
| 216 | rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, channel_ind); |
| 217 | } else { |
| 218 | rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, channel_ind); |
| 219 | } |
| 220 | alt { |
| 221 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 222 | setverdict(pass); |
| 223 | } |
| 224 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 225 | setverdict(fail, "Received unexpected CBSP"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 226 | mtc.stop; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | /* send a REPLACE CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
| 232 | function f_cbsp_replace(uint16_t msg_id, uint16_t new_ser_no, uint16_t old_ser_no, |
| 233 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 234 | template (value) CBSP_Category category := CBSP_CATEG_NORMAL, |
| 235 | uint16_t rep_period := 10, uint16_t num_bcast_req := 1, |
| 236 | uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content, |
| 237 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 238 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT { |
| 239 | var template (value) CBSP_PDU tx; |
| 240 | var template CBSP_PDU rx; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 241 | |
| 242 | tx := ts_CBSP_REPLACE_CBS(msg_id, new_ser_no, old_ser_no, cell_list, channel_ind, category, |
| 243 | rep_period, num_bcast_req, dcs, content); |
| 244 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 245 | if (istemplatekind(fail_list, "omit")) { |
| 246 | rx := tr_CBSP_REPLACE_CBS_COMPL(msg_id, new_ser_no, old_ser_no, ?, success_list, |
| 247 | channel_ind); |
| 248 | } else { |
| 249 | rx := tr_CBSP_REPLACE_CBS_FAIL(msg_id, new_ser_no, old_ser_no, fail_list, *, success_list, |
| 250 | channel_ind); |
| 251 | } |
| 252 | alt { |
| 253 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 254 | setverdict(pass); |
| 255 | } |
| 256 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 257 | setverdict(fail, "Received unexpected CBSP"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 258 | mtc.stop; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 259 | } |
| 260 | } |
| 261 | } |
| 262 | /* send a KILL CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
| 263 | function f_cbsp_kill(uint16_t msg_id, uint16_t ser_no, template (omit) uint8_t channel_ind := 0, |
| 264 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 265 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 266 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT |
| 267 | { |
| 268 | var template (value) CBSP_PDU tx; |
| 269 | var template CBSP_PDU rx; |
| 270 | |
| 271 | tx := ts_CBSP_KILL(msg_id, ser_no, cell_list, channel_ind); |
| 272 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 273 | if (istemplatekind(fail_list, "omit")) { |
| 274 | rx := tr_CBSP_KILL_COMPL(msg_id, ser_no, compl_list:=*, cell_list:=success_list, |
| 275 | channel_ind:=channel_ind); |
| 276 | } else { |
| 277 | rx := tr_CBSP_KILL_FAIL(msg_id, ser_no, fail_list, compl_list:=*, cell_list:=success_list, |
| 278 | channel_ind:=channel_ind); |
| 279 | } |
| 280 | alt { |
| 281 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 282 | setverdict(pass); |
| 283 | } |
| 284 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 285 | setverdict(fail, "Received unexpected CBSP"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 286 | mtc.stop; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 291 | template (present) RSL_IE_CbCommandType |
| 292 | tr_RslCbCmdType(template (present) uint2_t lblock := ?, template (present) RSL_CbCommand cmd := ?) := { |
| 293 | command := cmd, |
| 294 | default_bcast_null := ?, |
| 295 | spare := ?, |
| 296 | last_block := lblock |
| 297 | } |
| 298 | |
Neels Hofmeyr | df65951 | 2020-07-29 00:41:42 +0200 | [diff] [blame] | 299 | /* translate blocks count to RSL_CB_CMD_LASTBLOCK_1..4 values */ |
| 300 | private function f_cbsp_block_count_enc(integer num_blocks) return integer |
| 301 | { |
| 302 | if (num_blocks < 1 or num_blocks > 4) { |
| 303 | setverdict(fail, "Invalid num_blocks: ", num_blocks); |
| 304 | mtc.stop; |
| 305 | } |
| 306 | if (num_blocks == 4) { |
| 307 | return 0; |
| 308 | } |
| 309 | return num_blocks; |
| 310 | } |
| 311 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 312 | /* build a RSL_Message receive template from a CBSP page */ |
Neels Hofmeyr | 63e2e18 | 2020-08-12 11:42:01 +0000 | [diff] [blame] | 313 | private function f_page2rsl(CBSP_IE page, uint16_t msg_id, uint16_t ser_no, boolean ext_cbch := false, |
| 314 | template (present) integer expect_blocks := ?) |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 315 | return template (present) RSL_Message |
| 316 | { |
| 317 | var template RSL_Message tr; |
Neels Hofmeyr | df65951 | 2020-07-29 00:41:42 +0200 | [diff] [blame] | 318 | var integer len; |
| 319 | var integer num_blocks; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 320 | var octetstring payload; |
Neels Hofmeyr | df65951 | 2020-07-29 00:41:42 +0200 | [diff] [blame] | 321 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 322 | payload := int2oct(ser_no, 2) & int2oct(msg_id, 2) & '0011'O & page.body.msg_content.val; |
Neels Hofmeyr | df65951 | 2020-07-29 00:41:42 +0200 | [diff] [blame] | 323 | len := lengthof(payload); |
| 324 | num_blocks := len / 22; |
| 325 | if (len mod 22 > 0) { |
| 326 | num_blocks := num_blocks + 1; |
| 327 | } |
| 328 | |
Neels Hofmeyr | 63e2e18 | 2020-08-12 11:42:01 +0000 | [diff] [blame] | 329 | if (not istemplatekind(expect_blocks, "omit") and not match(num_blocks, expect_blocks)) { |
| 330 | setverdict(fail, "mismatch: CBSP page expect_blocks == ", expect_blocks, ", but generated num_blocks == ", num_blocks); |
| 331 | mtc.stop; |
| 332 | } |
| 333 | |
Neels Hofmeyr | df65951 | 2020-07-29 00:41:42 +0200 | [diff] [blame] | 334 | var integer lblock := f_cbsp_block_count_enc(num_blocks); |
| 335 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 336 | tr := tr_RSL_SMSCB_CMD(tr_RslCbCmdType(lblock), f_pad_oct(payload, 88, '00'O)); |
| 337 | if (ext_cbch) { |
| 338 | tr.ies[3] := tr_RSL_IE(RSL_IE_Body:{smscb_chan_ind := 1}); |
| 339 | tr.ies[4] := *; |
| 340 | } |
| 341 | return tr; |
| 342 | } |
| 343 | |
| 344 | /*********************************************************************** |
| 345 | * Test Cases |
| 346 | ***********************************************************************/ |
| 347 | |
| 348 | /* Test if BSC (server) accepts connections from CBC (client) */ |
| 349 | testcase TC_cbsp_bsc_server() runs on cbsp_test_CT { |
| 350 | f_cbsp_init_client(); |
| 351 | setverdict(pass); |
| 352 | } |
| 353 | |
| 354 | /* Test if BSC (client) is connecting to CBC (server) */ |
| 355 | testcase TC_cbsp_bsc_client() runs on cbsp_test_CT { |
| 356 | f_cbsp_init_server(); |
| 357 | setverdict(pass); |
| 358 | } |
| 359 | |
| 360 | /* Test if a BSS-global RESET is executed successfully */ |
| 361 | testcase TC_cbsp_reset_bss() runs on cbsp_test_CT { |
| 362 | f_cbsp_init_server(); |
| 363 | |
| 364 | f_cbsp_reset_bss(0); |
| 365 | setverdict(pass); |
| 366 | } |
| 367 | |
| 368 | testcase TC_cbsp_write() runs on cbsp_test_CT { |
| 369 | var template (value) CBSP_PDU tx; |
| 370 | var CBSP_IEs pages := {f_gen_page()}; |
| 371 | f_cbsp_init_server(); |
| 372 | |
| 373 | tx := ts_CBSP_WRITE_CBS(msg_id:=23, new_ser_nr:=42, cell_list:=ts_BSSMAP_CIL_BSS, |
| 374 | channel_ind:=0, category:=CBSP_CATEG_NORMAL, |
| 375 | rep_period:=10, num_bcast_req:=1, dcs := 0, |
| 376 | content:=pages); |
| 377 | |
| 378 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 379 | f_sleep(10.0); |
| 380 | } |
| 381 | |
| 382 | /* Write to entire BSS; three cells succeed; one fails (no CBCH) */ |
Neels Hofmeyr | a16afdc | 2020-07-29 00:57:27 +0200 | [diff] [blame] | 383 | function f_tc_cbsp_write_bss(integer payload_len := -1, template (present) integer expect_blocks) runs on cbsp_test_CT { |
| 384 | var CBSP_IEs pages := {f_gen_page(payload_len := payload_len)}; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 385 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 386 | cell_list := ts_BSSMAP_CIL_BSS; |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 387 | f_cbsp_write(1, 1001, cell_list, content:=pages, |
| 388 | success_list:=tr_BSSMAP_CIL_CGI({?,?,?}), fail_list:={?}); |
| 389 | |
Neels Hofmeyr | a16afdc | 2020-07-29 00:57:27 +0200 | [diff] [blame] | 390 | var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001, expect_blocks := expect_blocks); |
| 391 | log("RSL[0,1,2] EXPECTING ", tr_ASP_RSL_UD(tr)); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 392 | interleave { |
Neels Hofmeyr | a16afdc | 2020-07-29 00:57:27 +0200 | [diff] [blame] | 393 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[0]"); } |
| 394 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[1]"); } |
| 395 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr)) { log("Got SMSCB CMD on RSL[2]"); } |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 396 | } |
Neels Hofmeyr | a16afdc | 2020-07-29 00:57:27 +0200 | [diff] [blame] | 397 | setverdict(pass); |
| 398 | } |
| 399 | testcase TC_cbsp_write_bss() runs on cbsp_test_CT { |
| 400 | f_cbsp_init_server(guard_timeout := 60.0); |
| 401 | /* In the SMSCB message, there is a head followed by payload, |
| 402 | * and the resulting data is segmented in blocks of 22 octets (<= 4 blocks). |
| 403 | * |
| 404 | * [head][...payload....]|[....................]|[....................]|[....................] |
| 405 | * 0 |16 |38 |60 |82 |
| 406 | * 0 5 |22 |44 |66 |88 |
| 407 | * |
| 408 | * blocks count: 1 | 2 | 3 | 4 |
| 409 | * payload octets count: 1..16 | 17..38 | 39..60 | 61..82 |
| 410 | */ |
| 411 | f_tc_cbsp_write_bss(payload_len := 1, expect_blocks := 1); |
| 412 | f_tc_cbsp_write_bss(payload_len := 2, expect_blocks := 1); |
| 413 | f_tc_cbsp_write_bss(payload_len := 16, expect_blocks := 1); |
| 414 | f_tc_cbsp_write_bss(payload_len := 17, expect_blocks := 2); |
| 415 | f_tc_cbsp_write_bss(payload_len := 23, expect_blocks := 2); |
| 416 | f_tc_cbsp_write_bss(payload_len := 38, expect_blocks := 2); |
| 417 | f_tc_cbsp_write_bss(payload_len := 39, expect_blocks := 3); |
| 418 | f_tc_cbsp_write_bss(payload_len := 42, expect_blocks := 3); |
| 419 | f_tc_cbsp_write_bss(payload_len := 60, expect_blocks := 3); |
| 420 | f_tc_cbsp_write_bss(payload_len := 61, expect_blocks := 4); |
| 421 | f_tc_cbsp_write_bss(payload_len := 77, expect_blocks := 4); |
| 422 | f_tc_cbsp_write_bss(payload_len := 82, expect_blocks := 4); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | /* Write to single BTS supporting CBCH: success */ |
| 426 | testcase TC_cbsp_write_bts_cgi() runs on cbsp_test_CT { |
| 427 | var CBSP_IEs pages := {f_gen_page()}; |
| 428 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 429 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)}); |
| 430 | f_cbsp_init_server(); |
| 431 | f_cbsp_write(2, 1002, cell_list, content:=pages, |
| 432 | success_list:=cell_list, fail_list:=omit); |
| 433 | var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001); |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 434 | IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 435 | f_sleep(5.0); |
| 436 | } |
| 437 | |
| 438 | /* Write to single BTS not supporting CBCH: failure */ |
| 439 | testcase TC_cbsp_write_bts_no_cbch() runs on cbsp_test_CT { |
| 440 | var CBSP_IEs pages := {f_gen_page()}; |
| 441 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 442 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts3)}); |
| 443 | f_cbsp_init_server(); |
| 444 | f_cbsp_write(3, 1003, cell_list, content:=pages, |
| 445 | success_list:=omit, fail_list:={?}); |
| 446 | f_sleep(5.0); |
| 447 | } |
| 448 | |
| 449 | /* Write to single non-existant BTS */ |
| 450 | testcase TC_cbsp_write_unknown_bts() runs on cbsp_test_CT { |
| 451 | var CBSP_IEs pages := {f_gen_page()}; |
| 452 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 453 | cell_list := ts_BSSMAP_CIL_CGI({ts_BSSMAP_CI_CGI(mp_cgi_bts0.mcc, mp_cgi_bts1.mnc, 22222, 33333)}); |
| 454 | f_cbsp_init_server(); |
| 455 | f_cbsp_write(4, 1004, cell_list, content:=pages, |
| 456 | success_list:=omit, fail_list:={?}); |
| 457 | f_sleep(5.0); |
| 458 | } |
| 459 | |
| 460 | /* Write to single BTS using LAC+CI */ |
| 461 | testcase TC_cbsp_write_lac_ci() runs on cbsp_test_CT { |
| 462 | var CBSP_IEs pages := {f_gen_page()}; |
| 463 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 464 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 465 | f_cbsp_init_server(); |
| 466 | f_cbsp_write(5, 1005, cell_list, content:=pages, |
| 467 | success_list:=?, fail_list:=omit); |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 468 | IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], 5, 1005))); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 469 | f_sleep(5.0); |
| 470 | } |
| 471 | |
| 472 | /* Write to single BTS using CI */ |
| 473 | testcase TC_cbsp_write_ci() 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_CI({bssmap_ci(mp_cgi_bts0)}); |
| 477 | f_cbsp_init_server(); |
| 478 | f_cbsp_write(6, 1006, cell_list, content:=pages, |
| 479 | success_list:=?, fail_list:=omit); |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 480 | IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], 6, 1006))); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 481 | f_sleep(5.0); |
| 482 | } |
| 483 | |
| 484 | /* Write to single BTS using LAI */ |
| 485 | testcase TC_cbsp_write_lai() runs on cbsp_test_CT { |
| 486 | var CBSP_IEs pages := {f_gen_page()}; |
| 487 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 488 | cell_list := ts_BSSMAP_CIL_LAI({bssmap_lai(mp_cgi_bts0)}); |
| 489 | f_cbsp_init_server(); |
| 490 | f_cbsp_write(7, 1007, cell_list, content:=pages, |
| 491 | success_list:=?, fail_list:=omit); |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 492 | IPA_RSL[0].receive(tr_ASP_RSL_UD(f_page2rsl(pages[0], 7, 1007))); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 493 | f_sleep(5.0); |
| 494 | } |
| 495 | |
| 496 | /* Write to two BTS using LAC */ |
| 497 | testcase TC_cbsp_write_lac() runs on cbsp_test_CT { |
| 498 | var CBSP_IEs pages := {f_gen_page()}; |
| 499 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 500 | cell_list := ts_BSSMAP_CIL_LAC({bssmap_lac(mp_cgi_bts0)}); |
| 501 | f_cbsp_init_server(); |
| 502 | f_cbsp_write(8, 1008, cell_list, content:=pages, |
| 503 | success_list:=?, fail_list:=omit); |
| 504 | var template RSL_Message tr := f_page2rsl(pages[0], 8, 1008); |
| 505 | interleave { |
Vadim Yanitskiy | ca5c520 | 2020-05-25 22:03:28 +0700 | [diff] [blame] | 506 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr)); |
| 507 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr)); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 508 | } |
| 509 | f_sleep(5.0); |
| 510 | } |
| 511 | |
| 512 | /* Write a message, then replace it */ |
| 513 | testcase TC_cbsp_write_then_replace() runs on cbsp_test_CT { |
| 514 | var CBSP_IEs pages := {f_gen_page()}; |
| 515 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 516 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 517 | f_cbsp_init_server(); |
| 518 | f_cbsp_write(9, 1009, cell_list, num_bcast_req:=10, content:=pages, |
| 519 | success_list:=?, fail_list:=omit); |
| 520 | f_cbsp_replace(9, 2009, 1009, cell_list, content:=pages, |
| 521 | success_list:=?, fail_list:=omit); |
| 522 | } |
| 523 | |
| 524 | /* Replace a message that doesn't exist: failure */ |
| 525 | testcase TC_cbsp_replace_nonexist() runs on cbsp_test_CT { |
| 526 | var CBSP_IEs pages := {f_gen_page()}; |
| 527 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 528 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 529 | f_cbsp_init_server(); |
| 530 | f_cbsp_replace(10, 2010, 1010, cell_list, content:=pages, |
| 531 | success_list:=omit, fail_list:=?); |
| 532 | } |
| 533 | |
| 534 | /* Write more messages than can be scheduled */ |
| 535 | testcase TC_cbsp_write_too_many() runs on cbsp_test_CT { |
| 536 | /* repeating three pages at an interval of 1 is impossible */ |
| 537 | var CBSP_IEs pages := {f_gen_page(), f_gen_page(), f_gen_page()}; |
| 538 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 539 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 540 | f_cbsp_init_server(); |
| 541 | f_cbsp_write(11, 1011, cell_list, rep_period:=1, content:=pages, |
| 542 | success_list:=omit, fail_list:=?); |
| 543 | } |
| 544 | |
| 545 | /* Kill message that doesn't exist: failure */ |
| 546 | testcase TC_cbsp_kill_nonexist() runs on cbsp_test_CT { |
| 547 | var CBSP_IEs pages := {f_gen_page()}; |
| 548 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 549 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 550 | f_cbsp_init_server(); |
| 551 | f_cbsp_kill(12, 1012, 0, cell_list, success_list:=omit, fail_list:=?); |
| 552 | } |
| 553 | /* Write a message, then kill it */ |
| 554 | testcase TC_cbsp_write_then_kill() runs on cbsp_test_CT { |
| 555 | var CBSP_IEs pages := {f_gen_page()}; |
| 556 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 557 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 558 | f_cbsp_init_server(); |
| 559 | f_cbsp_write(13, 1013, cell_list, content:=pages, success_list:=?, fail_list:=omit); |
| 560 | f_cbsp_kill(13, 1013, 0, cell_list, success_list:=?, fail_list:=omit); |
| 561 | } |
| 562 | |
| 563 | /* Write a message, then reset all messages */ |
| 564 | testcase TC_cbsp_write_then_reset() runs on cbsp_test_CT { |
| 565 | var CBSP_IEs pages := {f_gen_page()}; |
| 566 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 567 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 568 | f_cbsp_init_server(); |
| 569 | f_cbsp_write(14, 1014, cell_list, content:=pages, success_list:=?, fail_list:=omit); |
| 570 | f_cbsp_reset_bss(0); |
| 571 | } |
| 572 | |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 573 | private const octetstring c_ETWS_sec_default := |
| 574 | '00000000000000000000000000000000000000000000000000'O & |
| 575 | '00000000000000000000000000000000000000000000000000'O; |
| 576 | function f_gen_etws_pn(uint16_t ser_nr, uint16_t msg_id, OCT2 msg_type := '0780'O, |
| 577 | octetstring sec_inf := c_ETWS_sec_default) return octetstring { |
| 578 | return int2oct(ser_nr, 2) & int2oct(msg_id, 2) & msg_type & sec_inf; |
| 579 | } |
| 580 | |
| 581 | /* Write ETWS PN to single BTS; verify it arrives on DCHAN */ |
| 582 | testcase TC_cbsp_emerg_write_bts_cgi_dchan() runs on cbsp_test_CT { |
| 583 | var CBSP_IEs pages := {f_gen_page()}; |
| 584 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 585 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 586 | |
| 587 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)}); |
| 588 | f_cbsp_init_server(); |
| 589 | |
| 590 | /* first establish a dedicated channel */ |
| 591 | var DchanTuple dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 592 | |
| 593 | /* then send ETWS PN */ |
| 594 | f_cbsp_write_emerg(15, 1015, cell_list); |
| 595 | var template (present) octetstring tr_apdu := f_gen_etws_pn(1015, 15); |
| 596 | timer T := 5.0; |
| 597 | T.start; |
| 598 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 599 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(dt.rsl_chan_nr, ?, ?))) -> value rx_rsl_ud { |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 600 | var RSL_IE_Body l3_ie; |
| 601 | if (f_rsl_find_ie(rx_rsl_ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 602 | setverdict(fail, "RSL DATA REQ without L3?"); |
| 603 | mtc.stop; |
| 604 | } |
| 605 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 606 | var template (present) APDU_Flags_V tr_flags := { |
| 607 | lastSeg := '0'B, |
| 608 | firstSeg := '0'B, |
| 609 | cR := '0'B, |
| 610 | spare := '0'B |
| 611 | }; |
| 612 | if (match(l3, tr_RR_APP_INFO('0001'B, tr_apdu, tr_flags))) { |
| 613 | setverdict(pass); |
| 614 | } |
| 615 | } |
| 616 | [] IPA_RSL[0].receive { repeat; } |
| 617 | [] T.timeout { |
| 618 | setverdict(fail, "Waiting for APP INFO"); |
| 619 | } |
| 620 | } |
| 621 | } |
| 622 | |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 623 | /* Write ETWS PN to single BTS; verify it arrives on CCHAN */ |
| 624 | testcase TC_cbsp_emerg_write_bts_cgi_cchan() runs on cbsp_test_CT { |
| 625 | var CBSP_IEs pages := {f_gen_page()}; |
| 626 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 627 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 628 | |
| 629 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)}); |
| 630 | f_cbsp_init_server(); |
| 631 | |
| 632 | f_cbsp_write_emerg(16, 1016, cell_list); |
| 633 | var template (present) octetstring tr_apdu := f_gen_etws_pn(1016, 16); |
| 634 | timer T := 5.0; |
| 635 | T.start; |
| 636 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 637 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 638 | setverdict(pass); |
| 639 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 640 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 641 | setverdict(fail, "Received unexpected OSMO_ETWS_CMD"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 642 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 643 | } |
| 644 | [] IPA_RSL[0].receive { repeat; } |
| 645 | [] T.timeout { |
| 646 | setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 647 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 648 | } |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | /* Write ETWS PN to single BTS; verify it arrives on CCHAN */ |
| 653 | testcase TC_cbsp_emerg_write_bts_cgi_cchan_disable() runs on cbsp_test_CT { |
| 654 | var CBSP_IEs pages := {f_gen_page()}; |
| 655 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 656 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 657 | |
| 658 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)}); |
| 659 | f_cbsp_init_server(); |
| 660 | |
| 661 | f_cbsp_write_emerg(16, 1016, cell_list); |
| 662 | |
| 663 | /* first expect the PN to be enabled */ |
| 664 | var template (present) octetstring tr_apdu := f_gen_etws_pn(1016, 16); |
| 665 | timer T := 5.0; |
| 666 | T.start; |
| 667 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 668 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), tr_apdu))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 669 | setverdict(pass); |
| 670 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 671 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 672 | setverdict(fail, "Received unexpected OSMO_ETWS_CMD"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 673 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 674 | } |
| 675 | [] IPA_RSL[0].receive { repeat; } |
| 676 | [] T.timeout { |
| 677 | setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (enable)"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 678 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 679 | } |
| 680 | } |
| 681 | |
| 682 | /* then expect it to be disabled after the warning period (5s) */ |
| 683 | T.start; |
| 684 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 685 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(t_RslChanNr_PCH_AGCH(0), ''O))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 686 | setverdict(pass); |
| 687 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 688 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_OSMO_ETWS_CMD(?,?))) { |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 689 | setverdict(fail, "Received unexpected OSMO_ETWS_CMD"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 690 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 691 | } |
| 692 | [] IPA_RSL[0].receive { repeat; } |
| 693 | [] T.timeout { |
| 694 | setverdict(fail, "Timeout waiting for RSL_OSMO_ETWS_CMD (disable)"); |
Neels Hofmeyr | ee3b927 | 2020-07-28 21:20:15 +0200 | [diff] [blame] | 695 | mtc.stop; |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 696 | } |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 701 | |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 702 | control { |
| 703 | execute( TC_cbsp_bsc_server() ); |
| 704 | execute( TC_cbsp_bsc_client() ); |
| 705 | execute( TC_cbsp_reset_bss() ); |
| 706 | |
| 707 | /* test various different types of Cell Identities */ |
| 708 | execute( TC_cbsp_write_bss() ); |
| 709 | execute( TC_cbsp_write_bts_cgi() ); |
| 710 | execute( TC_cbsp_write_bts_no_cbch() ); |
| 711 | execute( TC_cbsp_write_unknown_bts() ); |
| 712 | execute( TC_cbsp_write_lac_ci() ); |
| 713 | execute( TC_cbsp_write_ci() ); |
| 714 | execute( TC_cbsp_write_lai() ); |
| 715 | execute( TC_cbsp_write_lac() ); |
| 716 | |
| 717 | execute( TC_cbsp_write_then_replace() ); |
| 718 | execute( TC_cbsp_replace_nonexist() ); |
| 719 | execute( TC_cbsp_write_too_many() ); |
| 720 | execute( TC_cbsp_kill_nonexist() ); |
| 721 | execute( TC_cbsp_write_then_kill() ); |
| 722 | execute( TC_cbsp_write_then_reset() ); |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 723 | |
| 724 | execute( TC_cbsp_emerg_write_bts_cgi_dchan() ); |
Harald Welte | 0b5e0f9 | 2019-09-07 08:30:25 +0200 | [diff] [blame] | 725 | execute( TC_cbsp_emerg_write_bts_cgi_cchan() ); |
| 726 | execute( TC_cbsp_emerg_write_bts_cgi_cchan_disable() ); |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | |
| 730 | } |