Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 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 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 23 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 24 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 25 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 26 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from IPL4asp_Types all; |
| 28 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 29 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 30 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 31 | import from BSSAP_LE_Adapter all; |
| 32 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Types all; |
| 34 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 35 | import from BSSAP_CodecPort all; |
| 36 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 37 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 38 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 39 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 40 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 42 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 43 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 44 | import from MGCP_Templates all; |
| 45 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 46 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 47 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 48 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 49 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 51 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 52 | import from StatsD_Types all; |
| 53 | import from StatsD_CodecPort all; |
| 54 | import from StatsD_CodecPort_CtrlFunct all; |
| 55 | import from StatsD_Checker all; |
| 56 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 57 | import from Osmocom_VTY_Functions all; |
| 58 | import from TELNETasp_PortType all; |
| 59 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 60 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 61 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 62 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 63 | import from L3_Templates all; |
| 64 | import from GSM_RR_Types all; |
| 65 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 66 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 67 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 68 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 70 | import from SCCPasp_Types all; |
| 71 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 72 | import from GSM_SystemInformation all; |
| 73 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 74 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 75 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 76 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 77 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 78 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 80 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 81 | const integer NUM_TCHH_PER_BTS := 2; |
| 82 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 83 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 84 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 85 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 86 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 87 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 89 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 92 | /* Default list of counters for an 'msc' entity. */ |
| 93 | const CounterNameVals counternames_msc_mscpool := { |
| 94 | { "mscpool:subscr:new", 0 }, |
| 95 | { "mscpool:subscr:known", 0 }, |
| 96 | { "mscpool:subscr:reattach", 0 }, |
| 97 | { "mscpool:subscr:attach_lost", 0 }, |
| 98 | { "mscpool:subscr:paged", 0 } |
| 99 | }; |
| 100 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 101 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 102 | const CounterNameVals counternames_bsc_bts_handover := { |
| 103 | { "assignment:attempted", 0 }, |
| 104 | { "assignment:completed", 0 }, |
| 105 | { "assignment:stopped", 0 }, |
| 106 | { "assignment:no_channel", 0 }, |
| 107 | { "assignment:timeout", 0 }, |
| 108 | { "assignment:failed", 0 }, |
| 109 | { "assignment:error", 0 }, |
| 110 | |
| 111 | { "handover:attempted", 0 }, |
| 112 | { "handover:completed", 0 }, |
| 113 | { "handover:stopped", 0 }, |
| 114 | { "handover:no_channel", 0 }, |
| 115 | { "handover:timeout", 0 }, |
| 116 | { "handover:failed", 0 }, |
| 117 | { "handover:error", 0 }, |
| 118 | |
| 119 | { "intra_cell_ho:attempted", 0 }, |
| 120 | { "intra_cell_ho:completed", 0 }, |
| 121 | { "intra_cell_ho:stopped", 0 }, |
| 122 | { "intra_cell_ho:no_channel", 0 }, |
| 123 | { "intra_cell_ho:timeout", 0 }, |
| 124 | { "intra_cell_ho:failed", 0 }, |
| 125 | { "intra_cell_ho:error", 0 }, |
| 126 | |
| 127 | { "intra_bsc_ho:attempted", 0 }, |
| 128 | { "intra_bsc_ho:completed", 0 }, |
| 129 | { "intra_bsc_ho:stopped", 0 }, |
| 130 | { "intra_bsc_ho:no_channel", 0 }, |
| 131 | { "intra_bsc_ho:timeout", 0 }, |
| 132 | { "intra_bsc_ho:failed", 0 }, |
| 133 | { "intra_bsc_ho:error", 0 }, |
| 134 | |
| 135 | { "interbsc_ho_out:attempted", 0 }, |
| 136 | { "interbsc_ho_out:completed", 0 }, |
| 137 | { "interbsc_ho_out:stopped", 0 }, |
| 138 | { "interbsc_ho_out:timeout", 0 }, |
| 139 | { "interbsc_ho_out:failed", 0 }, |
| 140 | { "interbsc_ho_out:error", 0 }, |
| 141 | |
| 142 | { "interbsc_ho_in:attempted", 0 }, |
| 143 | { "interbsc_ho_in:completed", 0 }, |
| 144 | { "interbsc_ho_in:stopped", 0 }, |
| 145 | { "interbsc_ho_in:no_channel", 0 }, |
| 146 | { "interbsc_ho_in:timeout", 0 }, |
| 147 | { "interbsc_ho_in:failed", 0 }, |
| 148 | { "interbsc_ho_in:error", 0 } |
| 149 | }; |
| 150 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 151 | /* Set of all System Information received during one RSL port's startup. |
| 152 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 153 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 154 | */ |
| 155 | type record SystemInformationConfig { |
| 156 | SystemInformationType1 si1 optional, |
| 157 | SystemInformationType2 si2 optional, |
| 158 | SystemInformationType2bis si2bis optional, |
| 159 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 160 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 161 | SystemInformationType3 si3 optional, |
| 162 | SystemInformationType4 si4 optional, |
| 163 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 164 | octetstring si13 optional, |
| 165 | SystemInformationType5 si5 optional, |
| 166 | SystemInformationType5bis si5bis optional, |
| 167 | SystemInformationType5ter si5ter optional, |
| 168 | SystemInformationType6 si6 optional |
| 169 | }; |
| 170 | |
| 171 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 172 | si1 := omit, |
| 173 | si2 := omit, |
| 174 | si2bis := omit, |
| 175 | si2ter := omit, |
| 176 | si2quater := omit, |
| 177 | si3 := omit, |
| 178 | si4 := omit, |
| 179 | si13 := omit, |
| 180 | si5 := omit, |
| 181 | si5bis := omit, |
| 182 | si5ter := omit, |
| 183 | si6 := omit |
| 184 | }; |
| 185 | |
| 186 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 187 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 188 | template uint3_t meas_bw := 3) |
| 189 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 190 | meas_bw_presence := '1'B, |
| 191 | meas_bw := meas_bw); |
| 192 | |
| 193 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 194 | template EUTRAN_NeighbourCells tr_EUTRAN_NeighbourCells_default(template (present) EUTRAN_CellDescs cell_desc_list := { tr_EUTRAN_CellDesc_default }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 195 | template uint3_t prio := 3, |
| 196 | template (present) uint5_t thresh_high := 20, |
| 197 | template uint5_t thresh_low := 10, |
| 198 | template uint5_t qrxlevmin := 22) |
| 199 | := tr_EUTRAN_NeighbourCells( |
| 200 | cell_desc_list := cell_desc_list, |
| 201 | prio_presence := '1'B, |
| 202 | prio := prio, |
| 203 | thresh_high := thresh_high, |
| 204 | thresh_low_presence := '1'B, |
| 205 | thresh_low := thresh_low, |
| 206 | qrxlevmin_presence := '1'B, |
| 207 | qrxlevmin := qrxlevmin); |
| 208 | |
| 209 | template SystemInformationConfig SystemInformationConfig_default := { |
| 210 | si1 := { |
| 211 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 212 | rach_control := { |
| 213 | max_retrans := RACH_MAX_RETRANS_7, |
| 214 | tx_integer := '1001'B, |
| 215 | cell_barr_access := false, |
| 216 | re_not_allowed := true, |
| 217 | acc := '0000010000000000'B |
| 218 | }, |
| 219 | rest_octets := ? |
| 220 | }, |
| 221 | si2 := { |
| 222 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 223 | ncc_permitted := '11111111'B, |
| 224 | rach_control := { |
| 225 | max_retrans := RACH_MAX_RETRANS_7, |
| 226 | tx_integer := '1001'B, |
| 227 | cell_barr_access := false, |
| 228 | re_not_allowed := true, |
| 229 | acc := '0000010000000000'B |
| 230 | } |
| 231 | }, |
| 232 | si2bis := omit, |
| 233 | si2ter := { |
| 234 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 235 | rest_octets := ? |
| 236 | }, |
| 237 | si2quater := { |
| 238 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 239 | }, |
| 240 | si3 := { |
| 241 | cell_id := 0, |
| 242 | lai := { |
| 243 | mcc_mnc := '001F01'H, |
| 244 | lac := 1 |
| 245 | }, |
| 246 | ctrl_chan_desc := { |
| 247 | msc_r99 := true, |
| 248 | att := true, |
| 249 | bs_ag_blks_res := 1, |
| 250 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 251 | si22ind := false, |
| 252 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 253 | spare := '00'B, |
| 254 | bs_pa_mfrms := 3, |
| 255 | t3212 := 30 |
| 256 | }, |
| 257 | cell_options := { |
| 258 | dn_ind := false, |
| 259 | pwrc := false, |
| 260 | dtx := MS_SHALL_USE_UL_DTX, |
| 261 | radio_link_tout_div4 := 7 |
| 262 | }, |
| 263 | cell_sel_par := { |
| 264 | cell_resel_hyst_2dB := 2, |
| 265 | ms_txpwr_max_cch := 7, |
| 266 | acs := '0'B, |
| 267 | neci := true, |
| 268 | rxlev_access_min := 0 |
| 269 | }, |
| 270 | rach_control := { |
| 271 | max_retrans := RACH_MAX_RETRANS_7, |
| 272 | tx_integer := '1001'B, |
| 273 | cell_barr_access := false, |
| 274 | re_not_allowed := true, |
| 275 | acc := '0000010000000000'B |
| 276 | }, |
| 277 | rest_octets := { |
| 278 | sel_params := { |
| 279 | presence := '0'B, |
| 280 | params := omit |
| 281 | }, |
| 282 | pwr_offset := { |
| 283 | presence := '0'B, |
| 284 | offset := omit |
| 285 | }, |
| 286 | si_2ter_ind := '1'B, |
| 287 | early_cm_ind := '0'B, |
| 288 | sched_where := { |
| 289 | presence := '0'B, |
| 290 | where := omit |
| 291 | }, |
| 292 | gprs_ind := { |
| 293 | presence := '1'B, |
| 294 | ind := { |
| 295 | ra_colour := 0, |
| 296 | si13_pos := '0'B |
| 297 | } |
| 298 | }, |
| 299 | umts_early_cm_ind := '1'B, |
| 300 | si2_quater_ind := { |
| 301 | presence := '1'B, |
| 302 | ind := '0'B |
| 303 | }, |
| 304 | iu_mode_ind := omit, |
| 305 | si21_ind := { |
| 306 | presence := '0'B, |
| 307 | pos := omit |
| 308 | } |
| 309 | } |
| 310 | }, |
| 311 | si4 := { |
| 312 | lai := { |
| 313 | mcc_mnc := '001F01'H, |
| 314 | lac := 1 |
| 315 | }, |
| 316 | cell_sel_par := { |
| 317 | cell_resel_hyst_2dB := 2, |
| 318 | ms_txpwr_max_cch := 7, |
| 319 | acs := '0'B, |
| 320 | neci := true, |
| 321 | rxlev_access_min := 0 |
| 322 | }, |
| 323 | rach_control := { |
| 324 | max_retrans := RACH_MAX_RETRANS_7, |
| 325 | tx_integer := '1001'B, |
| 326 | cell_barr_access := false, |
| 327 | re_not_allowed := true, |
| 328 | acc := '0000010000000000'B |
| 329 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 330 | cbch_chan_desc := { |
| 331 | iei := '64'O, |
| 332 | v := { |
| 333 | chan_nr := { |
| 334 | u := { |
| 335 | sdcch4 := { |
| 336 | tag := '001'B, |
| 337 | sub_chan := 2 |
| 338 | } |
| 339 | }, |
| 340 | tn := 0 |
| 341 | }, |
| 342 | tsc := 2, |
| 343 | h := false, |
| 344 | arfcn := 871, |
| 345 | maio_hsn := omit |
| 346 | } |
| 347 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 348 | cbch_mobile_alloc := omit, |
| 349 | rest_octets := { |
| 350 | sel_params := { |
| 351 | presence := '0'B, |
| 352 | params := omit |
| 353 | }, |
| 354 | pwr_offset := { |
| 355 | presence := '0'B, |
| 356 | offset := omit |
| 357 | }, |
| 358 | gprs_ind := { |
| 359 | presence := '1'B, |
| 360 | ind := { |
| 361 | ra_colour := 0, |
| 362 | si13_pos := '0'B |
| 363 | } |
| 364 | }, |
| 365 | s_presence := '0'B, |
| 366 | s := omit |
| 367 | } |
| 368 | }, |
| 369 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 370 | si5 := { |
| 371 | bcch_freq_list := '10000000000000000000000000000000'O |
| 372 | }, |
| 373 | si5bis := omit, |
| 374 | si5ter := { |
| 375 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 376 | }, |
| 377 | si6 := { |
| 378 | cell_id := 0, |
| 379 | lai := { |
| 380 | mcc_mnc := '001F01'H, |
| 381 | lac := 1 |
| 382 | }, |
| 383 | cell_options := { |
| 384 | dtx_ext := '1'B, |
| 385 | pwrc := false, |
| 386 | dtx := '01'B, |
| 387 | radio_link_timeout := '0111'B |
| 388 | }, |
| 389 | ncc_permitted := '11111111'B, |
| 390 | rest_octets := ? |
| 391 | } |
| 392 | }; |
| 393 | |
| 394 | |
| 395 | /* List of all the System Information received on all RSL ports */ |
| 396 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 397 | |
| 398 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 399 | { |
| 400 | var RSL_IE_Body sysinfo_type_ie; |
| 401 | var RSL_IE_SysinfoType si_type; |
| 402 | var octetstring data; |
| 403 | |
| 404 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 405 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 406 | mtc.stop; |
| 407 | } |
| 408 | si_type := sysinfo_type_ie.sysinfo_type; |
| 409 | |
| 410 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 411 | var RSL_IE_Body bcch_ie; |
| 412 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 413 | data := bcch_ie.other.payload; |
| 414 | } |
| 415 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 416 | var RSL_IE_Body l3_ie; |
| 417 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 418 | data := l3_ie.l3_info.payload; |
| 419 | } |
| 420 | } else { |
| 421 | setverdict(fail, "Don't understand this System Information message"); |
| 422 | mtc.stop; |
| 423 | } |
| 424 | |
| 425 | var boolean handled := false; |
| 426 | |
| 427 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 428 | handled := true; |
| 429 | |
| 430 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 431 | if (not isbound(data)) { |
| 432 | si.si1 := omit; |
| 433 | } else { |
| 434 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 435 | } |
| 436 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 437 | if (not isbound(data)) { |
| 438 | si.si2 := omit; |
| 439 | } else { |
| 440 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 441 | } |
| 442 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 443 | if (not isbound(data)) { |
| 444 | si.si2bis := omit; |
| 445 | } else { |
| 446 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 447 | } |
| 448 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 449 | if (not isbound(data)) { |
| 450 | si.si2ter := omit; |
| 451 | } else { |
| 452 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 453 | } |
| 454 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 455 | if (not isbound(data)) { |
| 456 | si.si2quater := {}; |
| 457 | } else { |
| 458 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 459 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 460 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 461 | } |
| 462 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 463 | if (not isbound(data)) { |
| 464 | si.si3 := omit; |
| 465 | } else { |
| 466 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 467 | } |
| 468 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 469 | if (not isbound(data)) { |
| 470 | si.si4 := omit; |
| 471 | } else { |
| 472 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 473 | } |
| 474 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 475 | if (not isbound(data)) { |
| 476 | si.si13 := omit; |
| 477 | } else { |
| 478 | si.si13 := dec_SystemInformation(data).payload.other; |
| 479 | } |
| 480 | } else { |
| 481 | handled := false; |
| 482 | } |
| 483 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 484 | handled := true; |
| 485 | |
| 486 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 487 | if (not isbound(data)) { |
| 488 | si.si5 := omit; |
| 489 | } else { |
| 490 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 491 | } |
| 492 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 493 | if (not isbound(data)) { |
| 494 | si.si5bis := omit; |
| 495 | } else { |
| 496 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 497 | } |
| 498 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 499 | if (not isbound(data)) { |
| 500 | si.si5ter := omit; |
| 501 | } else { |
| 502 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 503 | } |
| 504 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 505 | if (not isbound(data)) { |
| 506 | si.si6 := omit; |
| 507 | } else { |
| 508 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 509 | } |
| 510 | } else { |
| 511 | handled := false; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | if (not handled) { |
| 516 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 517 | } |
| 518 | } |
| 519 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 520 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 521 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 522 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 523 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 524 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 525 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 526 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 527 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 528 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 529 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 530 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 531 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 532 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 533 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 534 | /* StatsD */ |
| 535 | var StatsD_Checker_CT vc_STATSD; |
| 536 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 537 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 538 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 539 | /* for old legacy-tests only */ |
| 540 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 541 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 542 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 543 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 544 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 545 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 546 | /* Osmux is enabled through VTY */ |
| 547 | var boolean g_osmux_enabled := false; |
| 548 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 549 | /*Configure T(tias) over VTY, seconds */ |
| 550 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 551 | /*Configure T(tiar) over VTY, seconds */ |
| 552 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 553 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 554 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 555 | timer T_guard := 30.0; |
| 556 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 557 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 558 | var CounterNameValsList g_ctr_bsc; |
| 559 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 560 | |
| 561 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 562 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 566 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 567 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 568 | /* port number to which to establish the IPA OML connections */ |
| 569 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 570 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 571 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 572 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 573 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 574 | /* port number to which to listen for STATSD metrics */ |
| 575 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 576 | /* IP address at which the test binds */ |
| 577 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 578 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 579 | RAN_Configurations mp_bssap_cfg := { |
| 580 | { |
| 581 | transport := BSSAP_TRANSPORT_AoIP, |
| 582 | sccp_service_type := "mtp3_itu", |
| 583 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 584 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 585 | own_ssn := 254, |
| 586 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 587 | peer_ssn := 254, |
| 588 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 589 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 590 | }, |
| 591 | { |
| 592 | transport := BSSAP_TRANSPORT_AoIP, |
| 593 | sccp_service_type := "mtp3_itu", |
| 594 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 595 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 596 | own_ssn := 254, |
| 597 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 598 | peer_ssn := 254, |
| 599 | sio := '83'O, |
| 600 | rctx := 2 |
| 601 | }, |
| 602 | { |
| 603 | transport := BSSAP_TRANSPORT_AoIP, |
| 604 | sccp_service_type := "mtp3_itu", |
| 605 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 606 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 607 | own_ssn := 254, |
| 608 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 609 | peer_ssn := 254, |
| 610 | sio := '83'O, |
| 611 | rctx := 3 |
| 612 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 613 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 614 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 615 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 616 | sccp_service_type := "mtp3_itu", |
| 617 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 618 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 619 | own_ssn := 252, /* SMLC side SSN */ |
| 620 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 621 | peer_ssn := 250, /* BSC side SSN */ |
| 622 | sio := '83'O, |
| 623 | rctx := 6 |
| 624 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 625 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 626 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 627 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 628 | unconditionally once new version of osmo-bsc is released (current |
| 629 | version: 1.4.1) */ |
| 630 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 631 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 632 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 633 | |
| 634 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 635 | } |
| 636 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 637 | private function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 638 | |
| 639 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 640 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 641 | pars.aoip := true; |
| 642 | } else { |
| 643 | pars.aoip := false; |
| 644 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 645 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 646 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 647 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 648 | |
| 649 | return pars; |
| 650 | } |
| 651 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 652 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 653 | |
| 654 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 655 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 656 | log("initial msc rate counters: ", g_ctr_msc); |
| 657 | } |
| 658 | |
| 659 | private function f_ctrs_msc_add(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 9656e92 | 2020-06-30 01:27:01 +0200 | [diff] [blame] | 660 | f_counter_name_vals_list_add(g_ctr_msc, msc_nr, countername, val); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | /* f_ctrs_msc_init(); |
| 664 | * f_do_thing(on_msc := 0); |
| 665 | * f_do_thing(on_msc := 0); |
| 666 | * f_do_other(on_msc := 1); |
| 667 | * f_ctrs_msc_add(0, "thing", 2); |
| 668 | * f_ctrs_msc_add(1, "other"); |
| 669 | * f_ctrs_msc_verify(); |
| 670 | */ |
| 671 | private function f_ctrs_msc_verify() runs on test_CT { |
| 672 | log("verifying msc rate counters: ", g_ctr_msc); |
| 673 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 674 | } |
| 675 | |
| 676 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 677 | * f_ctrs_msc_init(); |
| 678 | * f_do_thing(on_msc := 0); |
| 679 | * f_do_thing(on_msc := 0); |
| 680 | * f_do_thing(on_msc := 0); |
| 681 | * f_ctrs_msc_expect(0, "thing", 3); |
| 682 | */ |
| 683 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 684 | f_ctrs_msc_add(msc_nr, countername, val); |
| 685 | f_ctrs_msc_verify(); |
| 686 | } |
| 687 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 688 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 689 | |
| 690 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 691 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 692 | log("initial bts rate counters: ", g_ctr_bts); |
| 693 | f_ctrs_bsc_init(counternames); |
| 694 | } |
| 695 | |
| 696 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 697 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 698 | f_ctrs_bsc_add(countername, val); |
| 699 | } |
| 700 | |
| 701 | /* f_ctrs_bsc_and_bts_init(); |
| 702 | * f_do_thing(on_bts := 0); |
| 703 | * f_do_thing(on_bts := 0); |
| 704 | * f_do_other(on_bts := 1); |
| 705 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 706 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 707 | * f_ctrs_bsc_and_bts_verify(); |
| 708 | */ |
| 709 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 710 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 711 | f_ctrs_bsc_verify(); |
| 712 | } |
| 713 | |
| 714 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 715 | * f_ctrs_bsc_and_bts_init(); |
| 716 | * f_do_thing(on_bts := 0); |
| 717 | * f_do_thing(on_bts := 0); |
| 718 | * f_do_thing(on_bts := 0); |
| 719 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 720 | */ |
| 721 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 722 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 723 | f_ctrs_bsc_and_bts_verify(); |
| 724 | } |
| 725 | |
| 726 | |
| 727 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 728 | |
| 729 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 730 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 731 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 732 | } |
| 733 | |
| 734 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 735 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 736 | } |
| 737 | |
| 738 | /* f_ctrs_bsc_init(); |
| 739 | * f_do_thing(); |
| 740 | * f_do_thing(); |
| 741 | * f_do_other(); |
| 742 | * f_ctrs_bsc_add("thing", 2); |
| 743 | * f_ctrs_bsc_add("other"); |
| 744 | * f_ctrs_bsc_verify(); |
| 745 | */ |
| 746 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 747 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 748 | } |
| 749 | |
| 750 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 751 | * f_ctrs_bsc_init(); |
| 752 | * f_do_thing(); |
| 753 | * f_ctrs_bsc_expect("thing", 1); |
| 754 | */ |
| 755 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 756 | f_ctrs_bsc_add(countername, val); |
| 757 | f_ctrs_bsc_verify(); |
| 758 | } |
| 759 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 760 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 761 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 762 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 763 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 764 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 765 | } |
| 766 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 767 | private function f_legacy_bssap_reset(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 768 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 769 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 770 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 771 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 772 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 773 | T.start; |
| 774 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 775 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 776 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 777 | log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 778 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 779 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 780 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 781 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 782 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 783 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 784 | repeat; |
| 785 | } |
| 786 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 787 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 788 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 789 | /* If we received a RESET after ours was sent, it |
| 790 | may be a race condition where the other peer beacame |
| 791 | available after we sent it, but we are in a desired |
| 792 | state anyway, so go forward. */ |
| 793 | if (not reset_received) { |
| 794 | setverdict(fail); |
| 795 | } |
| 796 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 797 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 798 | } |
| 799 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 800 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 801 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 802 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 803 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 804 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 805 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 806 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 807 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 808 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 809 | } |
| 810 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 811 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 812 | * \param clnt IPA_Client for which to establish |
| 813 | * \param bsc_host IP address / hostname of the BSC |
| 814 | * \param bsc_port TCP port number of the BSC |
| 815 | * \param i number identifying this BTS |
| 816 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 817 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 818 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 819 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 820 | timer T := 10.0; |
| 821 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 822 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 823 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 824 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 825 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 826 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 827 | if (handler_mode) { |
| 828 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 829 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 830 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 831 | |
| 832 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 833 | if (handler_mode) { |
| 834 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 835 | } else { |
| 836 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 837 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 838 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 839 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars)); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 840 | if (handler_mode) { |
| 841 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 842 | return; |
| 843 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 844 | |
| 845 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 846 | T.start; |
| 847 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 848 | [] IPA_RSL[i].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 849 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 850 | IPA_RSL[i].send(ts_ASP_RSL_UD(ts_RSL_PAGING_LOAD_IND(23))); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 851 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 852 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 853 | [] IPA_RSL[i].receive { repeat } |
| 854 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 855 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 856 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 857 | } |
| 858 | } |
| 859 | } |
| 860 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 861 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 862 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 863 | return; |
| 864 | } |
| 865 | clnt.vc_IPA.stop; |
| 866 | if (isbound(clnt.vc_RSL)) { |
| 867 | clnt.vc_RSL.stop; |
| 868 | } |
| 869 | } |
| 870 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 871 | /* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 872 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 873 | timer T := secs_max; |
| 874 | T.start; |
| 875 | while (true) { |
| 876 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 877 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 878 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 879 | * until all MO's are initialized */ |
| 880 | T.start(1.0); |
| 881 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 882 | return; |
| 883 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 884 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 885 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 886 | setverdict(fail, "Timeout waiting for BTS" & int2str(bts_nr) & " oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 887 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 888 | } |
| 889 | } |
| 890 | } |
| 891 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 892 | /* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 893 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 894 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 895 | [] T_guard.timeout { |
| 896 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 897 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 898 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 899 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 900 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 901 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 902 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 903 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 904 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 907 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 908 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 909 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 910 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 911 | } |
| 912 | } |
| 913 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 914 | function f_init_mgcp(charstring id) runs on test_CT { |
| 915 | id := id & "-MGCP"; |
| 916 | |
| 917 | var MGCPOps ops := { |
| 918 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 919 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 920 | }; |
| 921 | var MGCP_conn_parameters mgcp_pars := { |
| 922 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 923 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 924 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 925 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 926 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 927 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 928 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 929 | }; |
| 930 | |
| 931 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 932 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 933 | } |
| 934 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 935 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 936 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 937 | * OsmuxCID IE. |
| 938 | */ |
| 939 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 940 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 941 | if (allow) { |
| 942 | f_vty_transceive(BSCVTY, "osmux on"); |
| 943 | } else { |
| 944 | f_vty_transceive(BSCVTY, "osmux off"); |
| 945 | } |
| 946 | f_vty_transceive(BSCVTY, "exit"); |
| 947 | f_vty_transceive(BSCVTY, "exit"); |
| 948 | g_osmux_enabled := allow; |
| 949 | } |
| 950 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 951 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 952 | if (BSCVTY.checkstate("Mapped")) { |
| 953 | /* skip initialization if already executed once */ |
| 954 | return; |
| 955 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 956 | map(self:BSCVTY, system:BSCVTY); |
| 957 | f_vty_set_prompts(BSCVTY); |
| 958 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 959 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 960 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 961 | } |
| 962 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 963 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 964 | { |
| 965 | // log on TTCN3 log output |
| 966 | log(log_msg); |
| 967 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 968 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 969 | } |
| 970 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 971 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 972 | { |
| 973 | if (rsl_idx >= lengthof(g_system_information)) { |
| 974 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 975 | } |
| 976 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 977 | } |
| 978 | |
| 979 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 980 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 981 | |
| 982 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 983 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 984 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 985 | repeat; |
| 986 | } |
| 987 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 988 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 989 | repeat; |
| 990 | } |
| 991 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 992 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 993 | repeat; |
| 994 | } |
| 995 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 996 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 997 | repeat; |
| 998 | } |
| 999 | |
| 1000 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1001 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1002 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1003 | repeat; |
| 1004 | } |
| 1005 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1006 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1007 | repeat; |
| 1008 | } |
| 1009 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1010 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1011 | repeat; |
| 1012 | } |
| 1013 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1014 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1015 | repeat; |
| 1016 | } |
| 1017 | } |
| 1018 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1019 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1020 | private type record of boolean my_BooleanList; |
| 1021 | |
| 1022 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1023 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1024 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1025 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1026 | for (var integer msc_nr := 0; msc_nr < sizeof(allow_attach_list); msc_nr := msc_nr+1) { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1027 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1028 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1029 | * stepping into that config node. */ |
| 1030 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1031 | continue; |
| 1032 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1033 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1034 | if (allow_attach_list[msc_nr]) { |
| 1035 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1036 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1037 | } else { |
| 1038 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1039 | } |
| 1040 | f_vty_transceive(pt, "exit"); |
| 1041 | f_vty_transceive(pt, "exit"); |
| 1042 | } |
| 1043 | } |
| 1044 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1045 | /* global initialization function |
| 1046 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1047 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1048 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1049 | */ |
| 1050 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false, |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1051 | integer nr_msc := 1, float guard_timeout := 30.0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1052 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1053 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1054 | if (g_initialized) { |
| 1055 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1056 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1057 | g_initialized := true; |
| 1058 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1059 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1060 | activate(as_Tguard()); |
| 1061 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1062 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1063 | if (mp_enable_osmux_test) { |
| 1064 | f_vty_allow_osmux(allow_osmux); |
| 1065 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1066 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1067 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1068 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1069 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1070 | for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) { |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1071 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1072 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1073 | * MSC-side BSSAP emulation */ |
| 1074 | if (handler_mode) { |
| 1075 | var RanOps ranops := MSC_RanOps; |
| 1076 | ranops.use_osmux := g_osmux_enabled; |
| 1077 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1078 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1079 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1080 | } else { |
| 1081 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1082 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1083 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1084 | f_legacy_bssap_reset(); |
| 1085 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1086 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1087 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1088 | if (mp_enable_lcs_tests) { |
| 1089 | if (handler_mode) { |
| 1090 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1091 | } else { |
| 1092 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1093 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1094 | } |
| 1095 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1096 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1097 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1098 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1099 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1100 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1101 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1102 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1103 | f_init_mgcp("VirtMSC"); |
| 1104 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1105 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1106 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1107 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1108 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1109 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1110 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1111 | runs on test_CT { |
| 1112 | /* wait until osmo-bts-omldummy has respawned */ |
| 1113 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1114 | |
| 1115 | /* start RSL connection */ |
| 1116 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1117 | /* wait until BSC tells us "connected" */ |
| 1118 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1119 | } |
| 1120 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1121 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1122 | template SystemInformationConfig expect_si) |
| 1123 | runs on test_CT { |
| 1124 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1125 | |
| 1126 | f_init_bts(bts_idx, handler_mode); |
| 1127 | |
| 1128 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1129 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1130 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1131 | */ |
| 1132 | f_sleep(5.0); |
| 1133 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1134 | |
| 1135 | deactivate(sysinfo); |
| 1136 | |
| 1137 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1138 | setverdict(pass); |
| 1139 | } else { |
| 1140 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1141 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1142 | setverdict(fail, "received SI does not match expectations"); |
| 1143 | return; |
| 1144 | } |
| 1145 | } |
| 1146 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1147 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1148 | function f_exp_ipa_rx(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1149 | runs on test_CT return RSL_Message { |
| 1150 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1151 | timer T := t_secs; |
| 1152 | |
| 1153 | T.start; |
| 1154 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1155 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1156 | T.stop; |
| 1157 | } |
| 1158 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1159 | [] T.timeout { |
| 1160 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1161 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1162 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1163 | } |
| 1164 | return rx_rsl_ud.rsl; |
| 1165 | } |
| 1166 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1167 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1168 | function f_ipa_tx(integer bts_nr, template (value) RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1169 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1170 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1171 | } |
| 1172 | |
| 1173 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1174 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1175 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1176 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1177 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1178 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1179 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1180 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1181 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1182 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1183 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1184 | } |
| 1185 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1186 | /* verify if the "chreq:total" counter increments as expected */ |
| 1187 | testcase TC_chan_act_counter() runs on test_CT { |
| 1188 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1189 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1190 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1191 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1192 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1193 | |
| 1194 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1195 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1196 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1197 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1198 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1199 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1200 | } |
| 1201 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1202 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1203 | private function f_TC_chan_act_ack_noest(OCT1 ra := '23'O) runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1204 | var RSL_Message rx_rsl; |
| 1205 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1206 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1207 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1208 | |
| 1209 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1210 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1211 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1212 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1213 | } |
| 1214 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1215 | /* Normal variant */ |
| 1216 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1217 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1218 | f_TC_chan_act_ack_noest(); |
| 1219 | } |
| 1220 | |
| 1221 | /* Emergency call variant */ |
| 1222 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1223 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1224 | f_init(1); |
| 1225 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1226 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1227 | } |
| 1228 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1229 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1230 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1231 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1232 | |
| 1233 | var RSL_Message rx_rsl; |
| 1234 | var GsmRrMessage rr; |
| 1235 | |
| 1236 | f_init(1); |
| 1237 | f_vty_allow_emerg_bts(false, 0); |
| 1238 | |
| 1239 | IPA_RSL[0].clear; |
| 1240 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1241 | |
| 1242 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1243 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1244 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1245 | setverdict(pass); |
| 1246 | } else { |
| 1247 | setverdict(fail, "immediate assignment not rejected"); |
| 1248 | } |
| 1249 | } |
| 1250 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | /* Test behavior if MSC never answers to CR */ |
| 1252 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1253 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1254 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1255 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1256 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1257 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1258 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1259 | |
| 1260 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1261 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | |
| 1263 | var octetstring l3 := '00010203040506'O |
| 1264 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1265 | |
| 1266 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1267 | |
| 1268 | /* expect BSC to disable the channel again if there's no response from MSC */ |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1269 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1270 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1271 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1272 | } |
| 1273 | |
| 1274 | /* Test behavior if MSC answers with CREF to CR */ |
| 1275 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1276 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1277 | var RSL_Message rx_rsl; |
| 1278 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1279 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1280 | |
| 1281 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1282 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1283 | |
| 1284 | var octetstring l3 := '00010203040506'O |
| 1285 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1286 | |
| 1287 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1288 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1289 | |
| 1290 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1291 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1292 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1293 | } |
| 1294 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1295 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1296 | testcase TC_chan_act_nack() runs on test_CT { |
| 1297 | var RSL_Message rx_rsl; |
| 1298 | var integer chact_nack; |
| 1299 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1300 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1301 | |
| 1302 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1303 | |
| 1304 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1305 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1306 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1307 | |
| 1308 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1309 | |
| 1310 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1311 | f_sleep(0.5); |
| 1312 | |
| 1313 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1314 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1315 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1316 | } |
| 1317 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1318 | /* Test for channel exhaustion due to RACH overload */ |
| 1319 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1320 | var ASP_RSL_Unitdata rsl_ud; |
| 1321 | var integer i; |
| 1322 | var integer chreq_total, chreq_nochan; |
| 1323 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1324 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1325 | |
| 1326 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1327 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1328 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1329 | /* GSM 04.08 Table 9.9a: |
| 1330 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1331 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1332 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1333 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1334 | } |
| 1335 | |
| 1336 | IPA_RSL[0].clear; |
| 1337 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1338 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1339 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1340 | |
| 1341 | /* now expect additional channel activations to fail */ |
| 1342 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1343 | |
| 1344 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1345 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1346 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1347 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1348 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1349 | var GsmRrMessage rr; |
| 1350 | /* match on IMM ASS REJ */ |
| 1351 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1352 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1353 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1354 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS+1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1355 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1356 | chreq_nochan+1); |
| 1357 | setverdict(pass); |
| 1358 | } else { |
| 1359 | repeat; |
| 1360 | } |
| 1361 | } |
| 1362 | [] IPA_RSL[0].receive { repeat; } |
| 1363 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1364 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1365 | } |
| 1366 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1367 | /* Test channel deactivation due to silence from MS */ |
| 1368 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1369 | var RslChannelNr chan_nr; |
| 1370 | |
| 1371 | f_init(1); |
| 1372 | |
| 1373 | /* Request for a dedicated channel */ |
| 1374 | chan_nr := f_chreq_act_ack('23'O); |
| 1375 | |
| 1376 | /* Wait some time until the channel is released */ |
| 1377 | f_sleep(2.0); |
| 1378 | |
| 1379 | /* Expect CHANnel RELease */ |
| 1380 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1381 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1382 | log("Received CHANnel RELease"); |
| 1383 | setverdict(pass); |
| 1384 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1385 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1386 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1387 | * Assignment Reject since a dedicated channel was |
| 1388 | * already allocated, and Immediate Assignment was |
| 1389 | * already sent. */ |
| 1390 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1391 | } |
| 1392 | [] IPA_RSL[0].receive { |
| 1393 | setverdict(fail, "Unexpected RSL message!"); |
| 1394 | } |
| 1395 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1396 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1397 | } |
| 1398 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1399 | /*********************************************************************** |
| 1400 | * Assignment Testing |
| 1401 | ***********************************************************************/ |
| 1402 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1403 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1404 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1405 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1406 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1407 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1408 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1409 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1410 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1411 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1412 | } |
| 1413 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1414 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1415 | testcase TC_assignment_cic_only(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1416 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1417 | var RSL_Message rx_rsl; |
| 1418 | var DchanTuple dt; |
| 1419 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1420 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1421 | |
| 1422 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1423 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1424 | /* send assignment without AoIP IEs */ |
| 1425 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1426 | } else { |
| 1427 | /* Send assignmetn without CIC in IPA case */ |
| 1428 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1429 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1430 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1431 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1432 | alt { |
| 1433 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1434 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1435 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1436 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1437 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1438 | setverdict(pass); |
| 1439 | } |
| 1440 | [] BSSAP.receive { repeat; } |
| 1441 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1442 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1443 | } |
| 1444 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1445 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1446 | function f_gen_ass_req(boolean osmux_enabled := false, integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1447 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1448 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1449 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1450 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1451 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1452 | if (osmux_enabled) { |
| 1453 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1454 | } else { |
| 1455 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1456 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1457 | } else { |
| 1458 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1459 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1460 | } |
| 1461 | return ass_cmd; |
| 1462 | } |
| 1463 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1464 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1465 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1466 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1467 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1468 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1469 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1470 | } else { |
| 1471 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1472 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1473 | } |
| 1474 | return ho_req; |
| 1475 | } |
| 1476 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1477 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1478 | function f_gen_exp_compl(boolean expect_osmux := false, integer bssap_idx := 0) return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1479 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1480 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1481 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1482 | if (expect_osmux) { |
| 1483 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1484 | } else { |
| 1485 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1486 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1487 | } else { |
| 1488 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1489 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1490 | } |
| 1491 | return exp_compl; |
| 1492 | } |
| 1493 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1494 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1495 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1496 | runs on test_CT { |
| 1497 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1498 | var RSL_Message rx_rsl; |
| 1499 | var DchanTuple dt; |
| 1500 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1501 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1502 | |
| 1503 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1504 | /* send assignment without AoIP IEs */ |
| 1505 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1506 | alt { |
| 1507 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1508 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1509 | setverdict(pass); |
| 1510 | } else { |
| 1511 | setverdict(fail, fail_text); |
| 1512 | } |
| 1513 | } |
| 1514 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1515 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1516 | setverdict(pass); |
| 1517 | } else { |
| 1518 | setverdict(fail, fail_text); |
| 1519 | } |
| 1520 | } |
| 1521 | [] BSSAP.receive { repeat; } |
| 1522 | } |
| 1523 | } |
| 1524 | testcase TC_assignment_csd() runs on test_CT { |
| 1525 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1526 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1527 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1528 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1529 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1530 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1531 | } |
| 1532 | |
| 1533 | testcase TC_assignment_ctm() runs on test_CT { |
| 1534 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1535 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1536 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1537 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1538 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1539 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1540 | } |
| 1541 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1542 | type record DchanTuple { |
| 1543 | integer sccp_conn_id, |
| 1544 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1545 | } |
| 1546 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1547 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1548 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1549 | runs on test_CT return RslChannelNr { |
| 1550 | var RSL_Message rx_rsl; |
| 1551 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1552 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1553 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1554 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Daniel Willmann | f4ac4ce | 2018-08-02 14:06:30 +0200 | [diff] [blame] | 1555 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1556 | return chan_nr; |
| 1557 | } |
| 1558 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1559 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1560 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1561 | runs on test_CT return DchanTuple { |
| 1562 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1563 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1564 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1565 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1566 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1567 | |
| 1568 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1569 | |
| 1570 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1571 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1572 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1573 | |
| 1574 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1575 | } |
| 1576 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1577 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1578 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1579 | var RSL_Message rx_rsl; |
| 1580 | /* expect BSC to disable the channel */ |
| 1581 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1582 | /* respond with CHAN REL ACK */ |
| 1583 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1584 | |
| 1585 | /* expect Clear Complete from BSC */ |
| 1586 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1587 | |
| 1588 | /* MSC disconnects as instructed. */ |
| 1589 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1590 | } |
| 1591 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1592 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1593 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1594 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1595 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1596 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1597 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1598 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1599 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1600 | |
| 1601 | /* simulate RLL REL IND */ |
| 1602 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1603 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1604 | /* expect Clear Request on MSC side */ |
| 1605 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1606 | |
| 1607 | /* Instruct BSC to clear channel */ |
| 1608 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1609 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1610 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1611 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1612 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1613 | |
| 1614 | /* wait for SCCP emulation to do its job */ |
| 1615 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1616 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1617 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1618 | } |
| 1619 | |
| 1620 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1621 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1622 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1623 | var DchanTuple dt; |
| 1624 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1625 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1626 | |
| 1627 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1628 | |
| 1629 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1630 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1631 | /* TODO: different cause values? */ |
| 1632 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1633 | /* expect Clear Request from BSC */ |
| 1634 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1635 | |
| 1636 | /* Instruct BSC to clear channel */ |
| 1637 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1638 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1639 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1640 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1641 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1642 | |
| 1643 | /* wait for SCCP emulation to do its job */ |
| 1644 | f_sleep(1.0); |
| 1645 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1646 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1647 | } |
| 1648 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1649 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1650 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1651 | testcase TC_early_conn_fail() runs on test_CT { |
| 1652 | var RSL_Message rx_rsl; |
| 1653 | var DchanTuple dt; |
| 1654 | |
| 1655 | f_init(1); |
| 1656 | |
| 1657 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1658 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_ra_cs(), 23); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1659 | |
| 1660 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1661 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1662 | |
| 1663 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1664 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1665 | |
| 1666 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1667 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1668 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1669 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1670 | } |
| 1671 | |
| 1672 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1673 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1674 | testcase TC_late_conn_fail() runs on test_CT { |
| 1675 | var RSL_Message rx_rsl; |
| 1676 | var DchanTuple dt; |
| 1677 | |
| 1678 | f_init(1); |
| 1679 | |
| 1680 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1681 | |
| 1682 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1683 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1684 | |
| 1685 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1686 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1687 | |
| 1688 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1689 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1690 | |
| 1691 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1692 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1693 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1694 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1695 | |
| 1696 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1697 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1698 | |
| 1699 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1700 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1701 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1702 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1703 | } |
| 1704 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1705 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1706 | boolean expect_deact_sacch := true, |
| 1707 | boolean expect_rr_chan_rel := true, |
| 1708 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1709 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1710 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1711 | template CellSelIndValue csfb_expect_cells := omit, |
| 1712 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1713 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1714 | |
| 1715 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1716 | var boolean got_deact_sacch := false; |
| 1717 | var boolean got_rr_chan_rel := false; |
| 1718 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1719 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1720 | var RSL_IE_Body l3_ie; |
| 1721 | var PDU_ML3_NW_MS l3; |
| 1722 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1723 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1724 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1725 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1726 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1727 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1728 | repeat; |
| 1729 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1730 | [is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CSFB))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1731 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1732 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1733 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1734 | setverdict(fail, "cannot find L3"); |
| 1735 | mtc.stop; |
| 1736 | } |
| 1737 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1738 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1739 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1740 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1741 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1742 | |
| 1743 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1744 | if (match(cells, csfb_expect_cells)) { |
| 1745 | setverdict(pass); |
| 1746 | } else { |
| 1747 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1748 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1749 | } |
| 1750 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1751 | |
| 1752 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1753 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1754 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1755 | if (match(got_cause, expect_rr_cause)) { |
| 1756 | setverdict(pass); |
| 1757 | } else { |
| 1758 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1759 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1760 | } |
| 1761 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1762 | repeat; |
| 1763 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1764 | [not is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1765 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1766 | |
| 1767 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1768 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1769 | setverdict(fail, "cannot find L3"); |
| 1770 | mtc.stop; |
| 1771 | } |
| 1772 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1773 | |
| 1774 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1775 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1776 | if (match(got_cause, expect_rr_cause)) { |
| 1777 | setverdict(pass); |
| 1778 | } else { |
| 1779 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1780 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1781 | } |
| 1782 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1783 | repeat; |
| 1784 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1785 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1786 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1787 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1788 | if (handle_rll_rel) { |
| 1789 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1790 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1791 | repeat; |
| 1792 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1793 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1794 | /* respond with CHAN REL ACK */ |
| 1795 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1796 | } |
| 1797 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1798 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1799 | repeat; |
| 1800 | } |
| 1801 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1802 | |
| 1803 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1804 | " got_rll_rel_req=", got_rll_rel_req); |
| 1805 | |
| 1806 | if (expect_deact_sacch != got_deact_sacch) { |
| 1807 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1808 | } |
| 1809 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1810 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1811 | } |
| 1812 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1813 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1814 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1815 | } |
| 1816 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1817 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1818 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1819 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1820 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1821 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1822 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1823 | |
| 1824 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1825 | |
| 1826 | /* Instruct BSC to clear channel */ |
| 1827 | var BssmapCause cause := 0; |
| 1828 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1829 | |
| 1830 | /* expect Clear Complete from BSC on A */ |
| 1831 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1832 | /* release the SCCP connection */ |
| 1833 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1834 | } |
| 1835 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1836 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1837 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1838 | } |
| 1839 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1840 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1841 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1842 | var BSSAP_N_DATA_ind rx_di; |
| 1843 | var DchanTuple dt; |
| 1844 | |
| 1845 | f_init(1); |
| 1846 | |
| 1847 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1848 | |
| 1849 | /* Instruct BSC to clear channel */ |
| 1850 | var BssmapCause cause := 0; |
| 1851 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1852 | |
| 1853 | /* expect Clear Complete from BSC on A */ |
| 1854 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1855 | /* release the SCCP connection */ |
| 1856 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1857 | } |
| 1858 | |
| 1859 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1860 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1861 | } |
| 1862 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1863 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1864 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1865 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1866 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1867 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1868 | |
| 1869 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1870 | |
| 1871 | /* release the SCCP connection */ |
| 1872 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1873 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1874 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1875 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1878 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1879 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1880 | var DchanTuple dt; |
| 1881 | |
| 1882 | f_init(1); |
| 1883 | |
| 1884 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1885 | |
| 1886 | /* release the SCCP connection */ |
| 1887 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1888 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1889 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1890 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1891 | } |
| 1892 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1893 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1894 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1895 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1896 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1897 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1898 | |
| 1899 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1900 | |
| 1901 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1902 | IPA_RSL[0].clear; |
| 1903 | |
| 1904 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1905 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1906 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1907 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1908 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1909 | } |
| 1910 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1911 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1912 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1913 | } |
| 1914 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1915 | /* Verify T(iar) triggers and releases the channel */ |
| 1916 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1917 | var DchanTuple dt; |
| 1918 | |
| 1919 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1920 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1921 | T(iar) >= T(ias)*2 */ |
| 1922 | g_bsc_sccp_timer_ias := 2; |
| 1923 | g_bsc_sccp_timer_iar := 5; |
| 1924 | |
| 1925 | f_init(1); |
| 1926 | |
| 1927 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1928 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1929 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1930 | } |
| 1931 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1932 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1933 | runs on test_CT |
| 1934 | { |
| 1935 | var DchanTuple dt; |
| 1936 | |
| 1937 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1938 | var BssmapCause cause := 0; |
| 1939 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1940 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1941 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1942 | } |
| 1943 | |
| 1944 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1945 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1949 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1950 | f_init(1); |
| 1951 | |
| 1952 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1953 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1954 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1955 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1956 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1957 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1958 | } |
| 1959 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1960 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1961 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1962 | timer T := 2.0; |
| 1963 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1964 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1965 | |
| 1966 | var octetstring l3 := '00010203040506'O; |
| 1967 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1968 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1969 | |
| 1970 | T.start; |
| 1971 | alt { |
| 1972 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1973 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1974 | } |
| 1975 | [] BSSAP.receive {} |
| 1976 | [] IPA_RSL[0].receive {} |
| 1977 | [] T.timeout {} |
| 1978 | } |
| 1979 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1980 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1981 | } |
| 1982 | |
| 1983 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1984 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1985 | var RslChannelNr chan_nr; |
| 1986 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1987 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1988 | |
| 1989 | chan_nr := f_chreq_act_ack() |
| 1990 | |
| 1991 | var octetstring l3 := '00010203040506'O; |
| 1992 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1993 | |
| 1994 | timer T := 2.0; |
| 1995 | T.start; |
| 1996 | alt { |
| 1997 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1998 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1999 | } |
| 2000 | [] BSSAP.receive { repeat; } |
| 2001 | [] IPA_RSL[0].receive { repeat; } |
| 2002 | [] T.timeout {} |
| 2003 | } |
| 2004 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2005 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2006 | } |
| 2007 | |
| 2008 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2009 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2010 | timer T := 2.0; |
| 2011 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2012 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2013 | |
| 2014 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2015 | |
| 2016 | var octetstring l3 := '00010203040506'O; |
| 2017 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2018 | |
| 2019 | T.start; |
| 2020 | alt { |
| 2021 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2022 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2023 | } |
| 2024 | [] BSSAP.receive { repeat; } |
| 2025 | [] IPA_RSL[0].receive { repeat; } |
| 2026 | [] T.timeout {} |
| 2027 | } |
| 2028 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2029 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2033 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2034 | timer T := 2.0; |
| 2035 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2036 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2037 | |
| 2038 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2039 | |
| 2040 | var octetstring l3 := '00010203040506'O; |
| 2041 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2042 | |
| 2043 | T.start; |
| 2044 | alt { |
| 2045 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2046 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2047 | } |
| 2048 | [] BSSAP.receive { repeat; } |
| 2049 | [] IPA_RSL[0].receive { repeat; } |
| 2050 | [] T.timeout {} |
| 2051 | } |
| 2052 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2053 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2054 | } |
| 2055 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2056 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2057 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2058 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2059 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2060 | |
| 2061 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2062 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2063 | |
| 2064 | f_establish_fully(ass_cmd, exp_compl); |
| 2065 | |
| 2066 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2067 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2068 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2069 | BSSAP.receive(PDU_BSSAP:{ |
| 2070 | discriminator := '1'B, |
| 2071 | spare := '0000000'B, |
| 2072 | dlci := 'C3'O, |
| 2073 | lengthIndicator := ?, |
| 2074 | pdu := { dtap := '0904'O } |
| 2075 | }); |
| 2076 | |
| 2077 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2078 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2079 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2080 | var template (value) RslLinkId link_id; |
| 2081 | var template (value) OCT1 dlci; |
| 2082 | |
| 2083 | if (i mod 2 == 0) { |
| 2084 | /* SAPI0 on FACCH or SDCCH */ |
| 2085 | link_id := ts_RslLinkID_DCCH(0); |
| 2086 | dlci := '80'O; |
| 2087 | } else { |
| 2088 | /* SAPI3 on SACCH */ |
| 2089 | link_id := ts_RslLinkID_SACCH(3); |
| 2090 | dlci := 'C3'O; |
| 2091 | } |
| 2092 | |
| 2093 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2094 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2095 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2096 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2097 | } |
| 2098 | } |
| 2099 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2100 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2101 | var MSC_ConnHdlr vc_conn; |
| 2102 | |
| 2103 | f_init(1, true); |
| 2104 | f_sleep(1.0); |
| 2105 | |
| 2106 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2107 | vc_conn.done; |
| 2108 | |
| 2109 | f_shutdown_helper(); |
| 2110 | } |
| 2111 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2112 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2113 | template myBSSMAP_Cause cause := ?, |
| 2114 | float T_val := 2.0) |
| 2115 | runs on test_CT { |
| 2116 | var BSSAP_N_DATA_ind rx_di; |
| 2117 | timer T; |
| 2118 | |
| 2119 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2120 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2121 | |
| 2122 | T.start(T_val); |
| 2123 | alt { |
| 2124 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2125 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2126 | if (not match(rx_cause, tr_cause)) { |
| 2127 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2128 | rx_cause, " vs expected ", tr_cause); |
| 2129 | } |
| 2130 | setverdict(pass); |
| 2131 | } |
| 2132 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2133 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2134 | } |
| 2135 | [] T.timeout { |
| 2136 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2137 | } |
| 2138 | } |
| 2139 | } |
| 2140 | |
| 2141 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2142 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2143 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2144 | var RSL_Message rx_rsl; |
| 2145 | var DchanTuple dt; |
| 2146 | |
| 2147 | f_init(1); |
| 2148 | |
| 2149 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2150 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2151 | |
| 2152 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2153 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2154 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2155 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2156 | |
| 2157 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2158 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2159 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2160 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2161 | |
| 2162 | /* Clean up the connection */ |
| 2163 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2164 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2165 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2166 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2167 | } |
| 2168 | |
| 2169 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2170 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2171 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2172 | var RSL_Message rx_rsl; |
| 2173 | var DchanTuple dt; |
| 2174 | |
| 2175 | f_init(1); |
| 2176 | |
| 2177 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2178 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2179 | |
| 2180 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2181 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2182 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2183 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2184 | |
| 2185 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2186 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2187 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2188 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2189 | |
| 2190 | /* Clean up the connection */ |
| 2191 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2192 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2193 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2194 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2195 | } |
| 2196 | |
| 2197 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2198 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2199 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2200 | var RSL_Message rx_rsl; |
| 2201 | var DchanTuple dt; |
| 2202 | |
| 2203 | f_init(1); |
| 2204 | |
| 2205 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2206 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2207 | |
| 2208 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2209 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2210 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2211 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2212 | |
| 2213 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2214 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2215 | |
| 2216 | /* Clean up the connection */ |
| 2217 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2218 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2219 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2220 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2221 | } |
| 2222 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2223 | testcase TC_si_default() runs on test_CT { |
| 2224 | f_init(0); |
| 2225 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2226 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2227 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2228 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2229 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2230 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2231 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2232 | { |
| 2233 | select (earfcn_index) { |
| 2234 | case (0) { |
| 2235 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2236 | return 111; |
| 2237 | } |
| 2238 | case (1) { |
| 2239 | return 1; |
| 2240 | } |
| 2241 | case (2) { |
| 2242 | return 0; |
| 2243 | } |
| 2244 | case (3) { |
| 2245 | return 65535; |
| 2246 | } |
| 2247 | case else { |
| 2248 | return 23 * (earfcn_index - 3); |
| 2249 | } |
| 2250 | } |
| 2251 | } |
| 2252 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2253 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2254 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2255 | |
| 2256 | f_init(0); |
| 2257 | |
| 2258 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2259 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2260 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2261 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2262 | } |
| 2263 | |
| 2264 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2265 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2266 | f_init(1); |
| 2267 | |
| 2268 | if (not istemplatekind(expect_cells, "omit")) { |
| 2269 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2270 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2271 | var BSSAP_N_DATA_ind rx_di; |
| 2272 | var DchanTuple dt; |
| 2273 | |
| 2274 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2275 | |
| 2276 | /* Instruct BSC to clear channel */ |
| 2277 | var BssmapCause cause := 0; |
| 2278 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2279 | |
| 2280 | /* expect Clear Complete from BSC on A */ |
| 2281 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2282 | /* release the SCCP connection */ |
| 2283 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2284 | } |
| 2285 | |
| 2286 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2287 | csfb_expect_cells := expect_cells); |
| 2288 | } |
| 2289 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2290 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2291 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list del earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i))}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2292 | } |
| 2293 | } |
| 2294 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2295 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2296 | { |
| 2297 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2298 | var integer si2quater_count := (count + 2) / 3; |
| 2299 | |
| 2300 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2301 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2302 | var integer index := i / 3; |
| 2303 | var integer earfcn_index := i mod 3; |
| 2304 | if (index >= lengthof(si2quater)) { |
| 2305 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2306 | } |
| 2307 | si2quater[index].rel_additions.rel5.rel6.rel7.rel8.prio_eutran_params_desc.desc.eutran_params_desc.desc.repeated_neigh_cells[0].cell_desc_list[earfcn_index] := tr_EUTRAN_CellDesc_default(e_arfcn := earfcn); |
| 2308 | } |
| 2309 | |
| 2310 | return si2quater; |
| 2311 | } |
| 2312 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2313 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2314 | { |
| 2315 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2316 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2317 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2318 | for (var integer i := 0; i < count; i := i + 1) { |
| 2319 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2320 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2321 | } |
| 2322 | |
| 2323 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2324 | } |
| 2325 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2326 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2327 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2328 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2329 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2330 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2331 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2332 | } |
| 2333 | |
| 2334 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2335 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2336 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2337 | } |
| 2338 | |
| 2339 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2340 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2341 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2342 | } |
| 2343 | |
| 2344 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2345 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2346 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2347 | } |
| 2348 | |
| 2349 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2350 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2351 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2352 | } |
| 2353 | |
| 2354 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2355 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2356 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2357 | } |
| 2358 | |
| 2359 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2360 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2361 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2362 | } |
| 2363 | |
| 2364 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2365 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2366 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2367 | } |
| 2368 | |
| 2369 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2370 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2371 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2372 | } |
| 2373 | |
| 2374 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2375 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2376 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2377 | } |
| 2378 | |
| 2379 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2380 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2381 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2382 | } |
| 2383 | |
| 2384 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2385 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2386 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2387 | } |
| 2388 | |
| 2389 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2390 | * 48 EARFCNs. */ |
| 2391 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2392 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2393 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2394 | f_init(0); |
| 2395 | |
| 2396 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2397 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2398 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2402 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2403 | var charstring vty_error; |
| 2404 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2405 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2406 | f_vty_transceive(BSCVTY, "end"); |
| 2407 | |
| 2408 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2409 | log("Got expected VTY error: ", vty_error); |
| 2410 | setverdict(pass); |
| 2411 | } else { |
| 2412 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2413 | } |
| 2414 | |
| 2415 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2416 | |
| 2417 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2418 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list del earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i))}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2419 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2420 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2421 | } |
| 2422 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2423 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2424 | { |
| 2425 | var uint8_t count := 0; |
| 2426 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2427 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2428 | count := count + 1; |
| 2429 | } |
| 2430 | } |
| 2431 | return count; |
| 2432 | } |
| 2433 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2434 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2435 | { |
| 2436 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2437 | var SystemInformationType1 last_si1; |
| 2438 | |
| 2439 | timer T := 30.0; |
| 2440 | T.start; |
| 2441 | alt { |
| 2442 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2443 | tr_RSL_BCCH_INFO, |
| 2444 | tr_RSL_NO_SACCH_FILL, |
| 2445 | tr_RSL_SACCH_FILL)) |
| 2446 | ) -> value rx_rsl_ud { |
| 2447 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2448 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2449 | repeat; |
| 2450 | } |
| 2451 | last_si1 := g_system_information[rsl_idx].si1; |
| 2452 | g_system_information[rsl_idx].si1 := omit; |
| 2453 | T.stop; |
| 2454 | } |
| 2455 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2456 | } |
| 2457 | return last_si1; |
| 2458 | } |
| 2459 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2460 | /* verify ACC rotate feature */ |
| 2461 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2462 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2463 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2464 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2465 | var uint8_t count; |
| 2466 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2467 | |
| 2468 | f_init(0, guard_timeout := 60.0); |
| 2469 | |
| 2470 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2471 | "access-control-class-rotate 3", |
| 2472 | "access-control-class-rotate-quantum 1"}); |
| 2473 | |
| 2474 | /* Init and get first sysinfo */ |
| 2475 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2476 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2477 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2478 | last_si1 := f_recv_next_si1(0); |
| 2479 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2480 | count := f_acc09_count_allowed(acc); |
| 2481 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2482 | |
| 2483 | if (count != 3) { |
| 2484 | log("RSL: EXPECTED SI ACC len=3"); |
| 2485 | setverdict(fail, "received SI does not match expectations"); |
| 2486 | break; |
| 2487 | } |
| 2488 | |
| 2489 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2490 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2491 | times_allowed[j] := times_allowed[j] + 1; |
| 2492 | } |
| 2493 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2497 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2498 | if (j != 5 and times_allowed[j] < 3) { |
| 2499 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2500 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2501 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2502 | } |
| 2503 | } |
| 2504 | |
| 2505 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2506 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2507 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2508 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2509 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2510 | /* verify ACC startup ramp+rotate feature */ |
| 2511 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2512 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2513 | var SystemInformationType1 last_si1; |
| 2514 | var AccessControlClass acc; |
| 2515 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2516 | var uint8_t count; |
| 2517 | var uint8_t prev_count; |
| 2518 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2519 | |
| 2520 | f_init(0, guard_timeout := 80.0); |
| 2521 | |
| 2522 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2523 | "access-control-class-rotate 0", |
| 2524 | "access-control-class-rotate-quantum 1", |
| 2525 | "access-control-class-ramping", |
| 2526 | "access-control-class-ramping-step-interval 5", |
| 2527 | "access-control-class-ramping-step-size 5"}); |
| 2528 | |
| 2529 | /* Init and get first sysinfo */ |
| 2530 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2531 | last_si1 := g_system_information[0].si1; |
| 2532 | acc := last_si1.rach_control.acc; |
| 2533 | count := f_acc09_count_allowed(acc); |
| 2534 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2535 | while (count > 0) { |
| 2536 | last_si1 := f_recv_next_si1(0); |
| 2537 | acc := last_si1.rach_control.acc; |
| 2538 | count := f_acc09_count_allowed(acc); |
| 2539 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2540 | } |
| 2541 | |
| 2542 | /* Increase adm subset size, we should see ramping start up */ |
| 2543 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2544 | prev_count := 0; |
| 2545 | while (true) { |
| 2546 | last_si1 := f_recv_next_si1(0); |
| 2547 | acc := last_si1.rach_control.acc; |
| 2548 | count := f_acc09_count_allowed(acc); |
| 2549 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2550 | |
| 2551 | if (prev_count > count) { |
| 2552 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2553 | break; |
| 2554 | } |
| 2555 | |
| 2556 | if (count == 9) { |
| 2557 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2558 | } |
| 2559 | |
| 2560 | prev_count := count; |
| 2561 | } |
| 2562 | |
| 2563 | setverdict(pass); |
| 2564 | |
| 2565 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2566 | "rach access-control-class 4 allowed", |
| 2567 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2568 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2569 | } |
| 2570 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2571 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2572 | var charstring ctrl_resp; |
| 2573 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2574 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2575 | |
| 2576 | /* See https://osmocom.org/issues/2729 */ |
| 2577 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2578 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2579 | } |
| 2580 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2581 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2582 | var charstring ctrl_resp; |
| 2583 | |
| 2584 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2585 | |
| 2586 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2587 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2588 | } |
| 2589 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2590 | testcase TC_ctrl() runs on test_CT { |
| 2591 | var charstring ctrl_resp; |
| 2592 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2593 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2594 | |
| 2595 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2596 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2597 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2598 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2599 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2600 | |
| 2601 | var integer bts_nr := 0; |
| 2602 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2603 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2604 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2605 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2606 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2607 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2608 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2609 | |
| 2610 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2611 | f_sleep(2.0); |
| 2612 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2613 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2614 | } |
| 2615 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2616 | |
| 2617 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2618 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2619 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2620 | } |
| 2621 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2622 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2623 | "location-state" over the SCCPlite IPA conn */ |
| 2624 | testcase TC_ctrl_location() runs on test_CT { |
| 2625 | var MSC_ConnHdlr vc_conn; |
| 2626 | var integer bts_nr := 0; |
| 2627 | |
| 2628 | f_init(1, true); |
| 2629 | f_sleep(1.0); |
| 2630 | |
| 2631 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2632 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2633 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2634 | |
| 2635 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2636 | f_sleep(2.0); |
| 2637 | |
| 2638 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2639 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2640 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2641 | |
| 2642 | /* should match the one from config */ |
| 2643 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2644 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2645 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2646 | } |
| 2647 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2648 | |
| 2649 | /*********************************************************************** |
| 2650 | * Paging Testing |
| 2651 | ***********************************************************************/ |
| 2652 | |
| 2653 | type record Cell_Identity { |
| 2654 | GsmMcc mcc, |
| 2655 | GsmMnc mnc, |
| 2656 | GsmLac lac, |
| 2657 | GsmCellId ci |
| 2658 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2659 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2660 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2661 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2662 | type set of integer BtsIdList; |
| 2663 | |
| 2664 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2665 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2666 | if (bts_id == bts_ids[j]) { |
| 2667 | return true; |
| 2668 | } |
| 2669 | } |
| 2670 | return false; |
| 2671 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2672 | |
| 2673 | /* core paging test helper function; used by most paging test cases */ |
| 2674 | private function f_pageing_helper(hexstring imsi, |
| 2675 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2676 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2677 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2678 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2679 | { |
| 2680 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2681 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2682 | var RSL_Message rx_rsl; |
| 2683 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2684 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2685 | |
| 2686 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2687 | |
| 2688 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2689 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2690 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2691 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2692 | |
| 2693 | if (isvalue(rsl_chneed)) { |
| 2694 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2695 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2696 | } else { |
| 2697 | bssmap_chneed := omit; |
| 2698 | } |
| 2699 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2700 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2701 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2702 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2703 | if (not istemplatekind(tmsi, "omit")) { |
| 2704 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2705 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2706 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2707 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2708 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2709 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2710 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(mi)); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2711 | /* check channel type, paging group */ |
| 2712 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2713 | setverdict(fail, "Paging for wrong paging group"); |
| 2714 | } |
| 2715 | if (ispresent(rsl_chneed) and |
| 2716 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2717 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2718 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2719 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2720 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2721 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2722 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2723 | timer T := 0.1; |
| 2724 | if (f_bts_in_list(i, bts_ids)) { |
| 2725 | continue; |
| 2726 | } |
| 2727 | T.start; |
| 2728 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2729 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(mi))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2730 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2731 | } |
| 2732 | [] IPA_RSL[i].receive { repeat; } |
| 2733 | [] T.timeout { } |
| 2734 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2735 | } |
| 2736 | |
| 2737 | setverdict(pass); |
| 2738 | } |
| 2739 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2740 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2741 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2742 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2743 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2744 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2745 | /* PAGING by IMSI + TMSI */ |
| 2746 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2747 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2748 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2749 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2750 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2751 | } |
| 2752 | |
| 2753 | /* PAGING by IMSI + TMSI */ |
| 2754 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2755 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2756 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2757 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, 'A1B2C301'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2758 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2759 | } |
| 2760 | |
| 2761 | /* Paging with different "channel needed' values */ |
| 2762 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2763 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2764 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2765 | f_pageing_helper('001010100000002'H, cid_list, c_BtsId_all, RSL_CHANNEED_ANY, 'A1B2C302'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2766 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2767 | } |
| 2768 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2769 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2770 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2771 | f_pageing_helper('001010100000003'H, cid_list, c_BtsId_all, RSL_CHANNEED_SDCCH, 'A1B2C303'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2772 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2773 | } |
| 2774 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2775 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2776 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2777 | f_pageing_helper('001010000000004'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_F, 'A1B2C304'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2778 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2779 | } |
| 2780 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2781 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2782 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2783 | f_pageing_helper('001010000000005'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_ForH, 'A1B2C305'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2784 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2785 | } |
| 2786 | |
| 2787 | /* Paging by CGI */ |
| 2788 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2789 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2790 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2791 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2792 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2793 | } |
| 2794 | |
| 2795 | /* Paging by LAC+CI */ |
| 2796 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2797 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2798 | cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2799 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2800 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | /* Paging by CI */ |
| 2804 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2805 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2806 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2807 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2808 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2809 | } |
| 2810 | |
| 2811 | /* Paging by LAI */ |
| 2812 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2813 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2814 | cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2815 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2816 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2817 | } |
| 2818 | |
| 2819 | /* Paging by LAC */ |
| 2820 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2821 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2822 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2823 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2824 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | /* Paging by "all in BSS" */ |
| 2828 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2829 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2830 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2831 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2832 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2833 | } |
| 2834 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2835 | /* Paging by PLMN+LAC+RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2836 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2837 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2838 | cid_list := { cIl_PLMN_LAC_RNC := { ts_BSSMAP_CI_PLMN_LAC_RNC(cid.mcc, cid.mnc, cid.lac, 12) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2839 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2840 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2841 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2842 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2843 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2844 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2845 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2846 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2847 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2848 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2849 | } |
| 2850 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2851 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2852 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2853 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2854 | cid_list := { cIl_LAC_RNC := { ts_BSSMAP_CI_LAC_RNC(cid.lac, 14) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2855 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2856 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2857 | } |
| 2858 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2859 | /* Paging on multiple cells (multiple entries in list): Verify all of them page */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2860 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2861 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2862 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2863 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2864 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2865 | } |
| 2866 | |
| 2867 | /* Paging on empty list: Verify none of them page */ |
| 2868 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2869 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2870 | cid_list := { cIl_LAC := { } }; |
| 2871 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2872 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2873 | } |
| 2874 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2875 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2876 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2877 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2878 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2879 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2880 | f_shutdown_helper(); |
| 2881 | } |
| 2882 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2883 | /* Verify paging retransmission interval + count */ |
| 2884 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2885 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2886 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2887 | /* Verify PCH load */ |
| 2888 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2889 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2890 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2891 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2892 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2893 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2894 | |
| 2895 | /* tell BSC there is no paging space anymore */ |
| 2896 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2897 | f_sleep(0.2); |
| 2898 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2899 | |
| 2900 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2901 | * there would be 8 retransmissions during 4 seconds */ |
| 2902 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2903 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2904 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2905 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2906 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2907 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2908 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2909 | [] T_retrans.timeout { |
| 2910 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2911 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2912 | T_retrans.start; |
| 2913 | repeat; |
| 2914 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2915 | [] T.timeout { |
| 2916 | setverdict(pass); |
| 2917 | } |
| 2918 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2919 | |
| 2920 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2921 | } |
| 2922 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2923 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2924 | testcase TC_paging_counter() runs on test_CT { |
| 2925 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2926 | timer T := 4.0; |
| 2927 | var integer i; |
| 2928 | var integer paging_attempted_bsc; |
| 2929 | var integer paging_attempted_bts[NUM_BTS]; |
| 2930 | var integer paging_expired_bts[NUM_BTS]; |
| 2931 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2932 | |
| 2933 | f_init(); |
| 2934 | |
| 2935 | /* read counters before paging */ |
| 2936 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2937 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2938 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2939 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2940 | } |
| 2941 | |
| 2942 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2943 | |
| 2944 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2945 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2946 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2947 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2948 | paging_attempted_bts[i]+1); |
| 2949 | } |
| 2950 | |
| 2951 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2952 | f_sleep(12.0); |
| 2953 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2954 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2955 | paging_expired_bts[i]+1); |
| 2956 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2957 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2958 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2959 | } |
| 2960 | |
| 2961 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2962 | /* Verify paging stops after A-RESET */ |
| 2963 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2964 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2965 | timer T := 3.0; |
| 2966 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2967 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2968 | |
| 2969 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2970 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2971 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2972 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2973 | [] BSSAP.receive { repeat; } |
| 2974 | } |
| 2975 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2976 | /* Wait to avoid a possible race condition if a paging message is |
| 2977 | * received right before the reset ACK. */ |
| 2978 | f_sleep(0.2); |
| 2979 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2980 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2981 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2982 | IPA_RSL[i].clear; |
| 2983 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2984 | |
| 2985 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2986 | T.start; |
| 2987 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2988 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2989 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2990 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2991 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2992 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2993 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2994 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2995 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2996 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2997 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2998 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2999 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3000 | [] T.timeout { |
| 3001 | setverdict(pass); |
| 3002 | } |
| 3003 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3004 | |
| 3005 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3006 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3007 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3008 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3009 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3010 | * pick the first configured MSC. This behavior is required in order to make |
| 3011 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3012 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3013 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3014 | */ |
| 3015 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3016 | |
| 3017 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3018 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3019 | |
| 3020 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3021 | var DchanTuple dt; |
| 3022 | var PDU_ML3_MS_NW l3 := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010008880018'H)))); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3023 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3024 | |
| 3025 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3026 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3027 | |
| 3028 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3029 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3030 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3031 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3032 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3033 | T.start; |
| 3034 | alt { |
| 3035 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3036 | setverdict(pass); |
| 3037 | } |
| 3038 | [] BSSAP.receive { |
| 3039 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3040 | } |
| 3041 | [] T.timeout { |
| 3042 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3043 | } |
| 3044 | } |
| 3045 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3046 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3047 | } |
| 3048 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3049 | /* Test RSL link drop causes counter increment */ |
| 3050 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3051 | var integer rsl_fail; |
| 3052 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3053 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3054 | |
| 3055 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3056 | |
| 3057 | bts[0].rsl.vc_IPA.stop; |
| 3058 | |
| 3059 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3060 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3061 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | /* TODO: Test OML link drop causes counter increment */ |
| 3065 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3066 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3067 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3068 | timer T := 10.0; |
| 3069 | |
| 3070 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3071 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3072 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3073 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3074 | bts[0].rsl.ccm_pars.unit_id := "99/0/0"; /* value which is unknown at BTS */ |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3075 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3076 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 3077 | |
| 3078 | f_init_mgcp("VirtMSC"); |
| 3079 | |
| 3080 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3081 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3082 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3083 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3084 | |
| 3085 | /* wait for IPA OML link to connect and then disconnect */ |
| 3086 | T.start; |
| 3087 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3088 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3089 | T.stop; |
| 3090 | return true; |
| 3091 | } |
| 3092 | [] IPA_RSL[0].receive { repeat } |
| 3093 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3094 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3095 | } |
| 3096 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3097 | return false; |
| 3098 | } |
| 3099 | |
| 3100 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3101 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3102 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3103 | setverdict(pass); |
| 3104 | } else { |
| 3105 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3106 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3107 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3108 | } |
| 3109 | |
| 3110 | |
| 3111 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3112 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3113 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3114 | setverdict(pass); |
| 3115 | } else { |
| 3116 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3117 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3118 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3119 | } |
| 3120 | |
| 3121 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3122 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3123 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3124 | ***********************************************************************/ |
| 3125 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3126 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3127 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3128 | import from RSL_Emulation all; |
| 3129 | import from MSC_ConnectionHandler all; |
| 3130 | |
| 3131 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3132 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3133 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3134 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3135 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3136 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3137 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3138 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3139 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3140 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3141 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3142 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3143 | if (isvalue(bts[2])) { |
| 3144 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3145 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3146 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3147 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3148 | if (mp_enable_lcs_tests) { |
| 3149 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3150 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3151 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3152 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3153 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3154 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3155 | } |
| 3156 | |
| 3157 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3158 | runs on test_CT return MSC_ConnHdlr { |
| 3159 | var charstring id := testcasename(); |
| 3160 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3161 | var integer bssap_idx := 0; |
| 3162 | if (isvalue(pars)) { |
| 3163 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3164 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3165 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3166 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3167 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3168 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3169 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3170 | return vc_conn; |
| 3171 | } |
| 3172 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3173 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3174 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3175 | runs on MSC_ConnHdlr { |
| 3176 | if (isvalue(pars)) { |
| 3177 | g_pars := valueof(pars); |
| 3178 | } |
| 3179 | fn.apply(id); |
| 3180 | } |
| 3181 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3182 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3183 | private function f_tc_ciph_mode_a5(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3184 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3185 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3186 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3187 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3188 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3189 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3190 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3191 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3192 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3193 | } |
| 3194 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3195 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3196 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3197 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3198 | |
| 3199 | f_init(1, true); |
| 3200 | f_sleep(1.0); |
| 3201 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3202 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3203 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3204 | } |
| 3205 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3206 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3207 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3208 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3209 | |
| 3210 | f_init(1, true); |
| 3211 | f_sleep(1.0); |
| 3212 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3213 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3214 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3215 | } |
| 3216 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3217 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3218 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3219 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3220 | |
| 3221 | f_init(1, true); |
| 3222 | f_sleep(1.0); |
| 3223 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3224 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3225 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3226 | } |
| 3227 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3228 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3229 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3230 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3231 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3232 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3233 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3234 | |
| 3235 | f_establish_fully(ass_cmd, exp_compl); |
| 3236 | } |
| 3237 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3238 | var MSC_ConnHdlr vc_conn; |
| 3239 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3240 | |
| 3241 | f_init(1, true); |
| 3242 | f_sleep(1.0); |
| 3243 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3244 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3245 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3246 | } |
| 3247 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3248 | |
| 3249 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3250 | private function f_tc_assignment_fr_a5(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3251 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3252 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3253 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3254 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3255 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 3256 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3257 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3258 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3259 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3260 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3261 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3262 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3263 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3264 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3265 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3266 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3267 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3268 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3269 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3270 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3271 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3272 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3273 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3274 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3275 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3276 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3277 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3278 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3279 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3280 | } |
| 3281 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3282 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3283 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3284 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3285 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3286 | f_init(1, true); |
| 3287 | f_sleep(1.0); |
| 3288 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3289 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3290 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3291 | } |
| 3292 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3293 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3294 | private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3295 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3296 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3297 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3298 | const OCT8 kc := '0001020304050607'O; |
| 3299 | |
| 3300 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3301 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3302 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3303 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3304 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3305 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3306 | var MSC_ConnHdlr vc_conn; |
| 3307 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3308 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3309 | f_sleep(1.0); |
| 3310 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3311 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_1_codec_missing)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3312 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3313 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3314 | } |
| 3315 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3316 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3317 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3318 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3319 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3320 | const OCT8 kc := '0001020304050607'O; |
| 3321 | const OCT16 kc128 := kc & kc; |
| 3322 | |
| 3323 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3324 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3325 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3326 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3327 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3328 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3329 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3330 | var MSC_ConnHdlr vc_conn; |
| 3331 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3332 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3333 | f_sleep(1.0); |
| 3334 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3335 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3336 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3337 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3338 | } |
| 3339 | |
| 3340 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3341 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3342 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3343 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3344 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3345 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3346 | |
| 3347 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3348 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3349 | |
| 3350 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3351 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3352 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3353 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3354 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3355 | }; |
| 3356 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3357 | } |
| 3358 | |
| 3359 | testcase TC_assignment_sign() runs on test_CT { |
| 3360 | var MSC_ConnHdlr vc_conn; |
| 3361 | |
| 3362 | f_init(1, true); |
| 3363 | f_sleep(1.0); |
| 3364 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3365 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3366 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3367 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3368 | } |
| 3369 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3370 | /*********************************************************************** |
| 3371 | * Codec (list) testing |
| 3372 | ***********************************************************************/ |
| 3373 | |
| 3374 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3375 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3376 | return boolean { |
| 3377 | select (a_elem.codecType) { |
| 3378 | case (GSM_FR) { |
| 3379 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3380 | return true; |
| 3381 | } |
| 3382 | } |
| 3383 | case (GSM_HR) { |
| 3384 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3385 | return true; |
| 3386 | } |
| 3387 | } |
| 3388 | case (GSM_EFR) { |
| 3389 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3390 | return true; |
| 3391 | } |
| 3392 | } |
| 3393 | case (FR_AMR) { |
| 3394 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3395 | return true; |
| 3396 | } |
| 3397 | } |
| 3398 | case (HR_AMR) { |
| 3399 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3400 | return true; |
| 3401 | } |
| 3402 | } |
| 3403 | case else { } |
| 3404 | } |
| 3405 | return false; |
| 3406 | } |
| 3407 | |
| 3408 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3409 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3410 | return boolean { |
| 3411 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3412 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3413 | return true; |
| 3414 | } |
| 3415 | } |
| 3416 | return false; |
| 3417 | } |
| 3418 | |
| 3419 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3420 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3421 | return BSSMAP_IE_ChannelType { |
| 3422 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3423 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3424 | select (a_elem.codecType) { |
| 3425 | case (GSM_FR) { |
| 3426 | ret.channelRateAndType := ChRate_TCHF; |
| 3427 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3428 | } |
| 3429 | case (GSM_HR) { |
| 3430 | ret.channelRateAndType := ChRate_TCHH; |
| 3431 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3432 | } |
| 3433 | case (GSM_EFR) { |
| 3434 | ret.channelRateAndType := ChRate_TCHF; |
| 3435 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3436 | } |
| 3437 | case (FR_AMR) { |
| 3438 | ret.channelRateAndType := ChRate_TCHF; |
| 3439 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3440 | } |
| 3441 | case (HR_AMR) { |
| 3442 | ret.channelRateAndType := ChRate_TCHH; |
| 3443 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3444 | } |
| 3445 | case else { |
| 3446 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3447 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3448 | } |
| 3449 | } |
| 3450 | return ret; |
| 3451 | } |
| 3452 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3453 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3454 | return template RSL_IE_Body { |
| 3455 | var template RSL_IE_Body mode_ie := { |
| 3456 | chan_mode := { |
| 3457 | len := ?, |
| 3458 | reserved := ?, |
| 3459 | dtx_d := ?, |
| 3460 | dtx_u := ?, |
| 3461 | spd_ind := RSL_SPDI_SPEECH, |
| 3462 | ch_rate_type := -, |
| 3463 | coding_alg_rate := - |
| 3464 | } |
| 3465 | } |
| 3466 | |
| 3467 | select (a_elem.codecType) { |
| 3468 | case (GSM_FR) { |
| 3469 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3470 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3471 | } |
| 3472 | case (GSM_HR) { |
| 3473 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3474 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3475 | } |
| 3476 | case (GSM_EFR) { |
| 3477 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3478 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3479 | } |
| 3480 | case (FR_AMR) { |
| 3481 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3482 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3483 | } |
| 3484 | case (HR_AMR) { |
| 3485 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3486 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3487 | } |
| 3488 | } |
| 3489 | return mode_ie; |
| 3490 | } |
| 3491 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3492 | type record CodecListTest { |
| 3493 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3494 | charstring id |
| 3495 | } |
| 3496 | type record of CodecListTest CodecListTests |
| 3497 | |
| 3498 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 3499 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3500 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3501 | |
| 3502 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3503 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3504 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3505 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3506 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3507 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3508 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3509 | g_pars.expect_mr_s0_s7; |
| 3510 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3511 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3512 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3513 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3514 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3515 | |
| 3516 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3517 | |
| 3518 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3519 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3520 | |
| 3521 | var RSL_IE_Body mode_ie; |
| 3522 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3523 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3524 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3525 | } |
| 3526 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3527 | if (not match(mode_ie, t_mode_ie)) { |
| 3528 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3529 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3530 | |
| 3531 | var RSL_IE_Body mr_conf; |
| 3532 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3533 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3534 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3535 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3536 | } |
| 3537 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3538 | |
| 3539 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3540 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3541 | g_pars.expect_mr_conf_ie); |
| 3542 | } |
| 3543 | } else { |
| 3544 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3545 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3546 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3547 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3548 | } |
| 3549 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3550 | } |
| 3551 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3552 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3553 | |
| 3554 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3555 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3556 | |
| 3557 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3558 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3559 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3560 | } |
| 3561 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3562 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3563 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3564 | |
| 3565 | f_establish_fully(ass_cmd, exp_fail); |
| 3566 | } |
| 3567 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3568 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3569 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3570 | var MSC_ConnHdlr vc_conn; |
| 3571 | |
| 3572 | f_init(1, true); |
| 3573 | f_sleep(1.0); |
| 3574 | |
| 3575 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3576 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3577 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3578 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3579 | } |
| 3580 | |
| 3581 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3582 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3583 | var MSC_ConnHdlr vc_conn; |
| 3584 | |
| 3585 | f_init(1, true); |
| 3586 | f_sleep(1.0); |
| 3587 | |
| 3588 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3589 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3590 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3591 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3592 | } |
| 3593 | |
| 3594 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3595 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3596 | var MSC_ConnHdlr vc_conn; |
| 3597 | |
| 3598 | f_init(1, true); |
| 3599 | f_sleep(1.0); |
| 3600 | |
| 3601 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3602 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3603 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3604 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3605 | } |
| 3606 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3607 | /* Allow 5,90k only (current default config) */ |
| 3608 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3609 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3610 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3611 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3612 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3613 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3614 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3615 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3616 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3617 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3618 | f_vty_transceive(BSCVTY, "exit"); |
| 3619 | f_vty_transceive(BSCVTY, "exit"); |
| 3620 | } |
| 3621 | |
| 3622 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3623 | * ("Config-NB-Code = 1") */ |
| 3624 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3625 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3626 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3627 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3628 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3629 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3630 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3631 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3632 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3633 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3634 | f_vty_transceive(BSCVTY, "exit"); |
| 3635 | f_vty_transceive(BSCVTY, "exit"); |
| 3636 | } |
| 3637 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3638 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3639 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3640 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3641 | |
| 3642 | /* Note: This setups the codec configuration. The parameter payload in |
| 3643 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3644 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3645 | var RSL_IE_Body mr_conf := { |
| 3646 | other := { |
| 3647 | len := 2, |
| 3648 | payload := '2804'O |
| 3649 | } |
| 3650 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3651 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3652 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3653 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3654 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3655 | pars.expect_mr_conf_ie := mr_conf; |
| 3656 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3657 | f_init(1, true); |
| 3658 | f_sleep(1.0); |
| 3659 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3660 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3661 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3662 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3663 | } |
| 3664 | |
| 3665 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3666 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3667 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3668 | |
| 3669 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3670 | var RSL_IE_Body mr_conf := { |
| 3671 | other := { |
| 3672 | len := 2, |
| 3673 | payload := '2804'O |
| 3674 | } |
| 3675 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3676 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3677 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3678 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3679 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3680 | pars.expect_mr_conf_ie := mr_conf; |
| 3681 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3682 | f_init(1, true); |
| 3683 | f_sleep(1.0); |
| 3684 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3685 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3686 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3687 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3688 | } |
| 3689 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3690 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3691 | runs on test_CT { |
| 3692 | |
| 3693 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3694 | var MSC_ConnHdlr vc_conn; |
| 3695 | |
| 3696 | /* See note above */ |
| 3697 | var RSL_IE_Body mr_conf := { |
| 3698 | other := { |
| 3699 | len := lengthof(mrconf), |
| 3700 | payload := mrconf |
| 3701 | } |
| 3702 | }; |
| 3703 | |
| 3704 | if (fr) { |
| 3705 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3706 | } else { |
| 3707 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3708 | } |
| 3709 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3710 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3711 | pars.expect_mr_conf_ie := mr_conf; |
| 3712 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3713 | |
| 3714 | f_init(1, true); |
| 3715 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3716 | f_sleep(1.0); |
| 3717 | |
| 3718 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3719 | vc_conn.done; |
| 3720 | f_allow_amr_rate_5_90k(); |
| 3721 | } |
| 3722 | |
| 3723 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3724 | runs on test_CT { |
| 3725 | |
| 3726 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3727 | var MSC_ConnHdlr vc_conn; |
| 3728 | |
| 3729 | if (fr) { |
| 3730 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3731 | } else { |
| 3732 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3733 | } |
| 3734 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3735 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3736 | |
| 3737 | f_init(1, true); |
| 3738 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3739 | f_sleep(1.0); |
| 3740 | |
| 3741 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3742 | vc_conn.done; |
| 3743 | f_allow_amr_rate_5_90k(); |
| 3744 | } |
| 3745 | |
| 3746 | |
| 3747 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3748 | * set. */ |
| 3749 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3750 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3751 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3752 | } |
| 3753 | |
| 3754 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3755 | * rates set. */ |
| 3756 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3757 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3758 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3759 | } |
| 3760 | |
| 3761 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3762 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3763 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3764 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3765 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3766 | } |
| 3767 | |
| 3768 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3769 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3770 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3771 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3772 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3773 | } |
| 3774 | |
| 3775 | /* The following block of tests selects more and more rates until all four |
| 3776 | * possible rates are in the active set (full rate) */ |
| 3777 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3778 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3779 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3780 | } |
| 3781 | |
| 3782 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3783 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3784 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3785 | } |
| 3786 | |
| 3787 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3788 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3789 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3790 | } |
| 3791 | |
| 3792 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3793 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3794 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3795 | } |
| 3796 | |
| 3797 | /* The following block of tests selects more and more rates until all three |
| 3798 | * possible rates are in the active set (half rate) */ |
| 3799 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3800 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3801 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3802 | } |
| 3803 | |
| 3804 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3805 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3806 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3807 | } |
| 3808 | |
| 3809 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3810 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3811 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3812 | } |
| 3813 | |
| 3814 | /* The following block tests what happens when the MSC does offer rate |
| 3815 | * configurations that are not supported by the BSC. Normally such situations |
| 3816 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3817 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3818 | * to offer rates that are not applicable anyway. */ |
| 3819 | |
| 3820 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3821 | /* Try to include 12,2k in into the active set even though the channel |
| 3822 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3823 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3824 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3825 | } |
| 3826 | |
| 3827 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3828 | /* See what happens when all rates are selected at once. Since then |
| 3829 | * Also S1 is selected, this setting will be prefered and we should |
| 3830 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3831 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3832 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3833 | } |
| 3834 | |
| 3835 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3836 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3837 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3838 | * 5,90k, and 4,75k, into the active set. */ |
| 3839 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3840 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3841 | } |
| 3842 | |
| 3843 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3844 | /* Try to select no rates at all */ |
| 3845 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3846 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3847 | } |
| 3848 | |
| 3849 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3850 | /* Try to select only unsupported rates */ |
| 3851 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3852 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3853 | } |
| 3854 | |
| 3855 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3856 | /* Try to select 12,2k for half rate */ |
| 3857 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3858 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3859 | } |
| 3860 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3861 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3862 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3863 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3864 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3865 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 borken"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3866 | } |
| 3867 | |
| 3868 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3869 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3870 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 borken"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3871 | } |
| 3872 | |
| 3873 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3874 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3875 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3876 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3877 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3878 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3879 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 unused"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3880 | } |
| 3881 | |
| 3882 | /* Allow HR only */ |
| 3883 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3884 | g_pars := f_gen_test_hdlr_pars(); |
| 3885 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3886 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3887 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3888 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3889 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3890 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3891 | f_establish_fully(ass_cmd, exp_compl); |
| 3892 | } |
| 3893 | |
| 3894 | /* Allow FR only */ |
| 3895 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3896 | g_pars := f_gen_test_hdlr_pars(); |
| 3897 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3898 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3899 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3900 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3901 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3902 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3903 | f_establish_fully(ass_cmd, exp_compl); |
| 3904 | } |
| 3905 | |
| 3906 | /* Allow HR only (expect assignment failure) */ |
| 3907 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3908 | g_pars := f_gen_test_hdlr_pars(); |
| 3909 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3910 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3911 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3912 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3913 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3914 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3915 | f_establish_fully(ass_cmd, exp_fail); |
| 3916 | } |
| 3917 | |
| 3918 | /* Allow FR only (expect assignment failure) */ |
| 3919 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3920 | g_pars := f_gen_test_hdlr_pars(); |
| 3921 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3922 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3923 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3924 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3925 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3926 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3927 | f_establish_fully(ass_cmd, exp_fail); |
| 3928 | } |
| 3929 | |
| 3930 | /* Allow FR and HR, but prefer FR */ |
| 3931 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3932 | g_pars := f_gen_test_hdlr_pars(); |
| 3933 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3934 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3935 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3936 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3937 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3938 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3939 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3940 | f_establish_fully(ass_cmd, exp_compl); |
| 3941 | } |
| 3942 | |
| 3943 | /* Allow FR and HR, but prefer HR */ |
| 3944 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3945 | g_pars := f_gen_test_hdlr_pars(); |
| 3946 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3947 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3948 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3949 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3950 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3951 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3952 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3953 | f_establish_fully(ass_cmd, exp_compl); |
| 3954 | } |
| 3955 | |
| 3956 | /* Allow FR and HR, but prefer FR */ |
| 3957 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3958 | g_pars := f_gen_test_hdlr_pars(); |
| 3959 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3960 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3961 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3962 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3963 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3964 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3965 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3966 | f_establish_fully(ass_cmd, exp_compl); |
| 3967 | } |
| 3968 | |
| 3969 | /* Allow FR and HR, but prefer HR */ |
| 3970 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3971 | g_pars := f_gen_test_hdlr_pars(); |
| 3972 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3973 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3974 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3975 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3976 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3977 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3978 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3979 | f_establish_fully(ass_cmd, exp_compl); |
| 3980 | } |
| 3981 | |
| 3982 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3983 | * to work without conflicts */ |
| 3984 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3985 | var MSC_ConnHdlr vc_conn; |
| 3986 | f_init(1, true); |
| 3987 | f_sleep(1.0); |
| 3988 | f_enable_all_tch(); |
| 3989 | f_disable_all_tch_f(); |
| 3990 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3991 | vc_conn.done; |
| 3992 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3993 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3994 | } |
| 3995 | |
| 3996 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 3997 | * to fail. */ |
| 3998 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 3999 | var MSC_ConnHdlr vc_conn; |
| 4000 | f_init(1, true); |
| 4001 | f_sleep(1.0); |
| 4002 | f_enable_all_tch(); |
| 4003 | f_disable_all_tch_f(); |
| 4004 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4005 | vc_conn.done; |
| 4006 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4007 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4008 | } |
| 4009 | |
| 4010 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4011 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4012 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4013 | var MSC_ConnHdlr vc_conn; |
| 4014 | f_init(1, true); |
| 4015 | f_sleep(1.0); |
| 4016 | f_enable_all_tch(); |
| 4017 | f_disable_all_tch_f(); |
| 4018 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4019 | vc_conn.done; |
| 4020 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4021 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4022 | } |
| 4023 | |
| 4024 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4025 | * are exhausted, this is expected to work without conflicts. */ |
| 4026 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4027 | var MSC_ConnHdlr vc_conn; |
| 4028 | f_init(1, true); |
| 4029 | f_sleep(1.0); |
| 4030 | f_enable_all_tch(); |
| 4031 | f_disable_all_tch_f(); |
| 4032 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4033 | vc_conn.done; |
| 4034 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4035 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4036 | } |
| 4037 | |
| 4038 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4039 | * to work without conflicts */ |
| 4040 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4041 | var MSC_ConnHdlr vc_conn; |
| 4042 | f_init(1, true); |
| 4043 | f_sleep(1.0); |
| 4044 | f_enable_all_tch(); |
| 4045 | f_disable_all_tch_h(); |
| 4046 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4047 | vc_conn.done; |
| 4048 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4049 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4050 | } |
| 4051 | |
| 4052 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4053 | * to fail. */ |
| 4054 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4055 | var MSC_ConnHdlr vc_conn; |
| 4056 | f_init(1, true); |
| 4057 | f_sleep(1.0); |
| 4058 | f_enable_all_tch(); |
| 4059 | f_disable_all_tch_h(); |
| 4060 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4061 | vc_conn.done; |
| 4062 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4063 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4064 | } |
| 4065 | |
| 4066 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4067 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4068 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4069 | var MSC_ConnHdlr vc_conn; |
| 4070 | f_init(1, true); |
| 4071 | f_sleep(1.0); |
| 4072 | f_enable_all_tch(); |
| 4073 | f_disable_all_tch_h(); |
| 4074 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4075 | vc_conn.done; |
| 4076 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4077 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4078 | } |
| 4079 | |
| 4080 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4081 | * are exhausted, this is expected to work without conflicts. */ |
| 4082 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4083 | var MSC_ConnHdlr vc_conn; |
| 4084 | f_init(1, true); |
| 4085 | f_sleep(1.0); |
| 4086 | f_enable_all_tch(); |
| 4087 | f_disable_all_tch_h(); |
| 4088 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4089 | vc_conn.done; |
| 4090 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4091 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4092 | } |
| 4093 | |
| 4094 | /* Allow FR and HR, but prefer HR */ |
| 4095 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4096 | g_pars := f_gen_test_hdlr_pars(); |
| 4097 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4098 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4099 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4100 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4101 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4102 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4103 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4104 | f_establish_fully(ass_cmd, exp_compl); |
| 4105 | } |
| 4106 | |
| 4107 | /* Allow FR and HR, but prefer FR */ |
| 4108 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4109 | g_pars := f_gen_test_hdlr_pars(); |
| 4110 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4111 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4112 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4113 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4114 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4115 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4116 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4117 | f_establish_fully(ass_cmd, exp_compl); |
| 4118 | } |
| 4119 | |
| 4120 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4121 | * HR, which is the prefered type, is selected. */ |
| 4122 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4123 | var MSC_ConnHdlr vc_conn; |
| 4124 | f_init(1, true); |
| 4125 | f_sleep(1.0); |
| 4126 | f_enable_all_tch(); |
| 4127 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4128 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4129 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4130 | } |
| 4131 | |
| 4132 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4133 | * FR, which is the prefered type, is selected. */ |
| 4134 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4135 | var MSC_ConnHdlr vc_conn; |
| 4136 | f_init(1, true); |
| 4137 | f_sleep(1.0); |
| 4138 | f_enable_all_tch(); |
| 4139 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4140 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4141 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4142 | } |
| 4143 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4144 | testcase TC_assignment_osmux() runs on test_CT { |
| 4145 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4146 | var MSC_ConnHdlr vc_conn; |
| 4147 | |
| 4148 | /* See note above */ |
| 4149 | var RSL_IE_Body mr_conf := { |
| 4150 | other := { |
| 4151 | len := 2, |
| 4152 | payload := '2804'O |
| 4153 | } |
| 4154 | }; |
| 4155 | |
| 4156 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4157 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4158 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4159 | pars.expect_mr_conf_ie := mr_conf; |
| 4160 | pars.use_osmux := true; |
| 4161 | |
| 4162 | f_init(1, true, true); |
| 4163 | f_sleep(1.0); |
| 4164 | |
| 4165 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4166 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4167 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4168 | } |
| 4169 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4170 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4171 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4172 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4173 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4174 | g_pars := f_gen_test_hdlr_pars(); |
| 4175 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4176 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4177 | /* we should now have a COMPL_L3 at the MSC */ |
| 4178 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4179 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4180 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4181 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4182 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4183 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4184 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4185 | setverdict(pass); |
| 4186 | } |
| 4187 | testcase TC_classmark() runs on test_CT { |
| 4188 | var MSC_ConnHdlr vc_conn; |
| 4189 | f_init(1, true); |
| 4190 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4191 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4192 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4193 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4194 | } |
| 4195 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4196 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4197 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4198 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4199 | g_pars := f_gen_test_hdlr_pars(); |
| 4200 | f_MscConnHdlr_init_vty(); |
| 4201 | |
| 4202 | f_create_chan_and_exp(); |
| 4203 | /* we should now have a COMPL_L3 at the MSC */ |
| 4204 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4205 | |
| 4206 | /* Send CommonID */ |
| 4207 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4208 | |
| 4209 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4210 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4211 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4212 | |
| 4213 | setverdict(pass); |
| 4214 | } |
| 4215 | testcase TC_common_id() runs on test_CT { |
| 4216 | var MSC_ConnHdlr vc_conn; |
| 4217 | f_init(1, true); |
| 4218 | f_sleep(1.0); |
| 4219 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4220 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4221 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4222 | } |
| 4223 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4224 | private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4225 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4226 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4227 | /* we should now have a COMPL_L3 at the MSC */ |
| 4228 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4229 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4230 | /* send the single message we want to send */ |
| 4231 | f_rsl_send_l3(l3); |
| 4232 | } |
| 4233 | |
| 4234 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4235 | timer T := sec; |
| 4236 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4237 | T.start; |
| 4238 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4239 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4240 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4241 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4242 | } |
| 4243 | [] T.timeout { |
| 4244 | setverdict(pass); |
| 4245 | } |
| 4246 | } |
| 4247 | } |
| 4248 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4249 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4250 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4251 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4252 | f_bssap_expect_nothing(); |
| 4253 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4254 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4255 | var MSC_ConnHdlr vc_conn; |
| 4256 | f_init(1, true); |
| 4257 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4258 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4259 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4260 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4261 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4262 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4263 | |
| 4264 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4265 | private function f_tc_unsol_ass_compl(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4266 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4267 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4268 | } |
| 4269 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4270 | var MSC_ConnHdlr vc_conn; |
| 4271 | f_init(1, true); |
| 4272 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4273 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4274 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4275 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4276 | } |
| 4277 | |
| 4278 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4279 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4280 | private function f_tc_unsol_ho_fail(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4281 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4282 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4283 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4284 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4285 | var MSC_ConnHdlr vc_conn; |
| 4286 | f_init(1, true); |
| 4287 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4288 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4289 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4290 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4291 | } |
| 4292 | |
| 4293 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4294 | /* short message from MS should be ignored */ |
| 4295 | private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4296 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4297 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4298 | /* we should now have a COMPL_L3 at the MSC */ |
| 4299 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4300 | |
| 4301 | /* send short message */ |
| 4302 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4303 | f_bssap_expect_nothing(); |
| 4304 | } |
| 4305 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4306 | var MSC_ConnHdlr vc_conn; |
| 4307 | f_init(1, true); |
| 4308 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4309 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4310 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4311 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4312 | } |
| 4313 | |
| 4314 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4315 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4316 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4317 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4318 | timer T := 3.0 |
| 4319 | alt { |
| 4320 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4321 | setverdict(pass); |
| 4322 | } |
| 4323 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4324 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4325 | } |
| 4326 | } |
| 4327 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4328 | var MSC_ConnHdlr vc_conn; |
| 4329 | f_init(1, true); |
| 4330 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4331 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4332 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4333 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4334 | } |
| 4335 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4336 | /*********************************************************************** |
| 4337 | * Handover |
| 4338 | ***********************************************************************/ |
| 4339 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4340 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4341 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4342 | runs on test_CT { |
| 4343 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4344 | " timeslot "&int2str(ts_nr)&" "; |
| 4345 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4346 | } |
| 4347 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4348 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4349 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4350 | uint8_t bts_nr, uint8_t trx_nr, |
| 4351 | in RslChannelNr chan_nr) |
| 4352 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4353 | /* FIXME: resolve those from component-global state */ |
| 4354 | var integer ts_nr := chan_nr.tn; |
| 4355 | var integer ss_nr; |
| 4356 | if (ischosen(chan_nr.u.ch0)) { |
| 4357 | ss_nr := 0; |
| 4358 | } else if (ischosen(chan_nr.u.lm)) { |
| 4359 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4360 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4361 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4362 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4363 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4364 | } else { |
| 4365 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4366 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4367 | } |
| 4368 | |
| 4369 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4370 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4371 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4372 | } |
| 4373 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4374 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4375 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4376 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4377 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4378 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4379 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4380 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4381 | { |
| 4382 | f_vty_ss_action(pt, "handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4383 | } |
| 4384 | |
| 4385 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4386 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4387 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4388 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4389 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4390 | const OCT8 kc := '0001020304050607'O; |
| 4391 | |
| 4392 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4393 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4394 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4395 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4396 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4397 | |
| 4398 | var HandoverState hs := { |
| 4399 | rr_ho_cmpl_seen := false, |
| 4400 | handover_done := false, |
| 4401 | old_chan_nr := - |
| 4402 | }; |
| 4403 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4404 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4405 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4406 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4407 | |
| 4408 | /* From the MGW perspective, a handover is is characterized by |
| 4409 | * performing one MDCX operation with the MGW. So we expect to see |
| 4410 | * one more MDCX during handover. */ |
| 4411 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4412 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4413 | alt { |
| 4414 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4415 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4416 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4417 | /* Since this is an internal handover we expect the BSC to inform the |
| 4418 | * MSC about the event */ |
| 4419 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4420 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4421 | /* Check the amount of MGCP transactions is still consistant with the |
| 4422 | * test expectation */ |
| 4423 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4424 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4425 | } |
| 4426 | |
| 4427 | testcase TC_ho_int() runs on test_CT { |
| 4428 | var MSC_ConnHdlr vc_conn; |
| 4429 | f_init(2, true); |
| 4430 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4431 | |
| 4432 | f_ctrs_bsc_and_bts_init(); |
| 4433 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4434 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4435 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4436 | |
| 4437 | /* from f_establish_fully() */ |
| 4438 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4439 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4440 | /* from handover */ |
| 4441 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4442 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4443 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4444 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4445 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4446 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4447 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4448 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4449 | /* Expecting MGCP to DLCX the endpoint's two connections: towards BTS and towards MSC */ |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4450 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4451 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4452 | var template MgcpResponse mgcp_resp; |
| 4453 | var MGCP_RecvFrom mrf; |
| 4454 | var template MgcpMessage msg_resp; |
| 4455 | var template MgcpMessage msg_dlcx := { |
| 4456 | command := tr_DLCX() |
| 4457 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4458 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4459 | if (g_pars.aoip) { |
| 4460 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4461 | log("Got first DLCX: ", mgcp); |
| 4462 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4463 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4464 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4465 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4466 | log("Got second DLCX: ", mgcp); |
| 4467 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4468 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4469 | } else { |
| 4470 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4471 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4472 | log("Got first DLCX: ", mrf.msg.command); |
| 4473 | msg_resp := { |
| 4474 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4475 | } |
| 4476 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4477 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4478 | } |
| 4479 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4480 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4481 | } |
| 4482 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4483 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4484 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4485 | |
| 4486 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4487 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4488 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4489 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4490 | f_establish_fully(ass_req, exp_compl); |
| 4491 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4492 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4493 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4494 | |
| 4495 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4496 | |
| 4497 | f_sleep(0.5); |
| 4498 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4499 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4500 | * containing an RR Handover Command coming from the target BSS... */ |
| 4501 | |
| 4502 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4503 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4504 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4505 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4506 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4507 | |
| 4508 | /* expect the Handover Command to go out on RR */ |
| 4509 | var RSL_Message rsl_ho_cmd |
| 4510 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4511 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4512 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4513 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4514 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4515 | setverdict(fail); |
| 4516 | } else { |
| 4517 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4518 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4519 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4520 | setverdict(fail); |
| 4521 | } else { |
| 4522 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4523 | setverdict(pass); |
| 4524 | } |
| 4525 | } |
| 4526 | |
| 4527 | /* When the other BSS has reported a completed handover, this side is |
| 4528 | * torn down. */ |
| 4529 | |
| 4530 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4531 | var BssmapCause cause := enum2int(cause_val); |
| 4532 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4533 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4534 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4535 | setverdict(pass); |
| 4536 | f_sleep(1.0); |
| 4537 | } |
| 4538 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4539 | var MSC_ConnHdlr vc_conn; |
| 4540 | |
| 4541 | f_init(1, true); |
| 4542 | f_sleep(1.0); |
| 4543 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4544 | f_ctrs_bsc_and_bts_init(); |
| 4545 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4546 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4547 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4548 | |
| 4549 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4550 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4551 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4552 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4553 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4554 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4555 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4556 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4557 | } |
| 4558 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4559 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4560 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4561 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4562 | octetstring l3 := '0123456789'O) |
| 4563 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4564 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4565 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4566 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4567 | var template PDU_BSSAP exp_data := { |
| 4568 | discriminator := '1'B, |
| 4569 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4570 | dlci := dlci, |
| 4571 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4572 | pdu := { |
| 4573 | dtap := l3 |
| 4574 | } |
| 4575 | }; |
| 4576 | BSSAP.receive(exp_data); |
| 4577 | setverdict(pass); |
| 4578 | } |
| 4579 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4580 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4581 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4582 | template (value) OCT1 dlci := '00'O, |
| 4583 | octetstring l3 := '0123456789'O) |
| 4584 | runs on MSC_ConnHdlr { |
| 4585 | BSSAP.send(PDU_BSSAP:{ |
| 4586 | discriminator := '1'B, |
| 4587 | spare := '0000000'B, |
| 4588 | dlci := dlci, |
| 4589 | lengthIndicator := lengthof(l3), |
| 4590 | pdu := { |
| 4591 | dtap := l3 |
| 4592 | } |
| 4593 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4594 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4595 | setverdict(pass); |
| 4596 | } |
| 4597 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4598 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4599 | * simply never sends a BSSMAP Handover Command. */ |
| 4600 | private function f_tc_ho_out_fail_no_msc_response(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 4601 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4602 | |
| 4603 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4604 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4605 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4606 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4607 | f_establish_fully(ass_req, exp_compl); |
| 4608 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4609 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4610 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4611 | |
| 4612 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4613 | |
| 4614 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4615 | * Let's give it a bit extra. */ |
| 4616 | f_sleep(15.0); |
| 4617 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4618 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4619 | f_sleep(1.0); |
| 4620 | } |
| 4621 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4622 | var MSC_ConnHdlr vc_conn; |
| 4623 | |
| 4624 | f_init(1, true); |
| 4625 | f_sleep(1.0); |
| 4626 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4627 | f_ctrs_bsc_and_bts_init(); |
| 4628 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4629 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4630 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4631 | |
| 4632 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4633 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4634 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4635 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4636 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4637 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4638 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4639 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4640 | } |
| 4641 | |
| 4642 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4643 | * RR Handover Failure. */ |
| 4644 | private function f_tc_ho_out_fail_rr_ho_failure(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 4645 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4646 | |
| 4647 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4648 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4649 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4650 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4651 | f_establish_fully(ass_req, exp_compl); |
| 4652 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4653 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4654 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4655 | |
| 4656 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4657 | |
| 4658 | f_sleep(0.5); |
| 4659 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4660 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4661 | * containing an RR Handover Command coming from the target BSS... */ |
| 4662 | |
| 4663 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4664 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4665 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4666 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4667 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4668 | |
| 4669 | /* expect the Handover Command to go out on RR */ |
| 4670 | var RSL_Message rsl_ho_cmd |
| 4671 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4672 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4673 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4674 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4675 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4676 | setverdict(fail); |
| 4677 | } else { |
| 4678 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4679 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4680 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4681 | setverdict(fail); |
| 4682 | } else { |
| 4683 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4684 | setverdict(pass); |
| 4685 | } |
| 4686 | } |
| 4687 | |
| 4688 | f_sleep(0.2); |
| 4689 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4690 | |
| 4691 | /* Should tell the MSC about the failure */ |
| 4692 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4693 | |
| 4694 | f_sleep(1.0); |
| 4695 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4696 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4697 | f_sleep(1.0); |
| 4698 | |
| 4699 | setverdict(pass); |
| 4700 | f_sleep(1.0); |
| 4701 | } |
| 4702 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4703 | var MSC_ConnHdlr vc_conn; |
| 4704 | |
| 4705 | f_init(1, true); |
| 4706 | f_sleep(1.0); |
| 4707 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4708 | f_ctrs_bsc_and_bts_init(); |
| 4709 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4710 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4711 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4712 | |
| 4713 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4714 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4715 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4716 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4717 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4718 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4719 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4720 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4721 | } |
| 4722 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4723 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4724 | * (neither BSSMAP Clear Command for success nor RR Handover Failure). 48.008 3.1.5.3.3 "Abnormal Conditions" applies |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4725 | * and the lchan is released. */ |
| 4726 | private function f_tc_ho_out_fail_no_result_after_ho_cmd(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 4727 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4728 | |
| 4729 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4730 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4731 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4732 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4733 | f_establish_fully(ass_req, exp_compl); |
| 4734 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4735 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4736 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4737 | |
| 4738 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4739 | |
| 4740 | f_sleep(0.5); |
| 4741 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4742 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4743 | * containing an RR Handover Command coming from the target BSS... */ |
| 4744 | |
| 4745 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4746 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4747 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4748 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4749 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4750 | |
| 4751 | /* expect the Handover Command to go out on RR */ |
| 4752 | var RSL_Message rsl_ho_cmd |
| 4753 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4754 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4755 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4756 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4757 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4758 | setverdict(fail); |
| 4759 | } else { |
| 4760 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4761 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4762 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4763 | setverdict(fail); |
| 4764 | } else { |
| 4765 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4766 | setverdict(pass); |
| 4767 | } |
| 4768 | } |
| 4769 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4770 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4771 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4772 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4773 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4774 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4775 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4776 | log("Got BSSMAP Clear Request"); |
| 4777 | /* Instruct BSC to clear channel */ |
| 4778 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4779 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4780 | |
| 4781 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4782 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4783 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4784 | log("Got Deact SACCH"); |
| 4785 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4786 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 4787 | log("Got RR Release"); |
| 4788 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4789 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4790 | log("Got RF Chan Rel"); |
| 4791 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4792 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4793 | } |
| 4794 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4795 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4796 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4797 | setverdict(pass); |
| 4798 | f_sleep(1.0); |
| 4799 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4800 | testcase TC_ho_out_fail_no_result_after_ho_cmd() runs on test_CT { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4801 | var MSC_ConnHdlr vc_conn; |
| 4802 | |
| 4803 | f_init(1, true); |
| 4804 | f_sleep(1.0); |
| 4805 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4806 | f_ctrs_bsc_and_bts_init(); |
| 4807 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4808 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_result_after_ho_cmd)); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4809 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4810 | |
| 4811 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4812 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4813 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4814 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4815 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4816 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4817 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4818 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4819 | } |
| 4820 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4821 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4822 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4823 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4824 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4825 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4826 | * before we get started. */ |
| 4827 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4828 | f_rslem_register(0, new_chan_nr); |
| 4829 | g_chan_nr := new_chan_nr; |
| 4830 | f_sleep(1.0); |
| 4831 | |
| 4832 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4833 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4834 | activate(as_Media()); |
| 4835 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4836 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4837 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4838 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4839 | |
| 4840 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4841 | |
| 4842 | var PDU_BSSAP rx_bssap; |
| 4843 | var octetstring ho_command_str; |
| 4844 | |
| 4845 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4846 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4847 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4848 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4849 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4850 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4851 | |
| 4852 | var GsmArfcn arfcn; |
| 4853 | var RslChannelNr actual_new_chan_nr; |
| 4854 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4855 | actual_new_chan_nr, arfcn); |
| 4856 | |
| 4857 | if (actual_new_chan_nr != new_chan_nr) { |
| 4858 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4859 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4860 | setverdict(fail); |
| 4861 | return; |
| 4862 | } |
| 4863 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4864 | |
| 4865 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4866 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4867 | * the new lchan with a Handover RACH: */ |
| 4868 | |
| 4869 | /* send handover detect */ |
| 4870 | |
| 4871 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4872 | |
| 4873 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4874 | |
| 4875 | /* send handover complete over the new channel */ |
| 4876 | |
| 4877 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4878 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4879 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4880 | |
| 4881 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4882 | setverdict(pass); |
| 4883 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4884 | function f_tc_ho_into_this_bsc_main(TestHdlrParams pars) runs on test_CT { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4885 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4886 | |
| 4887 | f_init(1, true); |
| 4888 | f_sleep(1.0); |
| 4889 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4890 | f_ctrs_bsc_and_bts_init(); |
| 4891 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4892 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4893 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4894 | |
| 4895 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 4896 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4897 | |
| 4898 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4899 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4900 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4901 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 4902 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4903 | } |
| 4904 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4905 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 4906 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4907 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4908 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4909 | } |
| 4910 | |
| 4911 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 4912 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4913 | pars.host_aoip_tla := "::6"; |
| 4914 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4915 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4916 | } |
| 4917 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4918 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 4919 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4920 | f_rslem_register(0, new_chan_nr); |
| 4921 | g_chan_nr := new_chan_nr; |
| 4922 | f_sleep(1.0); |
| 4923 | |
| 4924 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4925 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4926 | activate(as_Media()); |
| 4927 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4928 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4929 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4930 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4931 | |
| 4932 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4933 | |
| 4934 | var PDU_BSSAP rx_bssap; |
| 4935 | var octetstring ho_command_str; |
| 4936 | |
| 4937 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4938 | |
| 4939 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4940 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4941 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4942 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4943 | |
| 4944 | var GsmArfcn arfcn; |
| 4945 | var RslChannelNr actual_new_chan_nr; |
| 4946 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4947 | actual_new_chan_nr, arfcn); |
| 4948 | |
| 4949 | if (actual_new_chan_nr != new_chan_nr) { |
| 4950 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4951 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4952 | setverdict(fail); |
| 4953 | return; |
| 4954 | } |
| 4955 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4956 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 4957 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 4958 | f_sleep(1.0); |
| 4959 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4960 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4961 | * tells the MS to handover to the new lchan. In this case, the MS |
| 4962 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 4963 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 4964 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 4965 | * BSSMAP Clear Command: */ |
| 4966 | |
| 4967 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4968 | var BssmapCause cause := enum2int(cause_val); |
| 4969 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4970 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4971 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4972 | setverdict(pass); |
| 4973 | f_sleep(1.0); |
| 4974 | |
| 4975 | setverdict(pass); |
| 4976 | } |
| 4977 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 4978 | var MSC_ConnHdlr vc_conn; |
| 4979 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4980 | |
| 4981 | f_init(1, true); |
| 4982 | f_sleep(1.0); |
| 4983 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4984 | f_ctrs_bsc_and_bts_init(); |
| 4985 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4986 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4987 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4988 | |
| 4989 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 4990 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4991 | |
| 4992 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4993 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4994 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4995 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4996 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4997 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4998 | } |
| 4999 | |
| 5000 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5001 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5002 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5003 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5004 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5005 | * before we get started. */ |
| 5006 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5007 | f_rslem_register(0, new_chan_nr); |
| 5008 | g_chan_nr := new_chan_nr; |
| 5009 | f_sleep(1.0); |
| 5010 | |
| 5011 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5012 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5013 | activate(as_Media()); |
| 5014 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5015 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5016 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5017 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5018 | |
| 5019 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5020 | |
| 5021 | var PDU_BSSAP rx_bssap; |
| 5022 | var octetstring ho_command_str; |
| 5023 | |
| 5024 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5025 | |
| 5026 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5027 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5028 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5029 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5030 | |
| 5031 | var GsmArfcn arfcn; |
| 5032 | var RslChannelNr actual_new_chan_nr; |
| 5033 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5034 | actual_new_chan_nr, arfcn); |
| 5035 | |
| 5036 | if (actual_new_chan_nr != new_chan_nr) { |
| 5037 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5038 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5039 | setverdict(fail); |
| 5040 | return; |
| 5041 | } |
| 5042 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5043 | |
| 5044 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5045 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5046 | * the new lchan with a Handover RACH: */ |
| 5047 | |
| 5048 | /* send handover detect */ |
| 5049 | |
| 5050 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5051 | |
| 5052 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5053 | |
| 5054 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5055 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5056 | * Failure to the old BSS? */ |
| 5057 | |
| 5058 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5059 | var BssmapCause cause := enum2int(cause_val); |
| 5060 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5061 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5062 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5063 | f_sleep(1.0); |
| 5064 | } |
| 5065 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5066 | var MSC_ConnHdlr vc_conn; |
| 5067 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5068 | |
| 5069 | f_init(1, true); |
| 5070 | f_sleep(1.0); |
| 5071 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5072 | f_ctrs_bsc_and_bts_init(); |
| 5073 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5074 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5075 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5076 | |
| 5077 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5078 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5079 | |
| 5080 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5081 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5082 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5083 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5084 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5085 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5086 | } |
| 5087 | |
| 5088 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5089 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5090 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5091 | f_rslem_register(0, new_chan_nr); |
| 5092 | g_chan_nr := new_chan_nr; |
| 5093 | f_sleep(1.0); |
| 5094 | |
| 5095 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5096 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5097 | activate(as_Media()); |
| 5098 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5099 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5100 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5101 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5102 | |
| 5103 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5104 | |
| 5105 | var PDU_BSSAP rx_bssap; |
| 5106 | var octetstring ho_command_str; |
| 5107 | |
| 5108 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5109 | |
| 5110 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5111 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5112 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5113 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5114 | |
| 5115 | var GsmArfcn arfcn; |
| 5116 | var RslChannelNr actual_new_chan_nr; |
| 5117 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5118 | actual_new_chan_nr, arfcn); |
| 5119 | |
| 5120 | if (actual_new_chan_nr != new_chan_nr) { |
| 5121 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5122 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5123 | setverdict(fail); |
| 5124 | return; |
| 5125 | } |
| 5126 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5127 | |
| 5128 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5129 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5130 | * on the new lchan. */ |
| 5131 | |
| 5132 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5133 | |
| 5134 | /* Did osmo-bsc also send a Clear Request? */ |
| 5135 | timer T := 0.5; |
| 5136 | T.start; |
| 5137 | alt { |
| 5138 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5139 | [] T.timeout { } |
| 5140 | } |
| 5141 | |
| 5142 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5143 | * asked for it, this is a Handover Failure after all). */ |
| 5144 | |
| 5145 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5146 | var BssmapCause cause := enum2int(cause_val); |
| 5147 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5148 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5149 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5150 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5151 | } |
| 5152 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5153 | var MSC_ConnHdlr vc_conn; |
| 5154 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5155 | |
| 5156 | f_init(1, true); |
| 5157 | f_sleep(1.0); |
| 5158 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5159 | f_ctrs_bsc_and_bts_init(); |
| 5160 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5161 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5162 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5163 | |
| 5164 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5165 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5166 | |
| 5167 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5168 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5169 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5170 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5171 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5172 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5173 | } |
| 5174 | |
| 5175 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5176 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5177 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5178 | f_rslem_register(0, new_chan_nr); |
| 5179 | g_chan_nr := new_chan_nr; |
| 5180 | f_sleep(1.0); |
| 5181 | |
| 5182 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5183 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5184 | activate(as_Media()); |
| 5185 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5186 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5187 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5188 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5189 | |
| 5190 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5191 | |
| 5192 | var PDU_BSSAP rx_bssap; |
| 5193 | var octetstring ho_command_str; |
| 5194 | |
| 5195 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5196 | |
| 5197 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5198 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5199 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5200 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5201 | |
| 5202 | var GsmArfcn arfcn; |
| 5203 | var RslChannelNr actual_new_chan_nr; |
| 5204 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5205 | actual_new_chan_nr, arfcn); |
| 5206 | |
| 5207 | if (actual_new_chan_nr != new_chan_nr) { |
| 5208 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5209 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5210 | setverdict(fail); |
| 5211 | return; |
| 5212 | } |
| 5213 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5214 | |
| 5215 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5216 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5217 | * on the new lchan. */ |
| 5218 | |
| 5219 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5220 | |
| 5221 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5222 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5223 | |
| 5224 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5225 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5226 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5227 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5228 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5229 | f_sleep(1.0); |
| 5230 | } |
| 5231 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5232 | var MSC_ConnHdlr vc_conn; |
| 5233 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5234 | |
| 5235 | f_init(1, true); |
| 5236 | f_sleep(1.0); |
| 5237 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5238 | f_ctrs_bsc_and_bts_init(); |
| 5239 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5240 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5241 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5242 | |
| 5243 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5244 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5245 | |
| 5246 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5247 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5248 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5249 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5250 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5251 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5252 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5253 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5254 | type record of charstring Commands; |
| 5255 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5256 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5257 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5258 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5259 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5260 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5261 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5262 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5263 | } |
| 5264 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5265 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5266 | { |
| 5267 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5268 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5269 | f_vty_transceive(pt, cmds[i]); |
| 5270 | } |
| 5271 | f_vty_transceive(pt, "end"); |
| 5272 | } |
| 5273 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5274 | private function f_probe_for_handover(charstring log_label, |
| 5275 | charstring log_descr, |
| 5276 | charstring handover_vty_cmd, |
| 5277 | boolean expect_handover, |
| 5278 | boolean is_inter_bsc_handover := false) |
| 5279 | runs on MSC_ConnHdlr |
| 5280 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5281 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5282 | * lchans to be established on bts 1 or bts 2. */ |
| 5283 | f_rslem_suspend(RSL1_PROC); |
| 5284 | f_rslem_suspend(RSL2_PROC); |
| 5285 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5286 | var RSL_Message rsl; |
| 5287 | |
| 5288 | var charstring log_msg := " (expecting handover)" |
| 5289 | if (not expect_handover) { |
| 5290 | log_msg := " (expecting NO handover)"; |
| 5291 | } |
| 5292 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5293 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5294 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5295 | timer T := 2.0; |
| 5296 | T.start; |
| 5297 | |
| 5298 | alt { |
| 5299 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5300 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5301 | log("Rx L3 from net: ", l3); |
| 5302 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5303 | var RslChannelNr new_chan_nr; |
| 5304 | var GsmArfcn arfcn; |
| 5305 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5306 | new_chan_nr, arfcn); |
| 5307 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5308 | log(l3.msgs.rrm.handoverCommand); |
| 5309 | |
| 5310 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5311 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5312 | * anyway. */ |
| 5313 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5314 | f_rslem_resume(RSL1_PROC); |
| 5315 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5316 | f_rslem_resume(RSL2_PROC); |
| 5317 | |
| 5318 | if (expect_handover and not is_inter_bsc_handover) { |
| 5319 | setverdict(pass); |
| 5320 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5321 | } else { |
| 5322 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5323 | & log_label & ": " & log_descr); |
| 5324 | } |
| 5325 | |
| 5326 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5327 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5328 | * Handover Failure. */ |
| 5329 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5330 | |
| 5331 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5332 | f_sleep(0.5); |
| 5333 | RSL1.clear; |
| 5334 | RSL2.clear; |
| 5335 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5336 | break; |
| 5337 | } else { |
| 5338 | repeat; |
| 5339 | } |
| 5340 | } |
| 5341 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5342 | if (expect_handover and is_inter_bsc_handover) { |
| 5343 | setverdict(pass); |
| 5344 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5345 | } else { |
| 5346 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5347 | & log_label & ": " & log_descr); |
| 5348 | } |
| 5349 | |
| 5350 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5351 | |
| 5352 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5353 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5354 | * setting a short timeout and waiting is the only way. */ |
| 5355 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5356 | f_sleep(1.5); |
| 5357 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5358 | |
| 5359 | break; |
| 5360 | } |
| 5361 | [] T.timeout { |
| 5362 | if (expect_handover) { |
| 5363 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5364 | & log_label & ": " & log_descr); |
| 5365 | } else { |
| 5366 | setverdict(pass); |
| 5367 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5368 | } |
| 5369 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5370 | break; |
| 5371 | } |
| 5372 | } |
| 5373 | |
| 5374 | f_rslem_resume(RSL1_PROC); |
| 5375 | f_rslem_resume(RSL2_PROC); |
| 5376 | f_sleep(3.0); |
| 5377 | RSL.clear; |
| 5378 | |
| 5379 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5380 | } |
| 5381 | |
| 5382 | /* Test the effect of various neighbor configuration scenarios: |
| 5383 | * |
| 5384 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5385 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5386 | */ |
| 5387 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5388 | g_pars := f_gen_test_hdlr_pars(); |
| 5389 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5390 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5391 | const OCT8 kc := '0001020304050607'O; |
| 5392 | |
| 5393 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5394 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5395 | |
| 5396 | /* Establish lchan at bts 0 */ |
| 5397 | f_establish_fully(ass_cmd, exp_compl); |
| 5398 | |
| 5399 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5400 | f_vty_enter_cfg_network(BSCVTY); |
| 5401 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5402 | f_vty_transceive(BSCVTY, "end"); |
| 5403 | } |
| 5404 | |
| 5405 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5406 | f_tc_ho_neighbor_config_start(); |
| 5407 | |
| 5408 | /* |
| 5409 | * bts 0 ARFCN 871 BSIC 10 |
| 5410 | * bts 1 ARFCN 871 BSIC 11 |
| 5411 | * bts 2 ARFCN 871 BSIC 12 |
| 5412 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5413 | */ |
| 5414 | |
| 5415 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5416 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5417 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5418 | "handover any to arfcn 871 bsic 11", |
| 5419 | true); |
| 5420 | |
| 5421 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5422 | "handover any to arfcn 13 bsic 39", |
| 5423 | false); |
| 5424 | |
| 5425 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5426 | "handover any to arfcn 871 bsic 12", |
| 5427 | false); |
| 5428 | |
| 5429 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5430 | "handover any to arfcn 871 bsic 11", |
| 5431 | true); |
| 5432 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5433 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5434 | var MSC_ConnHdlr vc_conn; |
| 5435 | f_init(3, true, guard_timeout := 60.0); |
| 5436 | f_sleep(1.0); |
| 5437 | f_ctrs_bsc_and_bts_init(); |
| 5438 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5439 | vc_conn.done; |
| 5440 | |
| 5441 | /* f_tc_ho_neighbor_config_start() */ |
| 5442 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5443 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5444 | |
| 5445 | /* 1.a */ |
| 5446 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5447 | * handover quickly by sending a Handover Failure message. */ |
| 5448 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5449 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5450 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5451 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5452 | |
| 5453 | /* 1.b */ |
| 5454 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5455 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5456 | |
| 5457 | /* 1.c */ |
| 5458 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5459 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5460 | |
| 5461 | /* 1.d */ |
| 5462 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5463 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5464 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5465 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5466 | |
| 5467 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5468 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5469 | } |
| 5470 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5471 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5472 | f_tc_ho_neighbor_config_start(); |
| 5473 | |
| 5474 | /* |
| 5475 | * bts 0 ARFCN 871 BSIC 10 |
| 5476 | * bts 1 ARFCN 871 BSIC 11 |
| 5477 | * bts 2 ARFCN 871 BSIC 12 |
| 5478 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5479 | */ |
| 5480 | |
| 5481 | log("f_tc_ho_neighbor_config: 2. explicit local neighbor: 'neighbor bts 1'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5482 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5483 | f_sleep(0.5); |
| 5484 | |
| 5485 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5486 | "handover any to arfcn 871 bsic 11", |
| 5487 | true); |
| 5488 | |
| 5489 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5490 | "handover any to arfcn 871 bsic 12", |
| 5491 | false); |
| 5492 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5493 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5494 | var MSC_ConnHdlr vc_conn; |
| 5495 | f_init(3, true, guard_timeout := 50.0); |
| 5496 | f_sleep(1.0); |
| 5497 | f_ctrs_bsc_and_bts_init(); |
| 5498 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5499 | vc_conn.done; |
| 5500 | |
| 5501 | /* f_tc_ho_neighbor_config_start() */ |
| 5502 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5503 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5504 | |
| 5505 | /* 2.a */ |
| 5506 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5507 | * handover quickly by sending a Handover Failure message. */ |
| 5508 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5509 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5510 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5511 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5512 | |
| 5513 | /* 2.b */ |
| 5514 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5515 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5516 | |
| 5517 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5518 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5519 | } |
| 5520 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5521 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5522 | f_tc_ho_neighbor_config_start(); |
| 5523 | |
| 5524 | /* |
| 5525 | * bts 0 ARFCN 871 BSIC 10 |
| 5526 | * bts 1 ARFCN 871 BSIC 11 |
| 5527 | * bts 2 ARFCN 871 BSIC 12 |
| 5528 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5529 | */ |
| 5530 | |
| 5531 | log("f_tc_ho_neighbor_config: 3. explicit local neighbor: 'neighbor bts 2'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5532 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5533 | f_sleep(0.5); |
| 5534 | |
| 5535 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5536 | "handover any to arfcn 871 bsic 11", |
| 5537 | false); |
| 5538 | f_probe_for_handover("3.b", "HO to bts 2 works, explicitly listed as neighbor; no ambiguity because bts 3 is not listed as neighbor", |
| 5539 | "handover any to arfcn 871 bsic 12", |
| 5540 | true); |
| 5541 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5542 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5543 | var MSC_ConnHdlr vc_conn; |
| 5544 | f_init(3, true, guard_timeout := 50.0); |
| 5545 | f_sleep(1.0); |
| 5546 | f_ctrs_bsc_and_bts_init(); |
| 5547 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5548 | vc_conn.done; |
| 5549 | |
| 5550 | /* f_tc_ho_neighbor_config_start() */ |
| 5551 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5552 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5553 | |
| 5554 | /* 3.a */ |
| 5555 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5556 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5557 | |
| 5558 | /* 3.b */ |
| 5559 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5560 | * handover quickly by sending a Handover Failure message. */ |
| 5561 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5562 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5563 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5564 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5565 | |
| 5566 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5567 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5568 | } |
| 5569 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5570 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5571 | f_tc_ho_neighbor_config_start(); |
| 5572 | |
| 5573 | /* |
| 5574 | * bts 0 ARFCN 871 BSIC 10 |
| 5575 | * bts 1 ARFCN 871 BSIC 11 |
| 5576 | * bts 2 ARFCN 871 BSIC 12 |
| 5577 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5578 | */ |
| 5579 | |
| 5580 | log("f_tc_ho_neighbor_config: 4. explicit remote neighbor: 'neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5581 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor lac 99 arfcn 123 bsic 45"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5582 | f_sleep(0.5); |
| 5583 | |
| 5584 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5585 | "handover any to arfcn 871 bsic 11", |
| 5586 | false); |
| 5587 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5588 | "handover any to arfcn 871 bsic 12", |
| 5589 | false); |
| 5590 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5591 | "handover any to arfcn 123 bsic 45", |
| 5592 | true, true); |
| 5593 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5594 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5595 | var MSC_ConnHdlr vc_conn; |
| 5596 | f_init(3, true, guard_timeout := 50.0); |
| 5597 | f_sleep(1.0); |
| 5598 | f_ctrs_bsc_and_bts_init(); |
| 5599 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5600 | vc_conn.done; |
| 5601 | |
| 5602 | /* f_tc_ho_neighbor_config_start() */ |
| 5603 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5604 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5605 | |
| 5606 | /* 4.a */ |
| 5607 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5608 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5609 | |
| 5610 | /* 4.b */ |
| 5611 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5612 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5613 | |
| 5614 | /* 4.c */ |
| 5615 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5616 | * handover quickly by timing out after the Handover Required message */ |
| 5617 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5618 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5619 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5620 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5621 | |
| 5622 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5623 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5624 | } |
| 5625 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5626 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5627 | f_tc_ho_neighbor_config_start(); |
| 5628 | |
| 5629 | /* |
| 5630 | * bts 0 ARFCN 871 BSIC 10 |
| 5631 | * bts 1 ARFCN 871 BSIC 11 |
| 5632 | * bts 2 ARFCN 871 BSIC 12 |
| 5633 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5634 | */ |
| 5635 | |
| 5636 | log("f_tc_ho_neighbor_config: 5. explicit remote neighbor re-using ARFCN+BSIC: 'neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5637 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor lac 99 arfcn 871 bsic 12"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5638 | f_sleep(0.5); |
| 5639 | |
| 5640 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5641 | "handover any to arfcn 871 bsic 12", |
| 5642 | true, true); |
| 5643 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5644 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5645 | var MSC_ConnHdlr vc_conn; |
| 5646 | f_init(3, true); |
| 5647 | f_sleep(1.0); |
| 5648 | f_ctrs_bsc_and_bts_init(); |
| 5649 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5650 | vc_conn.done; |
| 5651 | |
| 5652 | /* f_tc_ho_neighbor_config_start() */ |
| 5653 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5654 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5655 | |
| 5656 | /* 5 */ |
| 5657 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5658 | * handover quickly by timing out after the Handover Required message */ |
| 5659 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5660 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5661 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5662 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5663 | |
| 5664 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5665 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5666 | } |
| 5667 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5668 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5669 | f_tc_ho_neighbor_config_start(); |
| 5670 | |
| 5671 | /* |
| 5672 | * bts 0 ARFCN 871 BSIC 10 |
| 5673 | * bts 1 ARFCN 871 BSIC 11 |
| 5674 | * bts 2 ARFCN 871 BSIC 12 |
| 5675 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5676 | */ |
| 5677 | |
| 5678 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5679 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5680 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 871 bsic 12"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5681 | f_sleep(0.5); |
| 5682 | |
| 5683 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5684 | "handover any to arfcn 871 bsic 12", |
| 5685 | false); |
| 5686 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5687 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5688 | var MSC_ConnHdlr vc_conn; |
| 5689 | f_init(3, true); |
| 5690 | f_sleep(1.0); |
| 5691 | f_ctrs_bsc_and_bts_init(); |
| 5692 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5693 | vc_conn.done; |
| 5694 | |
| 5695 | /* f_tc_ho_neighbor_config_start() */ |
| 5696 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5697 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5698 | |
| 5699 | /* 6.a */ |
| 5700 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5701 | * handover quickly by timing out after the Handover Required message */ |
| 5702 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5703 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5704 | |
| 5705 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5706 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5707 | } |
| 5708 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5709 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5710 | f_tc_ho_neighbor_config_start(); |
| 5711 | |
| 5712 | /* |
| 5713 | * bts 0 ARFCN 871 BSIC 10 |
| 5714 | * bts 1 ARFCN 871 BSIC 11 |
| 5715 | * bts 2 ARFCN 871 BSIC 12 |
| 5716 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5717 | */ |
| 5718 | |
| 5719 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5720 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5721 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 123 bsic 45"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5722 | f_sleep(0.5); |
| 5723 | |
| 5724 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5725 | "handover any to arfcn 871 bsic 12", |
| 5726 | true); |
| 5727 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5728 | "handover any to arfcn 123 bsic 45", |
| 5729 | true, true); |
| 5730 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5731 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5732 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5733 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5734 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5735 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5736 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5737 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5738 | |
| 5739 | /* f_tc_ho_neighbor_config_start() */ |
| 5740 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5741 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5742 | |
| 5743 | /* 7.a */ |
| 5744 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5745 | * handover quickly by sending a Handover Failure message. */ |
| 5746 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5747 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5748 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5749 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5750 | |
| 5751 | /* 7.b */ |
| 5752 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5753 | * handover quickly by timing out after the Handover Required message */ |
| 5754 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5755 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5756 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5757 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5758 | |
| 5759 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5760 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5761 | } |
| 5762 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5763 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5764 | * BSSMAP Reset just because of that. */ |
| 5765 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5766 | var default d; |
| 5767 | var integer i; |
| 5768 | var DchanTuple dt; |
| 5769 | |
| 5770 | f_init(); |
| 5771 | |
| 5772 | /* Wait for initial BSSMAP Reset to pass */ |
| 5773 | f_sleep(4.0); |
| 5774 | |
| 5775 | d := activate(no_bssmap_reset()); |
| 5776 | |
| 5777 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5778 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5779 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5780 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5781 | /* Since we're doing a lot of runs, give each one a fresh |
| 5782 | * T_guard from the top. */ |
| 5783 | T_guard.start; |
| 5784 | |
| 5785 | /* Setup a BSSAP connection and clear it right away. This is |
| 5786 | * the MSC telling the BSC about a planned release, it's not an |
| 5787 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5788 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5789 | |
| 5790 | /* MSC disconnects (RLSD). */ |
| 5791 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5792 | } |
| 5793 | |
| 5794 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5795 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5796 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5797 | f_sleep(4.0); |
| 5798 | |
| 5799 | deactivate(d); |
| 5800 | f_shutdown_helper(); |
| 5801 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5802 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5803 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5804 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5805 | * the MSC. */ |
| 5806 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5807 | var default d; |
| 5808 | var integer i; |
| 5809 | var DchanTuple dt; |
| 5810 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5811 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5812 | var BssmapCause cause := enum2int(cause_val); |
| 5813 | |
| 5814 | f_init(); |
| 5815 | |
| 5816 | /* Wait for initial BSSMAP Reset to pass */ |
| 5817 | f_sleep(4.0); |
| 5818 | |
| 5819 | d := activate(no_bssmap_reset()); |
| 5820 | |
| 5821 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5822 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5823 | * Let's do it some more times for good measure. */ |
| 5824 | for (i := 0; i < 8; i := i+1) { |
| 5825 | /* Since we're doing a lot of runs, give each one a fresh |
| 5826 | * T_guard from the top. */ |
| 5827 | T_guard.start; |
| 5828 | |
| 5829 | /* Setup a BSSAP connection and clear it right away. This is |
| 5830 | * the MSC telling the BSC about a planned release, it's not an |
| 5831 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5832 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5833 | |
| 5834 | /* Instruct BSC to clear channel */ |
| 5835 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5836 | |
| 5837 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5838 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5839 | } |
| 5840 | |
| 5841 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5842 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5843 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5844 | f_sleep(4.0); |
| 5845 | |
| 5846 | deactivate(d); |
| 5847 | f_shutdown_helper(); |
| 5848 | } |
| 5849 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5850 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5851 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5852 | * Release Ind on RSL. */ |
| 5853 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5854 | var default d; |
| 5855 | var integer i; |
| 5856 | var DchanTuple dt; |
| 5857 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5858 | var integer j; |
| 5859 | |
| 5860 | f_init(); |
| 5861 | |
| 5862 | /* Wait for initial BSSMAP Reset to pass */ |
| 5863 | f_sleep(4.0); |
| 5864 | |
| 5865 | d := activate(no_bssmap_reset()); |
| 5866 | |
| 5867 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5868 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5869 | * Let's do it some more times for good measure. */ |
| 5870 | for (i := 0; i < 8; i := i+1) { |
| 5871 | /* Since we're doing a lot of runs, give each one a fresh |
| 5872 | * T_guard from the top. */ |
| 5873 | T_guard.start; |
| 5874 | |
| 5875 | /* Setup a BSSAP connection and clear it right away. This is |
| 5876 | * the MSC telling the BSC about a planned release, it's not an |
| 5877 | * erratic loss of a connection. */ |
| 5878 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5879 | |
| 5880 | /* simulate RLL REL IND */ |
| 5881 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5882 | |
| 5883 | /* expect Clear Request on MSC side */ |
| 5884 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5885 | |
| 5886 | /* Instruct BSC to clear channel */ |
| 5887 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5888 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5889 | |
| 5890 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5891 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5892 | } |
| 5893 | |
| 5894 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5895 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5896 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5897 | f_sleep(4.0); |
| 5898 | |
| 5899 | deactivate(d); |
| 5900 | f_shutdown_helper(); |
| 5901 | } |
| 5902 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5903 | /*********************************************************************** |
| 5904 | * IPA style dynamic PDCH |
| 5905 | ***********************************************************************/ |
| 5906 | |
| 5907 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5908 | template (omit) RSL_Cause nack := omit) |
| 5909 | runs on test_CT { |
| 5910 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5911 | var RSL_Message rsl_unused; |
| 5912 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5913 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 5914 | /* expect the BSC to issue the related RSL command */ |
| 5915 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5916 | if (istemplatekind(nack, "omit")) { |
| 5917 | /* respond with a related acknowledgement */ |
| 5918 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5919 | } else { |
| 5920 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 5921 | } |
| 5922 | } |
| 5923 | |
| 5924 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5925 | template (omit) RSL_Cause nack := omit) |
| 5926 | runs on test_CT { |
| 5927 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5928 | var RSL_Message rsl_unused; |
| 5929 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5930 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 5931 | /* expect the BSC to issue the related RSL command */ |
| 5932 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 5933 | if (istemplatekind(nack, "omit")) { |
| 5934 | /* respond with a related acknowledgement */ |
| 5935 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 5936 | } else { |
| 5937 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 5938 | } |
| 5939 | } |
| 5940 | |
| 5941 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 5942 | runs on test_CT return charstring { |
| 5943 | var charstring cmd, resp; |
| 5944 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 5945 | return f_vty_transceive_match_regexp_retry(BSCVTY, cmd, "*\((*)\)*", 0, 4, 1.0); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5946 | } |
| 5947 | |
| 5948 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5949 | template charstring exp) |
| 5950 | runs on test_CT { |
| 5951 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 5952 | if (not match(mode, exp)) { |
| 5953 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5954 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5955 | } |
| 5956 | } |
| 5957 | |
| 5958 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 5959 | runs on test_CT { |
| 5960 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 5961 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 5962 | f_vty_transceive(BSCVTY, "end"); |
| 5963 | } |
| 5964 | |
| 5965 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 5966 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 5967 | private const charstring PDCH_MODE := "PDCH mode"; |
| 5968 | private const charstring NONE_MODE := "NONE mode"; |
| 5969 | |
| 5970 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 5971 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 5972 | var RSL_Message rsl_unused; |
| 5973 | |
| 5974 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5975 | f_init_vty(); |
| 5976 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5977 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5978 | |
| 5979 | f_init(1, false); |
| 5980 | f_sleep(1.0); |
| 5981 | |
| 5982 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5983 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5984 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5985 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5986 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5987 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5988 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5989 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5990 | log("TCH/F_PDCH pchan, PDCH ACT was ACKed, so now in PDCH mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5991 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5992 | |
| 5993 | /* De-activate it via VTY */ |
| 5994 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5995 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5996 | log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5997 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5998 | |
| 5999 | /* re-activate it via VTY */ |
| 6000 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6001 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6002 | log("TCH/F_PDCH pchan, PDCH ACT via VTY, so now in PDCH mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6003 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6004 | |
| 6005 | /* and finally de-activate it again */ |
| 6006 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6007 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6008 | log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6009 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6010 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6011 | /* clean up config */ |
| 6012 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6013 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6014 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6015 | } |
| 6016 | |
| 6017 | /* Test IPA PDCH activation NACK */ |
| 6018 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6019 | var RSL_Message rsl_unused; |
| 6020 | |
| 6021 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6022 | f_init_vty(); |
| 6023 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6024 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6025 | |
| 6026 | f_init(1, false); |
| 6027 | f_sleep(1.0); |
| 6028 | |
| 6029 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6030 | |
| 6031 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6032 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6033 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6034 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6035 | f_sleep(1.0); |
| 6036 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6037 | |
| 6038 | /* De-activate it via VTY */ |
| 6039 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6040 | f_sleep(1.0); |
| 6041 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6042 | |
| 6043 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6044 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6045 | f_sleep(1.0); |
| 6046 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6047 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6048 | /* clean up config */ |
| 6049 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6050 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6051 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6052 | } |
| 6053 | |
| 6054 | |
| 6055 | /*********************************************************************** |
| 6056 | * Osmocom style dynamic PDCH |
| 6057 | ***********************************************************************/ |
| 6058 | |
| 6059 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6060 | template (omit) RSL_Cause nack := omit) |
| 6061 | runs on test_CT { |
| 6062 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6063 | var RSL_Message rsl_unused; |
| 6064 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6065 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6066 | /* expect the BSC to issue the related RSL command */ |
| 6067 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6068 | if (istemplatekind(nack, "omit")) { |
| 6069 | /* respond with a related acknowledgement */ |
| 6070 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6071 | } else { |
| 6072 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6073 | } |
| 6074 | } |
| 6075 | |
| 6076 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6077 | template (omit) RSL_Cause nack := omit) |
| 6078 | runs on test_CT { |
| 6079 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6080 | var RSL_Message rsl_unused; |
| 6081 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6082 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6083 | /* expect the BSC to issue the related RSL command */ |
| 6084 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6085 | if (istemplatekind(nack, "omit")) { |
| 6086 | /* respond with a related acknowledgement */ |
| 6087 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6088 | } else { |
| 6089 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6090 | } |
| 6091 | } |
| 6092 | |
| 6093 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6094 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6095 | var RSL_Message rsl_unused; |
| 6096 | |
| 6097 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6098 | f_init_vty(); |
| 6099 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6100 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6101 | |
| 6102 | f_init(1, false); |
| 6103 | f_sleep(1.0); |
| 6104 | |
| 6105 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6106 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6107 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6108 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6109 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6110 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6111 | |
| 6112 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6113 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6114 | log("TCH/F_TCH/H_PDCH requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6115 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6116 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6117 | /* clean up config */ |
| 6118 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6119 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6120 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6121 | } |
| 6122 | |
| 6123 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6124 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6125 | var RSL_Message rsl_unused; |
| 6126 | |
| 6127 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6128 | f_init_vty(); |
| 6129 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6130 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6131 | |
| 6132 | f_init(1, false); |
| 6133 | f_sleep(1.0); |
| 6134 | |
| 6135 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6136 | |
| 6137 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6138 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6139 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6140 | |
| 6141 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6142 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6143 | f_sleep(1.0); |
| 6144 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6145 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6146 | /* clean up config */ |
| 6147 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6148 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6149 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6150 | } |
| 6151 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6152 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6153 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port, mp_bsc_ctrl_port}; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6154 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6155 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6156 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6157 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6158 | } |
| 6159 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6160 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6161 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6162 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6163 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6164 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6165 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6166 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6167 | } |
| 6168 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6169 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6170 | the BTS does autonomous MS power control loop */ |
| 6171 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6172 | var MSC_ConnHdlr vc_conn; |
| 6173 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6174 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6175 | pars.exp_ms_power_params := true; |
| 6176 | |
| 6177 | f_init(1, true); |
| 6178 | f_sleep(1.0); |
| 6179 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6180 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6181 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6182 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6183 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6184 | /*********************************************************************** |
| 6185 | * MSC Pooling |
| 6186 | ***********************************************************************/ |
| 6187 | |
| 6188 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 6189 | { |
| 6190 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 6191 | 4); |
| 6192 | } |
| 6193 | |
| 6194 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 6195 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 6196 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 6197 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6198 | interleave { |
| 6199 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6200 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6201 | } |
| 6202 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6203 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6204 | } |
| 6205 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6206 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6207 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6208 | break; |
| 6209 | } |
| 6210 | } |
| 6211 | } |
| 6212 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6213 | private function f_perform_clear(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6214 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6215 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6216 | interleave { |
| 6217 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6218 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6219 | } |
| 6220 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6221 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6222 | } |
| 6223 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6224 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6225 | /* Also drop the SCCP connection */ |
| 6226 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6227 | } |
| 6228 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6229 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6230 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6231 | } |
| 6232 | } |
| 6233 | } |
| 6234 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6235 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true, boolean expect_bssmap_l3 := true) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6236 | runs on MSC_ConnHdlr { |
| 6237 | timer T := 10.0; |
| 6238 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6239 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6240 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6241 | f_create_bssmap_exp(l3_enc); |
| 6242 | |
| 6243 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6244 | * This is basically code dup with s/RSL/rsl from: |
| 6245 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6246 | */ |
| 6247 | var RSL_Message rx_rsl; |
| 6248 | var GsmRrMessage rr; |
| 6249 | |
| 6250 | /* request a channel to be established */ |
| 6251 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6252 | /* expect immediate assignment. |
| 6253 | * Code dup with s/RSL/rsl from: |
| 6254 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6255 | */ |
| 6256 | timer Tt := 10.0; |
| 6257 | |
| 6258 | /* request a channel to be established */ |
| 6259 | Tt.start; |
| 6260 | alt { |
| 6261 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6262 | Tt.stop; |
| 6263 | } |
| 6264 | [] rsl.receive { |
| 6265 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6266 | mtc.stop; |
| 6267 | } |
| 6268 | [] Tt.timeout { |
| 6269 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6270 | mtc.stop; |
| 6271 | } |
| 6272 | } |
| 6273 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6274 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6275 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6276 | |
| 6277 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6278 | if (expect_bssmap_l3) { |
| 6279 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6280 | var template PDU_BSSAP exp_l3_compl; |
| 6281 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6282 | if (g_pars.aoip == false) { |
| 6283 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6284 | } else { |
| 6285 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6286 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6287 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6288 | var PDU_BSSAP bssap; |
| 6289 | T.start; |
| 6290 | alt { |
| 6291 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6292 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6293 | log("rx exp_l3_compl = ", bssap); |
| 6294 | } |
| 6295 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6296 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6297 | } |
| 6298 | [] T.timeout { |
| 6299 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6300 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6301 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6302 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6303 | /* start ciphering, if requested */ |
| 6304 | if (ispresent(g_pars.encr)) { |
| 6305 | f_logp(BSCVTY, "start ciphering"); |
| 6306 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6307 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6308 | } |
| 6309 | |
| 6310 | if (do_clear) { |
| 6311 | f_perform_clear(rsl); |
| 6312 | } |
| 6313 | setverdict(pass); |
| 6314 | f_sleep(1.0); |
| 6315 | } |
| 6316 | |
| 6317 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6318 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6319 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6320 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6321 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6322 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6323 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6324 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6325 | } |
| 6326 | } |
| 6327 | |
| 6328 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6329 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6330 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6331 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6332 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6333 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6334 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6335 | } |
| 6336 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6337 | |
| 6338 | f_init(1, true); |
| 6339 | f_sleep(1.0); |
| 6340 | var MSC_ConnHdlr vc_conn; |
| 6341 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6342 | |
| 6343 | f_ctrs_msc_init(); |
| 6344 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6345 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6346 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6347 | |
| 6348 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6349 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6350 | } |
| 6351 | |
| 6352 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6353 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6354 | * just as well using only RSL. */ |
| 6355 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6356 | |
| 6357 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6358 | f_sleep(1.0); |
| 6359 | |
| 6360 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6361 | * would be randomly affected by which other tests ran before this. */ |
| 6362 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6363 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6364 | f_ctrs_msc_init(); |
| 6365 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6366 | var MSC_ConnHdlr vc_conn1; |
| 6367 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6368 | pars1.mscpool.rsl_idx := 0; |
| 6369 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6370 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6371 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6372 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6373 | |
| 6374 | var MSC_ConnHdlr vc_conn2; |
| 6375 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6376 | pars2.mscpool.rsl_idx := 1; |
| 6377 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6378 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6379 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6380 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6381 | |
| 6382 | /* Test round-robin wrap to the first MSC */ |
| 6383 | var MSC_ConnHdlr vc_conn3; |
| 6384 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6385 | pars3.mscpool.rsl_idx := 2; |
| 6386 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6387 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6388 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6389 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6390 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6391 | } |
| 6392 | |
| 6393 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6394 | * (configured in osmo-bsc.cfg). */ |
| 6395 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6396 | * just as well using only RSL. */ |
| 6397 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6398 | |
| 6399 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6400 | f_sleep(1.0); |
| 6401 | |
| 6402 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6403 | * would be randomly affected by which other tests ran before this. */ |
| 6404 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6405 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6406 | f_ctrs_msc_init(); |
| 6407 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6408 | var MSC_ConnHdlr vc_conn1; |
| 6409 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6410 | pars1.mscpool.rsl_idx := 0; |
| 6411 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6412 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6413 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6414 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6415 | |
| 6416 | var MSC_ConnHdlr vc_conn2; |
| 6417 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6418 | pars2.mscpool.rsl_idx := 1; |
| 6419 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6420 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6421 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6422 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6423 | |
| 6424 | /* Test round-robin wrap to the first MSC */ |
| 6425 | var MSC_ConnHdlr vc_conn3; |
| 6426 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6427 | pars3.mscpool.rsl_idx := 2; |
| 6428 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6429 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6430 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6431 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6432 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6433 | } |
| 6434 | |
| 6435 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6436 | * (configured in osmo-bsc.cfg). In this case, one of the MSC also has the NULL-NRI as part of its owned NRIs, but the |
| 6437 | * NULL-NRI setting is stronger than that. */ |
| 6438 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6439 | * just as well using only RSL. */ |
| 6440 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6441 | |
| 6442 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6443 | f_sleep(1.0); |
| 6444 | |
| 6445 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6446 | * would be randomly affected by which other tests ran before this. */ |
| 6447 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6448 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6449 | f_ctrs_msc_init(); |
| 6450 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6451 | var MSC_ConnHdlr vc_conn1; |
| 6452 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6453 | pars1.mscpool.rsl_idx := 0; |
| 6454 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6455 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6456 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6457 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6458 | |
| 6459 | var MSC_ConnHdlr vc_conn2; |
| 6460 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6461 | pars2.mscpool.rsl_idx := 1; |
| 6462 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6463 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6464 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6465 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6466 | |
| 6467 | /* Test round-robin wrap to the first MSC */ |
| 6468 | var MSC_ConnHdlr vc_conn3; |
| 6469 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6470 | pars3.mscpool.rsl_idx := 2; |
| 6471 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6472 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6473 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6474 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6475 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6476 | } |
| 6477 | |
| 6478 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6479 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6480 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6481 | * just as well using only RSL. */ |
| 6482 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6483 | |
| 6484 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6485 | f_sleep(1.0); |
| 6486 | |
| 6487 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6488 | * would be randomly affected by which other tests ran before this. */ |
| 6489 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6490 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6491 | f_ctrs_msc_init(); |
| 6492 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6493 | var MSC_ConnHdlr vc_conn1; |
| 6494 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6495 | pars1.mscpool.rsl_idx := 0; |
| 6496 | /* An NRI that is not assigned to any MSC */ |
| 6497 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6498 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6499 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6500 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6501 | |
| 6502 | var MSC_ConnHdlr vc_conn2; |
| 6503 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6504 | pars2.mscpool.rsl_idx := 1; |
| 6505 | /* An NRI that is not assigned to any MSC */ |
| 6506 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6507 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6508 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6509 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6510 | |
| 6511 | /* Test round-robin wrap to the first MSC */ |
| 6512 | var MSC_ConnHdlr vc_conn3; |
| 6513 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6514 | pars3.mscpool.rsl_idx := 2; |
| 6515 | /* An NRI that is not assigned to any MSC */ |
| 6516 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6517 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6518 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6519 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6520 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6521 | } |
| 6522 | |
| 6523 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6524 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6525 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6526 | * just as well using only RSL. */ |
| 6527 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6528 | |
| 6529 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6530 | f_sleep(1.0); |
| 6531 | |
| 6532 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6533 | * would be randomly affected by which other tests ran before this. */ |
| 6534 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6535 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6536 | f_ctrs_msc_init(); |
| 6537 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6538 | var MSC_ConnHdlr vc_conn1; |
| 6539 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6540 | pars1.mscpool.rsl_idx := 0; |
| 6541 | /* An NRI that is assigned to an unconnected MSC */ |
| 6542 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6543 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6544 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6545 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6546 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6547 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6548 | |
| 6549 | var MSC_ConnHdlr vc_conn2; |
| 6550 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6551 | pars2.mscpool.rsl_idx := 1; |
| 6552 | /* An NRI that is assigned to an unconnected MSC */ |
| 6553 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6554 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6555 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6556 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6557 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6558 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6559 | |
| 6560 | /* Test round-robin wrap to the first MSC */ |
| 6561 | var MSC_ConnHdlr vc_conn3; |
| 6562 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6563 | pars3.mscpool.rsl_idx := 2; |
| 6564 | /* An NRI that is assigned to an unconnected MSC */ |
| 6565 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6566 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6567 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6568 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6569 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6570 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6571 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6572 | } |
| 6573 | |
| 6574 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6575 | * osmo-bsc.cfg). */ |
| 6576 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6577 | * just as well using only RSL. */ |
| 6578 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6579 | |
| 6580 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6581 | f_sleep(1.0); |
| 6582 | |
| 6583 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6584 | * this is not using round-robin. */ |
| 6585 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6586 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6587 | f_ctrs_msc_init(); |
| 6588 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6589 | var MSC_ConnHdlr vc_conn1; |
| 6590 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6591 | pars1.mscpool.rsl_idx := 0; |
| 6592 | /* An NRI of the second MSC's range (256-511) */ |
| 6593 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6594 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6595 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6596 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6597 | |
| 6598 | var MSC_ConnHdlr vc_conn2; |
| 6599 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6600 | pars2.mscpool.rsl_idx := 1; |
| 6601 | /* An NRI of the second MSC's range (256-511) */ |
| 6602 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6603 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6604 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6605 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6606 | |
| 6607 | var MSC_ConnHdlr vc_conn3; |
| 6608 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6609 | pars3.mscpool.rsl_idx := 2; |
| 6610 | /* An NRI of the second MSC's range (256-511) */ |
| 6611 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6612 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6613 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6614 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6615 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6616 | } |
| 6617 | |
| 6618 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6619 | * while a round-robin remains unaffected by that. */ |
| 6620 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6621 | * just as well using only RSL. */ |
| 6622 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6623 | |
| 6624 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6625 | f_sleep(1.0); |
| 6626 | |
| 6627 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6628 | * this is not using round-robin. */ |
| 6629 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6630 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6631 | f_ctrs_msc_init(); |
| 6632 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6633 | var MSC_ConnHdlr vc_conn1; |
| 6634 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6635 | pars1.mscpool.rsl_idx := 0; |
| 6636 | /* An NRI of the third MSC's range (512-767) */ |
| 6637 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6638 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6639 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6640 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6641 | |
| 6642 | var MSC_ConnHdlr vc_conn2; |
| 6643 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6644 | pars2.mscpool.rsl_idx := 1; |
| 6645 | /* An NRI of the third MSC's range (512-767) */ |
| 6646 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6647 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6648 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6649 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6650 | |
| 6651 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6652 | var MSC_ConnHdlr vc_conn3; |
| 6653 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6654 | pars3.mscpool.rsl_idx := 2; |
| 6655 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6656 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6657 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6658 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6659 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6660 | } |
| 6661 | |
| 6662 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6663 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6664 | * just as well using only RSL. */ |
| 6665 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6666 | |
| 6667 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6668 | f_sleep(1.0); |
| 6669 | |
| 6670 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6671 | * instead, and hits msc 0. */ |
| 6672 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6673 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6674 | f_ctrs_msc_init(); |
| 6675 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6676 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6677 | var MSC_ConnHdlr vc_conn1; |
| 6678 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6679 | pars1.mscpool.rsl_idx := 0; |
| 6680 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6681 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6682 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6683 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6684 | |
| 6685 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6686 | var MSC_ConnHdlr vc_conn2; |
| 6687 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6688 | pars2.mscpool.rsl_idx := 1; |
| 6689 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6690 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6691 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6692 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6693 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6694 | } |
| 6695 | |
| 6696 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6697 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6698 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6699 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6700 | //cid_list := { cIl_allInBSS := ''O }; |
| 6701 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6702 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6703 | var BSSAP_N_UNITDATA_req paging; |
| 6704 | var hexstring imsi := '001010000000123'H; |
| 6705 | |
| 6706 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6707 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6708 | paging := valueof(ts_BSSAP_UNITDATA_req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6709 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6710 | BSSAP.send(paging); |
| 6711 | |
| 6712 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6713 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6714 | * channel number is picked here. */ |
| 6715 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6716 | f_rslem_register(0, new_chan_nr); |
| 6717 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6718 | f_rslem_unregister(0, new_chan_nr); |
| 6719 | |
| 6720 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6721 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6722 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6723 | f_sleep(1.0); |
| 6724 | } |
| 6725 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6726 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6727 | f_sleep(1.0); |
| 6728 | |
| 6729 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6730 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6731 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6732 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6733 | f_ctrs_msc_init(); |
| 6734 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6735 | var MSC_ConnHdlr vc_conn1; |
| 6736 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6737 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6738 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6739 | pars1.sccp_addr_msc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_own; |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6740 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6741 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6742 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6743 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6744 | } |
| 6745 | |
| 6746 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6747 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6748 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6749 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6750 | //cid_list := { cIl_allInBSS := ''O }; |
| 6751 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6752 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6753 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6754 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6755 | var BSSAP_N_UNITDATA_req paging; |
| 6756 | |
| 6757 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6758 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6759 | paging := valueof(ts_BSSAP_UNITDATA_req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6760 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6761 | BSSAP.send(paging); |
| 6762 | |
| 6763 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6764 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6765 | * channel number is picked here. */ |
| 6766 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6767 | f_rslem_register(0, new_chan_nr); |
| 6768 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6769 | f_rslem_unregister(0, new_chan_nr); |
| 6770 | |
| 6771 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6772 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6773 | * the first MSC (bssap_idx := 0). */ |
| 6774 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6775 | f_sleep(1.0); |
| 6776 | } |
| 6777 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6778 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6779 | f_sleep(1.0); |
| 6780 | |
| 6781 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6782 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6783 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6784 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6785 | f_ctrs_msc_init(); |
| 6786 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6787 | var MSC_ConnHdlr vc_conn1; |
| 6788 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6789 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6790 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6791 | pars1.sccp_addr_msc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_own; |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6792 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6793 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6794 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6795 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6796 | } |
| 6797 | |
| 6798 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6799 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6800 | * just as well using only RSL. */ |
| 6801 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6802 | |
| 6803 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6804 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6805 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6806 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6807 | |
| 6808 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6809 | * would be randomly affected by which other tests ran before this. */ |
| 6810 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6811 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6812 | f_ctrs_msc_init(); |
| 6813 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6814 | var MSC_ConnHdlr vc_conn1; |
| 6815 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6816 | pars1.mscpool.rsl_idx := 0; |
| 6817 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6818 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6819 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6820 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6821 | |
| 6822 | var MSC_ConnHdlr vc_conn2; |
| 6823 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6824 | pars2.mscpool.rsl_idx := 1; |
| 6825 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6826 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6827 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6828 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6829 | |
| 6830 | var MSC_ConnHdlr vc_conn3; |
| 6831 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6832 | pars3.mscpool.rsl_idx := 2; |
| 6833 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6834 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6835 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6836 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6837 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6838 | } |
| 6839 | |
| 6840 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6841 | * TMSI NRI. */ |
| 6842 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6843 | |
| 6844 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6845 | f_sleep(1.0); |
| 6846 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6847 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6848 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6849 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6850 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6851 | * would be randomly affected by which other tests ran before this. */ |
| 6852 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6853 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6854 | f_ctrs_msc_init(); |
| 6855 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6856 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6857 | var MSC_ConnHdlr vc_conn1; |
| 6858 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6859 | pars1.mscpool.rsl_idx := 0; |
| 6860 | /* An NRI of the second MSC's range (256-511) */ |
| 6861 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6862 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6863 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6864 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6865 | |
| 6866 | var MSC_ConnHdlr vc_conn2; |
| 6867 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6868 | pars2.mscpool.rsl_idx := 1; |
| 6869 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6870 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6871 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6872 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6873 | |
| 6874 | var MSC_ConnHdlr vc_conn3; |
| 6875 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6876 | pars3.mscpool.rsl_idx := 2; |
| 6877 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6878 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6879 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6880 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6881 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6882 | } |
| 6883 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6884 | /* Allow/Deny emergency calls globally via VTY */ |
| 6885 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6886 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6887 | if (allow) { |
| 6888 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6889 | } else { |
| 6890 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6891 | } |
| 6892 | f_vty_transceive(BSCVTY, "exit"); |
| 6893 | f_vty_transceive(BSCVTY, "exit"); |
| 6894 | } |
| 6895 | |
| 6896 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 6897 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 6898 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 6899 | if (allow) { |
| 6900 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 6901 | } else { |
| 6902 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 6903 | } |
| 6904 | f_vty_transceive(BSCVTY, "exit"); |
| 6905 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 6906 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6907 | } |
| 6908 | |
| 6909 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 6910 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 6911 | var PDU_ML3_MS_NW emerg_setup; |
| 6912 | var octetstring emerg_setup_enc; |
| 6913 | var RSL_Message emerg_setup_data_ind; |
| 6914 | |
| 6915 | f_establish_fully(omit, omit); |
| 6916 | |
| 6917 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 6918 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 6919 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 6920 | |
| 6921 | RSL.send(emerg_setup_data_ind); |
| 6922 | } |
| 6923 | |
| 6924 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 6925 | * CALLS are permitted by the BSC config. */ |
| 6926 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 6927 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6928 | var PDU_ML3_MS_NW emerg_setup; |
| 6929 | timer T := 3.0; |
| 6930 | |
| 6931 | f_assignment_emerg_setup() |
| 6932 | |
| 6933 | T.start; |
| 6934 | alt { |
| 6935 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 6936 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 6937 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 6938 | setverdict(fail, "no emergency setup"); |
| 6939 | } |
| 6940 | } |
| 6941 | [] BSSAP.receive { |
| 6942 | setverdict(fail, "unexpected BSSAP message!"); |
| 6943 | } |
| 6944 | [] T.timeout { |
| 6945 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 6946 | } |
| 6947 | } |
| 6948 | |
| 6949 | setverdict(pass); |
| 6950 | } |
| 6951 | |
| 6952 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 6953 | * forbidden by the BSC config. */ |
| 6954 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 6955 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6956 | timer T := 3.0; |
| 6957 | |
| 6958 | f_assignment_emerg_setup() |
| 6959 | |
| 6960 | T.start; |
| 6961 | alt { |
| 6962 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6963 | setverdict(pass); |
| 6964 | } |
| 6965 | [] RSL.receive { |
| 6966 | setverdict(fail, "unexpected RSL message!"); |
| 6967 | } |
| 6968 | [] T.timeout { |
| 6969 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 6970 | } |
| 6971 | } |
| 6972 | } |
| 6973 | |
| 6974 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 6975 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 6976 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6977 | var MSC_ConnHdlr vc_conn; |
| 6978 | |
| 6979 | f_init(1, true); |
| 6980 | f_sleep(1.0); |
| 6981 | |
| 6982 | f_vty_allow_emerg_msc(true); |
| 6983 | f_vty_allow_emerg_bts(true, 0); |
| 6984 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 6985 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6986 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6987 | } |
| 6988 | |
| 6989 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 6990 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 6991 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6992 | var MSC_ConnHdlr vc_conn; |
| 6993 | |
| 6994 | f_init(1, true); |
| 6995 | f_sleep(1.0); |
| 6996 | |
| 6997 | f_vty_allow_emerg_msc(false); |
| 6998 | f_vty_allow_emerg_bts(true, 0); |
| 6999 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7000 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7001 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7002 | } |
| 7003 | |
| 7004 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7005 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7006 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7007 | var MSC_ConnHdlr vc_conn; |
| 7008 | |
| 7009 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7010 | * implementations would not try to establish an emergency call because |
| 7011 | * the system information tells in advance that emergency calls are |
| 7012 | * not forbidden */ |
| 7013 | |
| 7014 | f_init(1, true); |
| 7015 | f_sleep(1.0); |
| 7016 | |
| 7017 | f_vty_allow_emerg_msc(true); |
| 7018 | f_vty_allow_emerg_bts(false, 0); |
| 7019 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7020 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7021 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7022 | } |
| 7023 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7024 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7025 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7026 | * emergency call */ |
| 7027 | testcase TC_emerg_premption() runs on test_CT { |
| 7028 | var ASP_RSL_Unitdata rsl_ud; |
| 7029 | var integer i; |
| 7030 | var integer chreq_total, chreq_nochan; |
| 7031 | var RSL_Message rx_rsl; |
| 7032 | var RslChannelNr chan_nr; |
| 7033 | |
| 7034 | f_init(1); |
| 7035 | f_sleep(1.0); |
| 7036 | |
| 7037 | f_vty_allow_emerg_msc(true); |
| 7038 | f_vty_allow_emerg_bts(true, 0); |
| 7039 | |
| 7040 | /* Fill up all channels on the BTS */ |
| 7041 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7042 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7043 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7044 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7045 | } |
| 7046 | IPA_RSL[0].clear; |
| 7047 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7048 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7049 | |
| 7050 | /* Send Channel request for emegergency call */ |
| 7051 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7052 | |
| 7053 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7054 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7055 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7056 | |
| 7057 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7058 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7059 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7060 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7061 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7062 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7063 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7064 | } |
| 7065 | |
| 7066 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7067 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7068 | private type record FHParamsTs { |
| 7069 | boolean enabled, |
| 7070 | uint6_t hsn, |
| 7071 | uint6_t maio, |
| 7072 | ArfcnList ma |
| 7073 | }; |
| 7074 | |
| 7075 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7076 | private type record FHParamsTrx { |
| 7077 | GsmArfcn arfcn, |
| 7078 | FHParamsTs ts[8] |
| 7079 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7080 | |
| 7081 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7082 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7083 | runs on test_CT return FHParamsTrx { |
| 7084 | var FHParamsTrx fhp; |
| 7085 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7086 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7087 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7088 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7089 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7090 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7091 | fhp.ts[tn].enabled := false; |
| 7092 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7093 | continue; |
| 7094 | } |
| 7095 | |
| 7096 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7097 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7098 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7099 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7100 | |
| 7101 | /* Random Mobile Allocation (hopping channels) */ |
| 7102 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7103 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7104 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7105 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7106 | } |
| 7107 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7108 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7109 | } |
| 7110 | |
| 7111 | log("f_TC_fh_params_gen(): ", fhp); |
| 7112 | return fhp; |
| 7113 | } |
| 7114 | |
| 7115 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7116 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7117 | { |
| 7118 | var template (present) ChannelDescription tr_cd; |
| 7119 | var template (present) MaioHsn tr_maio_hsn; |
| 7120 | var uint3_t tn := cd.chan_nr.tn; |
| 7121 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7122 | if (fhp.ts[tn].enabled) { |
| 7123 | tr_maio_hsn := tr_HsnMaio(fhp.ts[tn].hsn, fhp.ts[tn].maio); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7124 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7125 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7126 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7127 | } |
| 7128 | |
| 7129 | if (not match(cd, tr_cd)) { |
| 7130 | setverdict(fail, "Channel Description IE does not match: ", |
| 7131 | cd, " vs expected ", tr_cd); |
| 7132 | } |
| 7133 | } |
| 7134 | |
| 7135 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7136 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7137 | in MobileAllocationLV ma) |
| 7138 | { |
| 7139 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7140 | |
| 7141 | if (not match(ma, tr_ma)) { |
| 7142 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7143 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7144 | } else { |
| 7145 | setverdict(pass); |
| 7146 | } |
| 7147 | } |
| 7148 | |
| 7149 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7150 | in MobileAllocationLV ma) |
| 7151 | return template MobileAllocationLV { |
| 7152 | /* Mobile Allocation IE is expected to be empty if hopping is not enabled */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7153 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7154 | return { len := 0, ma := ''B }; |
| 7155 | } |
| 7156 | |
| 7157 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7158 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7159 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7160 | |
| 7161 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7162 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7163 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7164 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7165 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7166 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7167 | } |
| 7168 | } |
| 7169 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7170 | /* Take ARFCN of the TRX itself into account */ |
| 7171 | full_mask[fhp.arfcn] := '1'B; |
| 7172 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7173 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7174 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7175 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7176 | } |
| 7177 | |
| 7178 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7179 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7180 | if (full_mask[i] != '1'B) |
| 7181 | { continue; } |
| 7182 | |
| 7183 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7184 | if (slot_mask[i] == '1'B) { |
| 7185 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7186 | } else { |
| 7187 | ma_mask := ma_mask & '0'B; |
| 7188 | } |
| 7189 | } |
| 7190 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7191 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7192 | if (full_mask[0] == '1'B) { |
| 7193 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7194 | if (slot_mask[0] == '1'B) { |
| 7195 | ma_mask := ma_mask & '1'B; |
| 7196 | } else { |
| 7197 | ma_mask := ma_mask & '0'B; |
| 7198 | } |
| 7199 | } |
| 7200 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7201 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7202 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7203 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7204 | |
| 7205 | return { len := ma_mask_len, ma := ma_mask }; |
| 7206 | } |
| 7207 | |
| 7208 | /* Configure the hopping parameters in accordance with the given record */ |
| 7209 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7210 | uint8_t bts_nr := 0, |
| 7211 | uint8_t trx_nr := 0) |
| 7212 | runs on test_CT { |
| 7213 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7214 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7215 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7216 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7217 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7218 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7219 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7220 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7221 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7222 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7223 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7224 | continue; |
| 7225 | } |
| 7226 | |
| 7227 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7228 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7229 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7230 | |
| 7231 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7232 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7233 | f_vty_transceive(BSCVTY, "hopping arfcn add " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7234 | } |
| 7235 | |
| 7236 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7237 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7238 | } |
| 7239 | |
| 7240 | f_vty_transceive(BSCVTY, "end"); |
| 7241 | } |
| 7242 | |
| 7243 | /* Disable frequency hopping on all timeslots */ |
| 7244 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7245 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7246 | uint8_t trx_nr := 0, |
| 7247 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7248 | runs on test_CT { |
| 7249 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7250 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7251 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7252 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7253 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7254 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7255 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7256 | |
| 7257 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7258 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7259 | f_vty_transceive(BSCVTY, "hopping arfcn del " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7260 | } |
| 7261 | |
| 7262 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7263 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7264 | } |
| 7265 | |
| 7266 | f_vty_transceive(BSCVTY, "end"); |
| 7267 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7268 | } |
| 7269 | |
| 7270 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7271 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7272 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7273 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7274 | var RSL_Message rsl_msg; |
| 7275 | var RSL_IE_Body ie; |
| 7276 | |
| 7277 | f_init_vty(); |
| 7278 | |
| 7279 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7280 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7281 | |
| 7282 | f_init(1); |
| 7283 | |
| 7284 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7285 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7286 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7287 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7288 | |
| 7289 | /* Make sure that Channel Identification IE is present */ |
| 7290 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7291 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7292 | continue; |
| 7293 | } |
| 7294 | |
| 7295 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7296 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7297 | |
| 7298 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7299 | if (ie.chan_ident.ma.v.len != 0) { |
| 7300 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7301 | ie.chan_ident.ma, ", despite it shall be"); |
| 7302 | continue; |
| 7303 | } |
| 7304 | } |
| 7305 | |
| 7306 | /* Disable frequency hopping */ |
| 7307 | f_TC_fh_params_unset(fhp); |
| 7308 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7309 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7310 | } |
| 7311 | |
| 7312 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7313 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7314 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7315 | var RSL_Message rsl_msg; |
| 7316 | var RSL_IE_Body ie; |
| 7317 | |
| 7318 | f_init_vty(); |
| 7319 | |
| 7320 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7321 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7322 | |
| 7323 | f_init(1); |
| 7324 | |
| 7325 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7326 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7327 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7328 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7329 | |
| 7330 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7331 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7332 | |
| 7333 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7334 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7335 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7336 | continue; |
| 7337 | } |
| 7338 | |
| 7339 | /* Decode the actual Immediate Assignment message */ |
| 7340 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7341 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7342 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7343 | continue; |
| 7344 | } |
| 7345 | |
| 7346 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7347 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7348 | |
| 7349 | /* Make sure that the Mobile Allocation IE matches */ |
| 7350 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7351 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7352 | } |
| 7353 | |
| 7354 | /* Disable frequency hopping */ |
| 7355 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7356 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7357 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7358 | } |
| 7359 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7360 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7361 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7362 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7363 | var RSL_Message rsl_msg; |
| 7364 | var RSL_IE_Body ie; |
| 7365 | |
| 7366 | f_init_vty(); |
| 7367 | |
| 7368 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7369 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7370 | |
| 7371 | f_init(1); |
| 7372 | |
| 7373 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7374 | vc_MGCP.stop; |
| 7375 | |
| 7376 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7377 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7378 | |
| 7379 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7380 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7381 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7382 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7383 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7384 | |
| 7385 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7386 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7387 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7388 | |
| 7389 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7390 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7391 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7392 | |
| 7393 | /* Make sure that L3 Information IE is present */ |
| 7394 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7395 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7396 | continue; |
| 7397 | } |
| 7398 | |
| 7399 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7400 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7401 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7402 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7403 | continue; |
| 7404 | } |
| 7405 | |
| 7406 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7407 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7408 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7409 | |
| 7410 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7411 | if (chan_desc.h and not ispresent(l3_msg.payload.ass_cmd.cell_chan_desc)) { |
Vadim Yanitskiy | 38d069d | 2020-09-02 17:18:57 +0700 | [diff] [blame] | 7412 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7413 | continue; |
| 7414 | } |
| 7415 | |
| 7416 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7417 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7418 | if (chan_desc.h and ma_present) { |
| 7419 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7420 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7421 | } else if (chan_desc.h and not ma_present) { |
| 7422 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7423 | continue; |
| 7424 | } else if (not chan_desc.h and ma_present) { |
| 7425 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7426 | continue; |
| 7427 | } |
| 7428 | } |
| 7429 | |
| 7430 | /* Give the IUT some time to release all channels */ |
| 7431 | f_sleep(3.0); |
| 7432 | |
| 7433 | /* Disable frequency hopping */ |
| 7434 | f_TC_fh_params_unset(fhp); |
| 7435 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7436 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7437 | } |
| 7438 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7439 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7440 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7441 | runs on test_CT { |
| 7442 | var RSL_Message rsl_msg; |
| 7443 | var RSL_IE_Body ie; |
| 7444 | var DchanTuple dt; |
| 7445 | |
| 7446 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7447 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7448 | |
| 7449 | /* Trigger handover from BTS0 to BTS1 */ |
| 7450 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7451 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7452 | |
| 7453 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7454 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7455 | |
| 7456 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7457 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7458 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7459 | |
| 7460 | /* Make sure that L3 Information IE is present */ |
| 7461 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7462 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7463 | return; |
| 7464 | } |
| 7465 | |
| 7466 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7467 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7468 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7469 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7470 | return; |
| 7471 | } |
| 7472 | |
| 7473 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7474 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7475 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7476 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7477 | return; |
| 7478 | } |
| 7479 | |
| 7480 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7481 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7482 | |
| 7483 | /* Make sure that Cell Channel Description IE is present */ |
| 7484 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7485 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7486 | return; |
| 7487 | } |
| 7488 | |
| 7489 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7490 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7491 | if (ma_present) { |
| 7492 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7493 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7494 | } else { |
| 7495 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7496 | return; |
| 7497 | } |
| 7498 | } |
| 7499 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7500 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7501 | |
| 7502 | f_init_vty(); |
| 7503 | |
| 7504 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7505 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7506 | |
| 7507 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7508 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7509 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7510 | |
| 7511 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7512 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7513 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7514 | |
| 7515 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7516 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7517 | |
| 7518 | f_init(2); |
| 7519 | |
| 7520 | f_TC_fh_params_handover_cmd(fhp); |
| 7521 | |
| 7522 | /* Disable frequency hopping on BTS1 */ |
| 7523 | f_TC_fh_params_unset(fhp, 1); |
| 7524 | |
| 7525 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7526 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7527 | |
| 7528 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7529 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7530 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7531 | |
| 7532 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7533 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7534 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7535 | |
| 7536 | f_shutdown_helper(); |
| 7537 | } |
| 7538 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7539 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7540 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7541 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7542 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7543 | timer T := 5.0; |
| 7544 | |
| 7545 | f_init_vty(); |
| 7546 | |
| 7547 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7548 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7549 | |
| 7550 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7551 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7552 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7553 | |
| 7554 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7555 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7556 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7557 | |
| 7558 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7559 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7560 | |
| 7561 | f_init(1); |
| 7562 | |
| 7563 | T.start; |
| 7564 | alt { |
| 7565 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7566 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7567 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7568 | |
| 7569 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7570 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7571 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7572 | repeat; |
| 7573 | } |
| 7574 | |
| 7575 | /* Make sure that CBCH Channel Description IE is present */ |
| 7576 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7577 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7578 | break; |
| 7579 | } |
| 7580 | |
| 7581 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7582 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7583 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7584 | |
| 7585 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7586 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7587 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7588 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7589 | break; |
| 7590 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7591 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7592 | si.payload.si4.cbch_mobile_alloc.v); |
| 7593 | } |
| 7594 | } |
| 7595 | [] IPA_RSL[0].receive { repeat; } |
| 7596 | [] T.timeout { |
| 7597 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7598 | } |
| 7599 | } |
| 7600 | |
| 7601 | /* Disable frequency hopping */ |
| 7602 | f_TC_fh_params_unset(fhp); |
| 7603 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7604 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7605 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7606 | |
| 7607 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7608 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7609 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7610 | |
| 7611 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7612 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7613 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7614 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7615 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7616 | } |
| 7617 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7618 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 7619 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 7620 | |
| 7621 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 7622 | template (present) BSSLAP_PDU expect_bsslap) |
| 7623 | { |
| 7624 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 7625 | if (not match(bsslap, expect_bsslap)) { |
| 7626 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 7627 | log("GOT BSSLAP: ", bsslap); |
| 7628 | setverdict(fail, "BSSLAP is not as expected"); |
| 7629 | mtc.stop; |
| 7630 | } |
| 7631 | setverdict(pass); |
| 7632 | } |
| 7633 | |
| 7634 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 7635 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 7636 | |
| 7637 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 7638 | var PDU_BSSAP_LE rx_bsslap; |
| 7639 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 7640 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 7641 | } |
| 7642 | |
| 7643 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7644 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 7645 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 7646 | f_sleep(1.0); |
| 7647 | |
| 7648 | f_establish_fully(omit, omit); |
| 7649 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7650 | |
| 7651 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7652 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7653 | |
| 7654 | var PDU_BSSAP_LE plr; |
| 7655 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7656 | |
| 7657 | if (not do_ta_request) { |
| 7658 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 7659 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 7660 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 7661 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 7662 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 7663 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 7664 | mtc.stop; |
| 7665 | } |
| 7666 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 7667 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 7668 | if (not match(bsslap, expect_ta_layer3)) { |
| 7669 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 7670 | log("GOT BSSLAP: ", bsslap); |
| 7671 | setverdict(fail, "BSSLAP is not as expected"); |
| 7672 | mtc.stop; |
| 7673 | } |
| 7674 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 7675 | * has no need to request the TA from the BSC and directly responds. */ |
| 7676 | } else { |
| 7677 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7678 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7679 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7680 | } |
| 7681 | |
| 7682 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7683 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7684 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7685 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7686 | |
| 7687 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 7688 | f_mo_l3_transceive(); |
| 7689 | |
| 7690 | f_perform_clear(RSL); |
| 7691 | |
| 7692 | f_sleep(2.0); |
| 7693 | setverdict(pass); |
| 7694 | } |
| 7695 | |
| 7696 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7697 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 7698 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 7699 | f_lcs_loc_req_for_active_ms(false); |
| 7700 | } |
| 7701 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 7702 | var MSC_ConnHdlr vc_conn; |
| 7703 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7704 | |
| 7705 | f_init(1, true); |
| 7706 | f_sleep(1.0); |
| 7707 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 7708 | vc_conn.done; |
| 7709 | } |
| 7710 | |
| 7711 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7712 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 7713 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 7714 | f_lcs_loc_req_for_active_ms(true); |
| 7715 | } |
| 7716 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 7717 | var MSC_ConnHdlr vc_conn; |
| 7718 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7719 | |
| 7720 | f_init(1, true); |
| 7721 | f_sleep(1.0); |
| 7722 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 7723 | vc_conn.done; |
| 7724 | } |
| 7725 | |
| 7726 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 7727 | * conn without an active lchan. */ |
| 7728 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 7729 | { |
| 7730 | var BssmapCause cause := 0; |
| 7731 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7732 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 7733 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7734 | |
| 7735 | timer no_more_bssap := 5.0; |
| 7736 | no_more_bssap.start; |
| 7737 | alt { |
| 7738 | [] no_more_bssap.timeout { break; } |
| 7739 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 7740 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 7741 | mtc.stop; |
| 7742 | } |
| 7743 | } |
| 7744 | setverdict(pass); |
| 7745 | } |
| 7746 | |
| 7747 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 7748 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 7749 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 7750 | { |
| 7751 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 7752 | |
| 7753 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 7754 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 7755 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 7756 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7757 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7758 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 7759 | |
| 7760 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 7761 | f_clear_A_conn(); |
| 7762 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7763 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7764 | } |
| 7765 | |
| 7766 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7767 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 7768 | */ |
| 7769 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 7770 | f_sleep(1.0); |
| 7771 | |
| 7772 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7773 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7774 | |
| 7775 | /* Register to receive the Paging Command */ |
| 7776 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7777 | g_chan_nr := new_chan_nr; |
| 7778 | f_rslem_register(0, g_chan_nr); |
| 7779 | |
| 7780 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7781 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7782 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7783 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7784 | |
| 7785 | var PDU_BSSAP_LE plr; |
| 7786 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7787 | |
| 7788 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7789 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7790 | |
| 7791 | /* OsmoBSC needs to Page */ |
| 7792 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 7793 | f_logp(BSCVTY, "got Paging Command"); |
| 7794 | |
| 7795 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 7796 | * the MSC, and releases the lchan directly. */ |
| 7797 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 7798 | f_expect_lchan_rel(RSL); |
| 7799 | |
| 7800 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 7801 | |
| 7802 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7803 | |
| 7804 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7805 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7806 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7807 | |
| 7808 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7809 | |
| 7810 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 7811 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 7812 | f_verify_active_A_conn_and_clear(); |
| 7813 | |
| 7814 | f_sleep(2.0); |
| 7815 | setverdict(pass); |
| 7816 | } |
| 7817 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 7818 | var MSC_ConnHdlr vc_conn; |
| 7819 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7820 | |
| 7821 | f_init(1, true); |
| 7822 | f_sleep(1.0); |
| 7823 | |
| 7824 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7825 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7826 | |
| 7827 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 7828 | vc_conn.done; |
| 7829 | } |
| 7830 | |
| 7831 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 7832 | */ |
| 7833 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 7834 | f_sleep(1.0); |
| 7835 | |
| 7836 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7837 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7838 | |
| 7839 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 7840 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7841 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 7842 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 7843 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7844 | |
| 7845 | /* BSC tells MSC about failure */ |
| 7846 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7847 | locationEstimate := omit, positioningData := omit, |
| 7848 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 7849 | |
| 7850 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7851 | f_verify_active_A_conn_and_clear(); |
| 7852 | |
| 7853 | f_sleep(2.0); |
| 7854 | setverdict(pass); |
| 7855 | } |
| 7856 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 7857 | var MSC_ConnHdlr vc_conn; |
| 7858 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7859 | |
| 7860 | f_init(1, true); |
| 7861 | f_sleep(1.0); |
| 7862 | |
| 7863 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7864 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7865 | |
| 7866 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 7867 | vc_conn.done; |
| 7868 | } |
| 7869 | |
| 7870 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7871 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 7872 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 7873 | f_sleep(1.0); |
| 7874 | |
| 7875 | f_establish_fully(omit, omit); |
| 7876 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7877 | |
| 7878 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7879 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7880 | |
| 7881 | var PDU_BSSAP_LE plr; |
| 7882 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7883 | |
| 7884 | if (do_ta) { |
| 7885 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7886 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7887 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7888 | } |
| 7889 | |
| 7890 | /* SMLC fails to respond, BSC runs into timeout */ |
| 7891 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 7892 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7893 | |
| 7894 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7895 | locationEstimate := omit, positioningData := omit, |
| 7896 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 7897 | |
| 7898 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7899 | f_verify_active_A_conn_and_clear(); |
| 7900 | |
| 7901 | f_sleep(2.0); |
| 7902 | setverdict(pass); |
| 7903 | } |
| 7904 | |
| 7905 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7906 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 7907 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 7908 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 7909 | } |
| 7910 | |
| 7911 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 7912 | var MSC_ConnHdlr vc_conn; |
| 7913 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7914 | |
| 7915 | f_init(1, true); |
| 7916 | f_sleep(1.0); |
| 7917 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 7918 | vc_conn.done; |
| 7919 | } |
| 7920 | |
| 7921 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7922 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 7923 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 7924 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 7925 | } |
| 7926 | |
| 7927 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 7928 | var MSC_ConnHdlr vc_conn; |
| 7929 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7930 | |
| 7931 | f_init(1, true); |
| 7932 | f_sleep(1.0); |
| 7933 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 7934 | vc_conn.done; |
| 7935 | } |
| 7936 | |
| 7937 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 7938 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 7939 | f_sleep(1.0); |
| 7940 | |
| 7941 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7942 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7943 | |
| 7944 | /* Register to receive the Paging Command */ |
| 7945 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7946 | g_chan_nr := new_chan_nr; |
| 7947 | f_rslem_register(0, g_chan_nr); |
| 7948 | |
| 7949 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7950 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7951 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7952 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7953 | |
| 7954 | var PDU_BSSAP_LE plr; |
| 7955 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7956 | |
| 7957 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7958 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7959 | |
| 7960 | /* OsmoBSC needs to Page */ |
| 7961 | var PDU_BSSAP_LE rx_bsslap; |
| 7962 | alt { |
| 7963 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 7964 | f_logp(BSCVTY, "got Paging Command"); |
| 7965 | repeat; |
| 7966 | } |
| 7967 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 7968 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 7969 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 7970 | } |
| 7971 | } |
| 7972 | |
| 7973 | /* SMLC responds with failure */ |
| 7974 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7975 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7976 | |
| 7977 | /* BSC tells MSC about failure */ |
| 7978 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7979 | locationEstimate := omit, positioningData := omit, |
| 7980 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 7981 | |
| 7982 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7983 | f_verify_active_A_conn_and_clear(); |
| 7984 | |
| 7985 | f_sleep(2.0); |
| 7986 | setverdict(pass); |
| 7987 | } |
| 7988 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 7989 | var MSC_ConnHdlr vc_conn; |
| 7990 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7991 | |
| 7992 | f_init(1, true); |
| 7993 | f_sleep(1.0); |
| 7994 | |
| 7995 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7996 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7997 | |
| 7998 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 7999 | vc_conn.done; |
| 8000 | } |
| 8001 | |
| 8002 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8003 | * over. */ |
| 8004 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8005 | f_sleep(1.0); |
| 8006 | |
| 8007 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8008 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8009 | |
| 8010 | /* Register to receive the Paging Command */ |
| 8011 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8012 | g_chan_nr := new_chan_nr; |
| 8013 | f_rslem_register(0, g_chan_nr); |
| 8014 | |
| 8015 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8016 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8017 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8018 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8019 | |
| 8020 | var PDU_BSSAP_LE plr; |
| 8021 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8022 | |
| 8023 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8024 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8025 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8026 | do_clear := false, expect_bssmap_l3 := true); |
| 8027 | |
| 8028 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8029 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8030 | |
| 8031 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8032 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8033 | |
| 8034 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8035 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8036 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8037 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8038 | |
| 8039 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8040 | f_mo_l3_transceive(); |
| 8041 | |
| 8042 | f_perform_clear(RSL); |
| 8043 | |
| 8044 | f_sleep(2.0); |
| 8045 | setverdict(pass); |
| 8046 | } |
| 8047 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8048 | var MSC_ConnHdlr vc_conn; |
| 8049 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8050 | |
| 8051 | f_init(1, true); |
| 8052 | f_sleep(1.0); |
| 8053 | |
| 8054 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8055 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8056 | |
| 8057 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8058 | vc_conn.done; |
| 8059 | } |
| 8060 | |
| 8061 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8062 | * the new lchan after handover. */ |
| 8063 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8064 | f_sleep(1.0); |
| 8065 | |
| 8066 | f_establish_fully(omit, omit); |
| 8067 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8068 | |
| 8069 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8070 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8071 | |
| 8072 | var PDU_BSSAP_LE plr; |
| 8073 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8074 | |
| 8075 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8076 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8077 | |
| 8078 | var HandoverState hs := { |
| 8079 | rr_ho_cmpl_seen := false, |
| 8080 | handover_done := false, |
| 8081 | old_chan_nr := - |
| 8082 | }; |
| 8083 | /* issue hand-over command on VTY */ |
| 8084 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8085 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8086 | f_rslem_suspend(RSL1_PROC); |
| 8087 | |
| 8088 | /* From the MGW perspective, a handover is is characterized by |
| 8089 | * performing one MDCX operation with the MGW. So we expect to see |
| 8090 | * one more MDCX during handover. */ |
| 8091 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8092 | |
| 8093 | alt { |
| 8094 | [] as_handover(hs); |
| 8095 | } |
| 8096 | |
| 8097 | var PDU_BSSAP_LE rx_bsslap; |
| 8098 | |
| 8099 | interleave { |
| 8100 | /* Expect the BSC to inform the MSC about the handover */ |
| 8101 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8102 | |
| 8103 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8104 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8105 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8106 | } |
| 8107 | } |
| 8108 | |
| 8109 | /* SMLC now responds with geo information data. */ |
| 8110 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8111 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8112 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8113 | |
| 8114 | /* lchan still active */ |
| 8115 | f_mo_l3_transceive(RSL1); |
| 8116 | |
| 8117 | /* MSC decides it is done now. */ |
| 8118 | f_perform_clear(RSL1); |
| 8119 | |
| 8120 | f_sleep(2.0); |
| 8121 | setverdict(pass); |
| 8122 | } |
| 8123 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8124 | var MSC_ConnHdlr vc_conn; |
| 8125 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8126 | |
| 8127 | f_init(2, true); |
| 8128 | f_sleep(1.0); |
| 8129 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8130 | vc_conn.done; |
| 8131 | } |
| 8132 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8133 | /* Dyn PDCH todo: |
| 8134 | * activate OSMO as TCH/F |
| 8135 | * activate OSMO as TCH/H |
| 8136 | * does the BSC-located PCU socket get the updated INFO? |
| 8137 | * what if no PCU is connected at the time? |
| 8138 | * is the info correct on delayed PCU (re)connect? |
| 8139 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8140 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8141 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8142 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8143 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8144 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8145 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8146 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8147 | execute( TC_ctrl_location() ); |
| 8148 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8149 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8150 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8151 | execute( TC_si2quater_2_earfcns() ); |
| 8152 | execute( TC_si2quater_3_earfcns() ); |
| 8153 | execute( TC_si2quater_4_earfcns() ); |
| 8154 | execute( TC_si2quater_5_earfcns() ); |
| 8155 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8156 | execute( TC_si2quater_12_earfcns() ); |
| 8157 | execute( TC_si2quater_23_earfcns() ); |
| 8158 | execute( TC_si2quater_32_earfcns() ); |
| 8159 | execute( TC_si2quater_33_earfcns() ); |
| 8160 | execute( TC_si2quater_42_earfcns() ); |
| 8161 | execute( TC_si2quater_48_earfcns() ); |
| 8162 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8163 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8164 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8165 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8166 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8167 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8168 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8169 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8170 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8171 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8172 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8173 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8174 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8175 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8176 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8177 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8178 | execute( TC_chan_rel_conn_fail() ); |
| 8179 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8180 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8181 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8182 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8183 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8184 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8185 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8186 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8187 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8188 | |
| 8189 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8190 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8191 | execute( TC_assignment_csd() ); |
| 8192 | execute( TC_assignment_ctm() ); |
| 8193 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8194 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8195 | execute( TC_assignment_aoip_tla_v6() ); |
| 8196 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8197 | execute( TC_assignment_fr_a5_0() ); |
| 8198 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8199 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8200 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8201 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8202 | execute( TC_assignment_fr_a5_3() ); |
| 8203 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8204 | execute( TC_ciph_mode_a5_0() ); |
| 8205 | execute( TC_ciph_mode_a5_1() ); |
| 8206 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8207 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8208 | execute( TC_assignment_codec_fr() ); |
| 8209 | execute( TC_assignment_codec_hr() ); |
| 8210 | execute( TC_assignment_codec_efr() ); |
| 8211 | execute( TC_assignment_codec_amr_f() ); |
| 8212 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8213 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8214 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8215 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8216 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8217 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8218 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8219 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8220 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8221 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8222 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8223 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8224 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8225 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8226 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8227 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8228 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8229 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8230 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8231 | execute( TC_assignment_codec_amr_h_S7() ); |
| 8232 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8233 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8234 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8235 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8236 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8237 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8238 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8239 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8240 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8241 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8242 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8243 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8244 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8245 | if (mp_enable_osmux_test) { |
| 8246 | execute( TC_assignment_osmux() ); |
| 8247 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8248 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8249 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8250 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8251 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8252 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8253 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8254 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8255 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8256 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8257 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8258 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8259 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8260 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8261 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8262 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8263 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8264 | execute( TC_paging_imsi_nochan() ); |
| 8265 | execute( TC_paging_tmsi_nochan() ); |
| 8266 | execute( TC_paging_tmsi_any() ); |
| 8267 | execute( TC_paging_tmsi_sdcch() ); |
| 8268 | execute( TC_paging_tmsi_tch_f() ); |
| 8269 | execute( TC_paging_tmsi_tch_hf() ); |
| 8270 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8271 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8272 | execute( TC_paging_imsi_nochan_ci() ); |
| 8273 | execute( TC_paging_imsi_nochan_lai() ); |
| 8274 | execute( TC_paging_imsi_nochan_lac() ); |
| 8275 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8276 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8277 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8278 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8279 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8280 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8281 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8282 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8283 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8284 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8285 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8286 | |
| 8287 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8288 | execute( TC_rsl_unknown_unit_id() ); |
| 8289 | |
| 8290 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8291 | |
| 8292 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8293 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8294 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8295 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8296 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8297 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8298 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8299 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8300 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8301 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8302 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8303 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8304 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8305 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8306 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8307 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8308 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8309 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8310 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8311 | execute( TC_ho_in_fail_msc_clears() ); |
| 8312 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8313 | execute( TC_ho_in_fail_no_detect() ); |
| 8314 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8315 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8316 | execute( TC_ho_neighbor_config_1() ); |
| 8317 | execute( TC_ho_neighbor_config_2() ); |
| 8318 | execute( TC_ho_neighbor_config_3() ); |
| 8319 | execute( TC_ho_neighbor_config_4() ); |
| 8320 | execute( TC_ho_neighbor_config_5() ); |
| 8321 | execute( TC_ho_neighbor_config_6() ); |
| 8322 | execute( TC_ho_neighbor_config_7() ); |
| 8323 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8324 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8325 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8326 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8327 | |
| 8328 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8329 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8330 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8331 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8332 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8333 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8334 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8335 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8336 | /* Power control related */ |
| 8337 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8338 | |
| 8339 | /* MSC pooling */ |
| 8340 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8341 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8342 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8343 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8344 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8345 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8346 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8347 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8348 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8349 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8350 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8351 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8352 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8353 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8354 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8355 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8356 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8357 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8358 | } |
| 8359 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8360 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8361 | execute( TC_early_conn_fail() ); |
| 8362 | execute( TC_late_conn_fail() ); |
| 8363 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8364 | /* Emergency call handling (deny / allow) */ |
| 8365 | execute( TC_assignment_emerg_setup_allow() ); |
| 8366 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 8367 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8368 | execute( TC_emerg_premption() ); |
| 8369 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8370 | /* Frequency hopping parameters handling */ |
| 8371 | execute( TC_fh_params_chan_activ() ); |
| 8372 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8373 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8374 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8375 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8376 | |
| 8377 | if (mp_enable_lcs_tests) { |
| 8378 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 8379 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 8380 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 8381 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 8382 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 8383 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 8384 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 8385 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 8386 | execute( TC_ho_during_lcs_loc_req() ); |
| 8387 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8388 | } |
| 8389 | |
| 8390 | } |