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 | |
| 28 | import from RSL_Types all; |
| 29 | import from RSL_Emulation all; |
| 30 | |
| 31 | import from CBSP_Types all; |
| 32 | import from CBSP_Templates all; |
| 33 | import from CBSP_Adapter all; |
| 34 | import from CBSP_CodecPort all; |
| 35 | |
| 36 | modulepar { |
| 37 | charstring mp_cbc_ip := "0.0.0.0"; |
| 38 | integer mp_cbc_port := 48049; |
| 39 | integer mp_bsc_cbsp_port := 48050; |
| 40 | |
| 41 | /* BTS 0: 262-42-1-0 with CBCH |
| 42 | * BTS 1: 262-42-1-1 with CBCH |
| 43 | * BTS 2: 262-42-2-1 with CBCH |
| 44 | * BTS 3: 262-42-2-3 without CBCH */ |
| 45 | GsmCgiAbstract mp_cgi_bts0 := { '262'H, '42'H, 1, 0 }; |
| 46 | GsmCgiAbstract mp_cgi_bts1 := { '262'H, '42'H, 1, 1 }; |
| 47 | GsmCgiAbstract mp_cgi_bts2 := { '262'H, '42'H, 2, 1 }; |
| 48 | GsmCgiAbstract mp_cgi_bts3 := { '262'H, '42'H, 2, 3 }; |
| 49 | } |
| 50 | |
| 51 | private type record GsmCgiAbstract { |
| 52 | GsmMcc mcc, |
| 53 | GsmMnc mnc, |
| 54 | GsmLac lac, |
| 55 | GsmCellId ci |
| 56 | }; |
| 57 | private template (value) BSSMAP_FIELD_CellIdentification_CGI bssmap_cgi(GsmCgiAbstract cgi) := |
| 58 | ts_BSSMAP_CI_CGI(cgi.mcc, cgi.mnc, cgi.lac, cgi.ci); |
| 59 | private template (value) BSSMAP_FIELD_CellIdentification_LAC_CI bssmap_lac_ci(GsmCgiAbstract cgi) := |
| 60 | ts_BSSMAP_CI_LAC_CI(cgi.lac, cgi.ci); |
| 61 | private template (value) BSSMAP_FIELD_CellIdentification_LAI bssmap_lai(GsmCgiAbstract cgi) := |
| 62 | ts_BSSMAP_CI_LAI(cgi.mcc, cgi.mnc, cgi.lac); |
| 63 | private template (value) OCT2 bssmap_lac(GsmCgiAbstract cgi) := ts_BSSMAP_CI_LAC(cgi.lac); |
| 64 | private template (value) OCT2 bssmap_ci(GsmCgiAbstract cgi) := ts_BSSMAP_CI_CI(cgi.ci); |
| 65 | |
| 66 | type component cbsp_test_CT extends test_CT, CBSP_Adapter_CT { |
| 67 | } |
| 68 | |
| 69 | private altstep as_IgnRSL(template RSL_Message tr) runs on cbsp_test_CT { |
| 70 | [] IPA_RSL[0].receive(tr_RSL_UD(tr)) { repeat; } |
| 71 | [] IPA_RSL[1].receive(tr_RSL_UD(tr)) { repeat; } |
| 72 | [] IPA_RSL[2].receive(tr_RSL_UD(tr)) { repeat; } |
| 73 | } |
| 74 | |
| 75 | private altstep as_FailRSL() runs on cbsp_test_CT { |
| 76 | var template RSL_Message tr := (tr_RSL_SMSCB_CMD); |
| 77 | var ASP_RSL_Unitdata rx; |
| 78 | [] IPA_RSL[0].receive(tr_RSL_UD(tr)) -> value rx { |
| 79 | setverdict(fail, "Received unexpected RSL ", rx); |
| 80 | mtc.stop; |
| 81 | } |
| 82 | [] IPA_RSL[1].receive(tr_RSL_UD(tr)) -> value rx { |
| 83 | setverdict(fail, "Received unexpected RSL ", rx); |
| 84 | mtc.stop; |
| 85 | } |
| 86 | [] IPA_RSL[2].receive(tr_RSL_UD(tr)) -> value rx { |
| 87 | setverdict(fail, "Received unexpected RSL ", rx); |
| 88 | mtc.stop; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | private function f_init() runs on cbsp_test_CT { |
| 93 | BSC_Tests.f_init(); |
| 94 | activate(as_IgnRSL((tr_RSL_BCCH_INFO, tr_RSL_SACCH_FILL, |
| 95 | tr_RSL_NO_BCCH_INFO, tr_RSL_NO_SACCH_FILL, |
| 96 | tr_RSL_MsgTypeD(?)))); |
| 97 | activate(as_FailRSL()); |
| 98 | } |
| 99 | private function f_cbsp_init_client() runs on cbsp_test_CT { |
| 100 | f_init(); |
| 101 | CBSP_Adapter.f_connect(mp_bsc_ip, mp_bsc_cbsp_port, "", -1); |
| 102 | f_cbsp_init_tail(); |
| 103 | } |
| 104 | |
| 105 | private function f_cbsp_init_server() runs on cbsp_test_CT { |
| 106 | var ASP_Event asp_evt; |
| 107 | timer T := 10.0; |
| 108 | |
| 109 | f_init(); |
| 110 | CBSP_Adapter.f_bind(mp_cbc_ip, mp_cbc_port); |
| 111 | |
| 112 | T.start; |
| 113 | alt { |
| 114 | [] CBSP[0].receive(ASP_Event:{connOpened:=?}) -> value asp_evt { |
| 115 | g_cbsp_conn_id[0] := asp_evt.connOpened.connId; |
| 116 | } |
| 117 | [] T.timeout { |
| 118 | setverdict(fail, "Timeout waiting for incoming connection to CBSP Port"); |
| 119 | } |
| 120 | } |
| 121 | f_cbsp_init_tail(); |
| 122 | } |
| 123 | private function f_cbsp_init_tail() runs on cbsp_test_CT { |
| 124 | interleave { |
| 125 | [] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_CBS, CBSP_RI_DATA_LOST))); |
| 126 | /* should we also expect a restart for emergency related messages? */ |
| 127 | //[] CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_EMERG, CBSP_RI_DATA_LOST))); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | function f_gen_page() return CBSP_IE { |
| 132 | var integer len := f_rnd_int(82); |
| 133 | var octetstring payload := f_rnd_octstring(len); |
| 134 | return valueof(ts_CbspMsgContent(payload, len)); |
| 135 | } |
| 136 | |
| 137 | function f_cbsp_reset_bss(integer idx) runs on CBSP_Adapter_CT { |
| 138 | var template (value) CBSP_PDU tx; |
| 139 | timer T := 3.0; |
| 140 | tx := ts_CBSP_RESET(cell_list := ts_BSSMAP_CIL_BSS); |
| 141 | CBSP[idx].clear; |
| 142 | CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx)); |
| 143 | T.start; |
| 144 | alt { |
| 145 | [] CBSP[idx].receive(tr_CBSP_Recv(?, tr_CBSP_RESET_COMPL(cell_list := ts_BSSMAP_CIL_BSS))); |
| 146 | [] CBSP[idx].receive { |
| 147 | setverdict(fail, "received unexpected CBSP"); |
| 148 | mtc.stop; |
| 149 | } |
| 150 | [] T.timeout { |
| 151 | setverdict(fail, "timeout waiting for RESET COMPLETE"); |
| 152 | mtc.stop; |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /* send a WRITE CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
| 158 | function f_cbsp_write(uint16_t msg_id, uint16_t ser_no, |
| 159 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 160 | template (value) CBSP_Category category := CBSP_CATEG_NORMAL, |
| 161 | uint16_t rep_period := 10, uint16_t num_bcast_req := 1, |
| 162 | uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content, |
| 163 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 164 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT { |
| 165 | var template (value) CBSP_PDU tx; |
| 166 | var template CBSP_PDU rx; |
| 167 | var CBSP_IEs pages := {f_gen_page()}; |
| 168 | |
| 169 | tx := ts_CBSP_WRITE_CBS(msg_id, ser_no, cell_list, channel_ind, category, |
| 170 | rep_period, num_bcast_req, dcs, content); |
| 171 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 172 | if (istemplatekind(fail_list, "omit")) { |
| 173 | rx := tr_CBSP_WRITE_CBS_COMPL(msg_id, ser_no, success_list, channel_ind); |
| 174 | } else { |
| 175 | rx := tr_CBSP_WRITE_CBS_FAIL(msg_id, ser_no, fail_list, *, success_list, channel_ind); |
| 176 | } |
| 177 | alt { |
| 178 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 179 | setverdict(pass); |
| 180 | } |
| 181 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 182 | setverdict(fail, "Received unexpected CBSP"); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | /* send a REPLACE CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
| 188 | function f_cbsp_replace(uint16_t msg_id, uint16_t new_ser_no, uint16_t old_ser_no, |
| 189 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 190 | template (value) CBSP_Category category := CBSP_CATEG_NORMAL, |
| 191 | uint16_t rep_period := 10, uint16_t num_bcast_req := 1, |
| 192 | uint8_t dcs := 0, uint8_t channel_ind := 0, CBSP_IEs content, |
| 193 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 194 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT { |
| 195 | var template (value) CBSP_PDU tx; |
| 196 | var template CBSP_PDU rx; |
| 197 | var CBSP_IEs pages := {f_gen_page()}; |
| 198 | |
| 199 | tx := ts_CBSP_REPLACE_CBS(msg_id, new_ser_no, old_ser_no, cell_list, channel_ind, category, |
| 200 | rep_period, num_bcast_req, dcs, content); |
| 201 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 202 | if (istemplatekind(fail_list, "omit")) { |
| 203 | rx := tr_CBSP_REPLACE_CBS_COMPL(msg_id, new_ser_no, old_ser_no, ?, success_list, |
| 204 | channel_ind); |
| 205 | } else { |
| 206 | rx := tr_CBSP_REPLACE_CBS_FAIL(msg_id, new_ser_no, old_ser_no, fail_list, *, success_list, |
| 207 | channel_ind); |
| 208 | } |
| 209 | alt { |
| 210 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 211 | setverdict(pass); |
| 212 | } |
| 213 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 214 | setverdict(fail, "Received unexpected CBSP"); |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | /* send a KILL CBS to the BSC; expect either COMPLETE or FAILURE in response*/ |
| 219 | function f_cbsp_kill(uint16_t msg_id, uint16_t ser_no, template (omit) uint8_t channel_ind := 0, |
| 220 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list := ts_BSSMAP_CIL_BSS, |
| 221 | template BSSMAP_FIELD_CellIdentificationList success_list := ?, |
| 222 | template CBSP_FailureListItems fail_list := omit) runs on cbsp_test_CT |
| 223 | { |
| 224 | var template (value) CBSP_PDU tx; |
| 225 | var template CBSP_PDU rx; |
| 226 | |
| 227 | tx := ts_CBSP_KILL(msg_id, ser_no, cell_list, channel_ind); |
| 228 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 229 | if (istemplatekind(fail_list, "omit")) { |
| 230 | rx := tr_CBSP_KILL_COMPL(msg_id, ser_no, compl_list:=*, cell_list:=success_list, |
| 231 | channel_ind:=channel_ind); |
| 232 | } else { |
| 233 | rx := tr_CBSP_KILL_FAIL(msg_id, ser_no, fail_list, compl_list:=*, cell_list:=success_list, |
| 234 | channel_ind:=channel_ind); |
| 235 | } |
| 236 | alt { |
| 237 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], rx)) { |
| 238 | setverdict(pass); |
| 239 | } |
| 240 | [] CBSP[0].receive(tr_CBSP_Recv(g_cbsp_conn_id[0], ?)) { |
| 241 | setverdict(fail, "Received unexpected CBSP"); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | private template (present) ASP_RSL_Unitdata tr_RSL_UD(template (present) RSL_Message rsl) := { |
| 247 | streamId := ?, |
| 248 | rsl := rsl |
| 249 | } |
| 250 | |
| 251 | template (present) RSL_IE_CbCommandType |
| 252 | tr_RslCbCmdType(template (present) uint2_t lblock := ?, template (present) RSL_CbCommand cmd := ?) := { |
| 253 | command := cmd, |
| 254 | default_bcast_null := ?, |
| 255 | spare := ?, |
| 256 | last_block := lblock |
| 257 | } |
| 258 | |
| 259 | /* build a RSL_Message receive template from a CBSP page */ |
| 260 | private function f_page2rsl(CBSP_IE page, uint16_t msg_id, uint16_t ser_no, boolean ext_cbch := false) |
| 261 | return template (present) RSL_Message |
| 262 | { |
| 263 | var template RSL_Message tr; |
| 264 | var integer lblock := page.body.msg_content.user_len / 22; |
| 265 | var octetstring payload; |
| 266 | if (page.body.msg_content.user_len mod 22 > 0) { |
| 267 | lblock := lblock + 1; |
| 268 | } |
| 269 | payload := int2oct(ser_no, 2) & int2oct(msg_id, 2) & '0011'O & page.body.msg_content.val; |
| 270 | tr := tr_RSL_SMSCB_CMD(tr_RslCbCmdType(lblock), f_pad_oct(payload, 88, '00'O)); |
| 271 | if (ext_cbch) { |
| 272 | tr.ies[3] := tr_RSL_IE(RSL_IE_Body:{smscb_chan_ind := 1}); |
| 273 | tr.ies[4] := *; |
| 274 | } |
| 275 | return tr; |
| 276 | } |
| 277 | |
| 278 | /*********************************************************************** |
| 279 | * Test Cases |
| 280 | ***********************************************************************/ |
| 281 | |
| 282 | /* Test if BSC (server) accepts connections from CBC (client) */ |
| 283 | testcase TC_cbsp_bsc_server() runs on cbsp_test_CT { |
| 284 | f_cbsp_init_client(); |
| 285 | setverdict(pass); |
| 286 | } |
| 287 | |
| 288 | /* Test if BSC (client) is connecting to CBC (server) */ |
| 289 | testcase TC_cbsp_bsc_client() runs on cbsp_test_CT { |
| 290 | f_cbsp_init_server(); |
| 291 | setverdict(pass); |
| 292 | } |
| 293 | |
| 294 | /* Test if a BSS-global RESET is executed successfully */ |
| 295 | testcase TC_cbsp_reset_bss() runs on cbsp_test_CT { |
| 296 | f_cbsp_init_server(); |
| 297 | |
| 298 | f_cbsp_reset_bss(0); |
| 299 | setverdict(pass); |
| 300 | } |
| 301 | |
| 302 | testcase TC_cbsp_write() runs on cbsp_test_CT { |
| 303 | var template (value) CBSP_PDU tx; |
| 304 | var CBSP_IEs pages := {f_gen_page()}; |
| 305 | f_cbsp_init_server(); |
| 306 | |
| 307 | tx := ts_CBSP_WRITE_CBS(msg_id:=23, new_ser_nr:=42, cell_list:=ts_BSSMAP_CIL_BSS, |
| 308 | channel_ind:=0, category:=CBSP_CATEG_NORMAL, |
| 309 | rep_period:=10, num_bcast_req:=1, dcs := 0, |
| 310 | content:=pages); |
| 311 | |
| 312 | CBSP[0].send(ts_CBSP_Send(g_cbsp_conn_id[0], tx)); |
| 313 | f_sleep(10.0); |
| 314 | } |
| 315 | |
| 316 | /* Write to entire BSS; three cells succeed; one fails (no CBCH) */ |
| 317 | testcase TC_cbsp_write_bss() runs on cbsp_test_CT { |
| 318 | var CBSP_IEs pages := {f_gen_page()}; |
| 319 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 320 | cell_list := ts_BSSMAP_CIL_BSS; |
| 321 | f_cbsp_init_server(); |
| 322 | f_cbsp_write(1, 1001, cell_list, content:=pages, |
| 323 | success_list:=tr_BSSMAP_CIL_CGI({?,?,?}), fail_list:={?}); |
| 324 | |
| 325 | var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001); |
| 326 | interleave { |
| 327 | [] IPA_RSL[0].receive(tr_RSL_UD(tr)) {} |
| 328 | [] IPA_RSL[1].receive(tr_RSL_UD(tr)) {} |
| 329 | [] IPA_RSL[2].receive(tr_RSL_UD(tr)) {} |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | /* Write to single BTS supporting CBCH: success */ |
| 334 | testcase TC_cbsp_write_bts_cgi() runs on cbsp_test_CT { |
| 335 | var CBSP_IEs pages := {f_gen_page()}; |
| 336 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 337 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts0)}); |
| 338 | f_cbsp_init_server(); |
| 339 | f_cbsp_write(2, 1002, cell_list, content:=pages, |
| 340 | success_list:=cell_list, fail_list:=omit); |
| 341 | var template RSL_Message tr := f_page2rsl(pages[0], 1, 1001); |
| 342 | IPA_RSL[0].receive(tr_RSL_UD(tr)); |
| 343 | f_sleep(5.0); |
| 344 | } |
| 345 | |
| 346 | /* Write to single BTS not supporting CBCH: failure */ |
| 347 | testcase TC_cbsp_write_bts_no_cbch() runs on cbsp_test_CT { |
| 348 | var CBSP_IEs pages := {f_gen_page()}; |
| 349 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 350 | cell_list := ts_BSSMAP_CIL_CGI({bssmap_cgi(mp_cgi_bts3)}); |
| 351 | f_cbsp_init_server(); |
| 352 | f_cbsp_write(3, 1003, cell_list, content:=pages, |
| 353 | success_list:=omit, fail_list:={?}); |
| 354 | f_sleep(5.0); |
| 355 | } |
| 356 | |
| 357 | /* Write to single non-existant BTS */ |
| 358 | testcase TC_cbsp_write_unknown_bts() runs on cbsp_test_CT { |
| 359 | var CBSP_IEs pages := {f_gen_page()}; |
| 360 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 361 | cell_list := ts_BSSMAP_CIL_CGI({ts_BSSMAP_CI_CGI(mp_cgi_bts0.mcc, mp_cgi_bts1.mnc, 22222, 33333)}); |
| 362 | f_cbsp_init_server(); |
| 363 | f_cbsp_write(4, 1004, cell_list, content:=pages, |
| 364 | success_list:=omit, fail_list:={?}); |
| 365 | f_sleep(5.0); |
| 366 | } |
| 367 | |
| 368 | /* Write to single BTS using LAC+CI */ |
| 369 | testcase TC_cbsp_write_lac_ci() runs on cbsp_test_CT { |
| 370 | var CBSP_IEs pages := {f_gen_page()}; |
| 371 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 372 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 373 | f_cbsp_init_server(); |
| 374 | f_cbsp_write(5, 1005, cell_list, content:=pages, |
| 375 | success_list:=?, fail_list:=omit); |
| 376 | IPA_RSL[0].receive(tr_RSL_UD(f_page2rsl(pages[0], 5, 1005))); |
| 377 | f_sleep(5.0); |
| 378 | } |
| 379 | |
| 380 | /* Write to single BTS using CI */ |
| 381 | testcase TC_cbsp_write_ci() runs on cbsp_test_CT { |
| 382 | var CBSP_IEs pages := {f_gen_page()}; |
| 383 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 384 | cell_list := ts_BSSMAP_CIL_CI({bssmap_ci(mp_cgi_bts0)}); |
| 385 | f_cbsp_init_server(); |
| 386 | f_cbsp_write(6, 1006, cell_list, content:=pages, |
| 387 | success_list:=?, fail_list:=omit); |
| 388 | IPA_RSL[0].receive(tr_RSL_UD(f_page2rsl(pages[0], 6, 1006))); |
| 389 | f_sleep(5.0); |
| 390 | } |
| 391 | |
| 392 | /* Write to single BTS using LAI */ |
| 393 | testcase TC_cbsp_write_lai() runs on cbsp_test_CT { |
| 394 | var CBSP_IEs pages := {f_gen_page()}; |
| 395 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 396 | cell_list := ts_BSSMAP_CIL_LAI({bssmap_lai(mp_cgi_bts0)}); |
| 397 | f_cbsp_init_server(); |
| 398 | f_cbsp_write(7, 1007, cell_list, content:=pages, |
| 399 | success_list:=?, fail_list:=omit); |
| 400 | IPA_RSL[0].receive(tr_RSL_UD(f_page2rsl(pages[0], 7, 1007))); |
| 401 | f_sleep(5.0); |
| 402 | } |
| 403 | |
| 404 | /* Write to two BTS using LAC */ |
| 405 | testcase TC_cbsp_write_lac() runs on cbsp_test_CT { |
| 406 | var CBSP_IEs pages := {f_gen_page()}; |
| 407 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 408 | cell_list := ts_BSSMAP_CIL_LAC({bssmap_lac(mp_cgi_bts0)}); |
| 409 | f_cbsp_init_server(); |
| 410 | f_cbsp_write(8, 1008, cell_list, content:=pages, |
| 411 | success_list:=?, fail_list:=omit); |
| 412 | var template RSL_Message tr := f_page2rsl(pages[0], 8, 1008); |
| 413 | interleave { |
| 414 | [] IPA_RSL[0].receive(tr_RSL_UD(tr)); |
| 415 | [] IPA_RSL[1].receive(tr_RSL_UD(tr)); |
| 416 | } |
| 417 | f_sleep(5.0); |
| 418 | } |
| 419 | |
| 420 | /* Write a message, then replace it */ |
| 421 | testcase TC_cbsp_write_then_replace() runs on cbsp_test_CT { |
| 422 | var CBSP_IEs pages := {f_gen_page()}; |
| 423 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 424 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 425 | f_cbsp_init_server(); |
| 426 | f_cbsp_write(9, 1009, cell_list, num_bcast_req:=10, content:=pages, |
| 427 | success_list:=?, fail_list:=omit); |
| 428 | f_cbsp_replace(9, 2009, 1009, cell_list, content:=pages, |
| 429 | success_list:=?, fail_list:=omit); |
| 430 | } |
| 431 | |
| 432 | /* Replace a message that doesn't exist: failure */ |
| 433 | testcase TC_cbsp_replace_nonexist() runs on cbsp_test_CT { |
| 434 | var CBSP_IEs pages := {f_gen_page()}; |
| 435 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 436 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 437 | f_cbsp_init_server(); |
| 438 | f_cbsp_replace(10, 2010, 1010, cell_list, content:=pages, |
| 439 | success_list:=omit, fail_list:=?); |
| 440 | } |
| 441 | |
| 442 | /* Write more messages than can be scheduled */ |
| 443 | testcase TC_cbsp_write_too_many() runs on cbsp_test_CT { |
| 444 | /* repeating three pages at an interval of 1 is impossible */ |
| 445 | var CBSP_IEs pages := {f_gen_page(), f_gen_page(), f_gen_page()}; |
| 446 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 447 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 448 | f_cbsp_init_server(); |
| 449 | f_cbsp_write(11, 1011, cell_list, rep_period:=1, content:=pages, |
| 450 | success_list:=omit, fail_list:=?); |
| 451 | } |
| 452 | |
| 453 | /* Kill message that doesn't exist: failure */ |
| 454 | testcase TC_cbsp_kill_nonexist() runs on cbsp_test_CT { |
| 455 | var CBSP_IEs pages := {f_gen_page()}; |
| 456 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 457 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 458 | f_cbsp_init_server(); |
| 459 | f_cbsp_kill(12, 1012, 0, cell_list, success_list:=omit, fail_list:=?); |
| 460 | } |
| 461 | /* Write a message, then kill it */ |
| 462 | testcase TC_cbsp_write_then_kill() 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_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 466 | f_cbsp_init_server(); |
| 467 | f_cbsp_write(13, 1013, cell_list, content:=pages, success_list:=?, fail_list:=omit); |
| 468 | f_cbsp_kill(13, 1013, 0, cell_list, success_list:=?, fail_list:=omit); |
| 469 | } |
| 470 | |
| 471 | /* Write a message, then reset all messages */ |
| 472 | testcase TC_cbsp_write_then_reset() runs on cbsp_test_CT { |
| 473 | var CBSP_IEs pages := {f_gen_page()}; |
| 474 | var template (value) BSSMAP_FIELD_CellIdentificationList cell_list; |
| 475 | cell_list := ts_BSSMAP_CIL_LAC_CI({bssmap_lac_ci(mp_cgi_bts0)}); |
| 476 | f_cbsp_init_server(); |
| 477 | f_cbsp_write(14, 1014, cell_list, content:=pages, success_list:=?, fail_list:=omit); |
| 478 | f_cbsp_reset_bss(0); |
| 479 | } |
| 480 | |
| 481 | control { |
| 482 | execute( TC_cbsp_bsc_server() ); |
| 483 | execute( TC_cbsp_bsc_client() ); |
| 484 | execute( TC_cbsp_reset_bss() ); |
| 485 | |
| 486 | /* test various different types of Cell Identities */ |
| 487 | execute( TC_cbsp_write_bss() ); |
| 488 | execute( TC_cbsp_write_bts_cgi() ); |
| 489 | execute( TC_cbsp_write_bts_no_cbch() ); |
| 490 | execute( TC_cbsp_write_unknown_bts() ); |
| 491 | execute( TC_cbsp_write_lac_ci() ); |
| 492 | execute( TC_cbsp_write_ci() ); |
| 493 | execute( TC_cbsp_write_lai() ); |
| 494 | execute( TC_cbsp_write_lac() ); |
| 495 | |
| 496 | execute( TC_cbsp_write_then_replace() ); |
| 497 | execute( TC_cbsp_replace_nonexist() ); |
| 498 | execute( TC_cbsp_write_too_many() ); |
| 499 | execute( TC_cbsp_kill_nonexist() ); |
| 500 | execute( TC_cbsp_write_then_kill() ); |
| 501 | execute( TC_cbsp_write_then_reset() ); |
| 502 | } |
| 503 | |
| 504 | |
| 505 | } |