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 | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 23 | friend module BSC_Tests_VAMOS; |
| 24 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 25 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 26 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 28 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 29 | import from IPL4asp_Types all; |
| 30 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 31 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 32 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Adapter all; |
| 34 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 35 | import from BSSAP_LE_Types all; |
| 36 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from BSSAP_CodecPort all; |
| 38 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 39 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 40 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 42 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 43 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 44 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 45 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 46 | import from MGCP_Templates all; |
| 47 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 48 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 49 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 51 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 52 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 59 | import from Osmocom_VTY_Functions all; |
| 60 | import from TELNETasp_PortType all; |
| 61 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 62 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 63 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 64 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 65 | import from L3_Templates all; |
| 66 | import from GSM_RR_Types all; |
| 67 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 68 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 70 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 71 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 72 | import from SCCPasp_Types all; |
| 73 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 74 | import from GSM_SystemInformation all; |
| 75 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 76 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 77 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 78 | type record of integer integer_list; |
| 79 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 80 | const integer NUM_BTS := 3; |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 81 | const integer NUM_BTS_CFG := 4; /* we have 4 BTS in the osmo-bsc.cfg (for inter-BSC HO tests) but use only 3 */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 82 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 84 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 85 | /* 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] | 86 | const integer NUM_TCHH_PER_BTS := 2; |
| 87 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 88 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 89 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 90 | /* Default Training Sequence Code expected for bts[i]: |
| 91 | * BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2. |
| 92 | * BTS 1 has BSIC 11, TSC = (BSIC & 7) = 3. |
| 93 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 94 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 95 | */ |
| 96 | const integer_list BTS_TSC := { |
| 97 | 2, |
| 98 | 3, |
| 99 | 4, |
| 100 | 4 |
| 101 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 102 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 103 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 104 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 105 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 106 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 109 | /* Default list of counters for an 'msc' entity. */ |
| 110 | const CounterNameVals counternames_msc_mscpool := { |
| 111 | { "mscpool:subscr:new", 0 }, |
| 112 | { "mscpool:subscr:known", 0 }, |
| 113 | { "mscpool:subscr:reattach", 0 }, |
| 114 | { "mscpool:subscr:attach_lost", 0 }, |
| 115 | { "mscpool:subscr:paged", 0 } |
| 116 | }; |
| 117 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 118 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 119 | const CounterNameVals counternames_bsc_mscpool := { |
| 120 | { "mscpool:subscr:no_msc", 0 } |
| 121 | }; |
| 122 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 123 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 124 | const CounterNameVals counternames_bsc_bts_handover := { |
| 125 | { "assignment:attempted", 0 }, |
| 126 | { "assignment:completed", 0 }, |
| 127 | { "assignment:stopped", 0 }, |
| 128 | { "assignment:no_channel", 0 }, |
| 129 | { "assignment:timeout", 0 }, |
| 130 | { "assignment:failed", 0 }, |
| 131 | { "assignment:error", 0 }, |
| 132 | |
| 133 | { "handover:attempted", 0 }, |
| 134 | { "handover:completed", 0 }, |
| 135 | { "handover:stopped", 0 }, |
| 136 | { "handover:no_channel", 0 }, |
| 137 | { "handover:timeout", 0 }, |
| 138 | { "handover:failed", 0 }, |
| 139 | { "handover:error", 0 }, |
| 140 | |
| 141 | { "intra_cell_ho:attempted", 0 }, |
| 142 | { "intra_cell_ho:completed", 0 }, |
| 143 | { "intra_cell_ho:stopped", 0 }, |
| 144 | { "intra_cell_ho:no_channel", 0 }, |
| 145 | { "intra_cell_ho:timeout", 0 }, |
| 146 | { "intra_cell_ho:failed", 0 }, |
| 147 | { "intra_cell_ho:error", 0 }, |
| 148 | |
| 149 | { "intra_bsc_ho:attempted", 0 }, |
| 150 | { "intra_bsc_ho:completed", 0 }, |
| 151 | { "intra_bsc_ho:stopped", 0 }, |
| 152 | { "intra_bsc_ho:no_channel", 0 }, |
| 153 | { "intra_bsc_ho:timeout", 0 }, |
| 154 | { "intra_bsc_ho:failed", 0 }, |
| 155 | { "intra_bsc_ho:error", 0 }, |
| 156 | |
| 157 | { "interbsc_ho_out:attempted", 0 }, |
| 158 | { "interbsc_ho_out:completed", 0 }, |
| 159 | { "interbsc_ho_out:stopped", 0 }, |
| 160 | { "interbsc_ho_out:timeout", 0 }, |
| 161 | { "interbsc_ho_out:failed", 0 }, |
| 162 | { "interbsc_ho_out:error", 0 }, |
| 163 | |
| 164 | { "interbsc_ho_in:attempted", 0 }, |
| 165 | { "interbsc_ho_in:completed", 0 }, |
| 166 | { "interbsc_ho_in:stopped", 0 }, |
| 167 | { "interbsc_ho_in:no_channel", 0 }, |
| 168 | { "interbsc_ho_in:timeout", 0 }, |
| 169 | { "interbsc_ho_in:failed", 0 }, |
| 170 | { "interbsc_ho_in:error", 0 } |
| 171 | }; |
| 172 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 173 | const CounterNameVals counternames_bts_handover := { |
| 174 | { "incoming_intra_bsc_ho:attempted", 0 }, |
| 175 | { "incoming_intra_bsc_ho:completed", 0 }, |
| 176 | { "incoming_intra_bsc_ho:stopped", 0 }, |
| 177 | { "incoming_intra_bsc_ho:no_channel", 0 }, |
| 178 | { "incoming_intra_bsc_ho:timeout", 0 }, |
| 179 | { "incoming_intra_bsc_ho:failed", 0 }, |
| 180 | { "incoming_intra_bsc_ho:error", 0 } |
| 181 | }; |
| 182 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 183 | /* Set of all System Information received during one RSL port's startup. |
| 184 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 185 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 186 | */ |
| 187 | type record SystemInformationConfig { |
| 188 | SystemInformationType1 si1 optional, |
| 189 | SystemInformationType2 si2 optional, |
| 190 | SystemInformationType2bis si2bis optional, |
| 191 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 192 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 193 | SystemInformationType3 si3 optional, |
| 194 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 195 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 196 | SystemInformationType5 si5 optional, |
| 197 | SystemInformationType5bis si5bis optional, |
| 198 | SystemInformationType5ter si5ter optional, |
| 199 | SystemInformationType6 si6 optional |
| 200 | }; |
| 201 | |
| 202 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 203 | si1 := omit, |
| 204 | si2 := omit, |
| 205 | si2bis := omit, |
| 206 | si2ter := omit, |
| 207 | si2quater := omit, |
| 208 | si3 := omit, |
| 209 | si4 := omit, |
| 210 | si13 := omit, |
| 211 | si5 := omit, |
| 212 | si5bis := omit, |
| 213 | si5ter := omit, |
| 214 | si6 := omit |
| 215 | }; |
| 216 | |
| 217 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 218 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 219 | template uint3_t meas_bw := 3) |
| 220 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 221 | meas_bw_presence := '1'B, |
| 222 | meas_bw := meas_bw); |
| 223 | |
| 224 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 225 | 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] | 226 | template uint3_t prio := 3, |
| 227 | template (present) uint5_t thresh_high := 20, |
| 228 | template uint5_t thresh_low := 10, |
| 229 | template uint5_t qrxlevmin := 22) |
| 230 | := tr_EUTRAN_NeighbourCells( |
| 231 | cell_desc_list := cell_desc_list, |
| 232 | prio_presence := '1'B, |
| 233 | prio := prio, |
| 234 | thresh_high := thresh_high, |
| 235 | thresh_low_presence := '1'B, |
| 236 | thresh_low := thresh_low, |
| 237 | qrxlevmin_presence := '1'B, |
| 238 | qrxlevmin := qrxlevmin); |
| 239 | |
| 240 | template SystemInformationConfig SystemInformationConfig_default := { |
| 241 | si1 := { |
| 242 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 243 | rach_control := { |
| 244 | max_retrans := RACH_MAX_RETRANS_7, |
| 245 | tx_integer := '1001'B, |
| 246 | cell_barr_access := false, |
| 247 | re_not_allowed := true, |
| 248 | acc := '0000010000000000'B |
| 249 | }, |
| 250 | rest_octets := ? |
| 251 | }, |
| 252 | si2 := { |
| 253 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 254 | ncc_permitted := '11111111'B, |
| 255 | rach_control := { |
| 256 | max_retrans := RACH_MAX_RETRANS_7, |
| 257 | tx_integer := '1001'B, |
| 258 | cell_barr_access := false, |
| 259 | re_not_allowed := true, |
| 260 | acc := '0000010000000000'B |
| 261 | } |
| 262 | }, |
| 263 | si2bis := omit, |
| 264 | si2ter := { |
| 265 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 266 | rest_octets := ? |
| 267 | }, |
| 268 | si2quater := { |
| 269 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 270 | }, |
| 271 | si3 := { |
| 272 | cell_id := 0, |
| 273 | lai := { |
| 274 | mcc_mnc := '001F01'H, |
| 275 | lac := 1 |
| 276 | }, |
| 277 | ctrl_chan_desc := { |
| 278 | msc_r99 := true, |
| 279 | att := true, |
| 280 | bs_ag_blks_res := 1, |
| 281 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 282 | si22ind := false, |
| 283 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 284 | spare := '00'B, |
| 285 | bs_pa_mfrms := 3, |
| 286 | t3212 := 30 |
| 287 | }, |
| 288 | cell_options := { |
| 289 | dn_ind := false, |
| 290 | pwrc := false, |
| 291 | dtx := MS_SHALL_USE_UL_DTX, |
| 292 | radio_link_tout_div4 := 7 |
| 293 | }, |
| 294 | cell_sel_par := { |
| 295 | cell_resel_hyst_2dB := 2, |
| 296 | ms_txpwr_max_cch := 7, |
| 297 | acs := '0'B, |
| 298 | neci := true, |
| 299 | rxlev_access_min := 0 |
| 300 | }, |
| 301 | rach_control := { |
| 302 | max_retrans := RACH_MAX_RETRANS_7, |
| 303 | tx_integer := '1001'B, |
| 304 | cell_barr_access := false, |
| 305 | re_not_allowed := true, |
| 306 | acc := '0000010000000000'B |
| 307 | }, |
| 308 | rest_octets := { |
| 309 | sel_params := { |
| 310 | presence := '0'B, |
| 311 | params := omit |
| 312 | }, |
| 313 | pwr_offset := { |
| 314 | presence := '0'B, |
| 315 | offset := omit |
| 316 | }, |
| 317 | si_2ter_ind := '1'B, |
| 318 | early_cm_ind := '0'B, |
| 319 | sched_where := { |
| 320 | presence := '0'B, |
| 321 | where := omit |
| 322 | }, |
| 323 | gprs_ind := { |
| 324 | presence := '1'B, |
| 325 | ind := { |
| 326 | ra_colour := 0, |
| 327 | si13_pos := '0'B |
| 328 | } |
| 329 | }, |
| 330 | umts_early_cm_ind := '1'B, |
| 331 | si2_quater_ind := { |
| 332 | presence := '1'B, |
| 333 | ind := '0'B |
| 334 | }, |
| 335 | iu_mode_ind := omit, |
| 336 | si21_ind := { |
| 337 | presence := '0'B, |
| 338 | pos := omit |
| 339 | } |
| 340 | } |
| 341 | }, |
| 342 | si4 := { |
| 343 | lai := { |
| 344 | mcc_mnc := '001F01'H, |
| 345 | lac := 1 |
| 346 | }, |
| 347 | cell_sel_par := { |
| 348 | cell_resel_hyst_2dB := 2, |
| 349 | ms_txpwr_max_cch := 7, |
| 350 | acs := '0'B, |
| 351 | neci := true, |
| 352 | rxlev_access_min := 0 |
| 353 | }, |
| 354 | rach_control := { |
| 355 | max_retrans := RACH_MAX_RETRANS_7, |
| 356 | tx_integer := '1001'B, |
| 357 | cell_barr_access := false, |
| 358 | re_not_allowed := true, |
| 359 | acc := '0000010000000000'B |
| 360 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 361 | cbch_chan_desc := { |
| 362 | iei := '64'O, |
| 363 | v := { |
| 364 | chan_nr := { |
| 365 | u := { |
| 366 | sdcch4 := { |
| 367 | tag := '001'B, |
| 368 | sub_chan := 2 |
| 369 | } |
| 370 | }, |
| 371 | tn := 0 |
| 372 | }, |
| 373 | tsc := 2, |
| 374 | h := false, |
| 375 | arfcn := 871, |
| 376 | maio_hsn := omit |
| 377 | } |
| 378 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 379 | cbch_mobile_alloc := omit, |
| 380 | rest_octets := { |
| 381 | sel_params := { |
| 382 | presence := '0'B, |
| 383 | params := omit |
| 384 | }, |
| 385 | pwr_offset := { |
| 386 | presence := '0'B, |
| 387 | offset := omit |
| 388 | }, |
| 389 | gprs_ind := { |
| 390 | presence := '1'B, |
| 391 | ind := { |
| 392 | ra_colour := 0, |
| 393 | si13_pos := '0'B |
| 394 | } |
| 395 | }, |
| 396 | s_presence := '0'B, |
| 397 | s := omit |
| 398 | } |
| 399 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 400 | si13 := { |
| 401 | rest_octets := { |
| 402 | presence := '1'B, |
| 403 | bcch_change_mark := ?, |
| 404 | si_change_field := '0000'B, |
| 405 | presence2 := '0'B, |
| 406 | si13_change_mark := omit, |
| 407 | gprs_ma := omit, |
| 408 | zero := '0'B, /* PBCCH not present in cell */ |
| 409 | rac := 0, |
| 410 | spgc_ccch_sup := '0'B, |
| 411 | priority_access_thr := '110'B, |
| 412 | network_control_order := '00'B, |
| 413 | gprs_cell_opts := { |
| 414 | nmo := '01'B, |
| 415 | t3168 := '011'B, |
| 416 | t3192 := '010'B, |
| 417 | drx_timer_max := '011'B, |
| 418 | access_burst_type := '0'B, |
| 419 | control_ack_type := '1'B, |
| 420 | bs_cv_max := 15, |
| 421 | pan_presence := '1'B, |
| 422 | pan_dec := 1, |
| 423 | pan_inc := 1, |
| 424 | pan_max := '111'B, |
| 425 | ext_info_presence := ?, |
| 426 | ext_info_length := *, |
| 427 | ext_info := * |
| 428 | }, |
| 429 | gprs_pwr_ctrl_params := { |
| 430 | alpha := 0, |
| 431 | t_avg_w := '10000'B, |
| 432 | t_avg_t := '10000'B, |
| 433 | pc_meas_chan := '0'B, |
| 434 | n_avg_i := '1000'B |
| 435 | } |
| 436 | } |
| 437 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 438 | si5 := { |
| 439 | bcch_freq_list := '10000000000000000000000000000000'O |
| 440 | }, |
| 441 | si5bis := omit, |
| 442 | si5ter := { |
| 443 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 444 | }, |
| 445 | si6 := { |
| 446 | cell_id := 0, |
| 447 | lai := { |
| 448 | mcc_mnc := '001F01'H, |
| 449 | lac := 1 |
| 450 | }, |
| 451 | cell_options := { |
| 452 | dtx_ext := '1'B, |
| 453 | pwrc := false, |
| 454 | dtx := '01'B, |
| 455 | radio_link_timeout := '0111'B |
| 456 | }, |
| 457 | ncc_permitted := '11111111'B, |
| 458 | rest_octets := ? |
| 459 | } |
| 460 | }; |
| 461 | |
| 462 | |
| 463 | /* List of all the System Information received on all RSL ports */ |
| 464 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 465 | |
| 466 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 467 | { |
| 468 | var RSL_IE_Body sysinfo_type_ie; |
| 469 | var RSL_IE_SysinfoType si_type; |
| 470 | var octetstring data; |
| 471 | |
| 472 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 473 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 474 | mtc.stop; |
| 475 | } |
| 476 | si_type := sysinfo_type_ie.sysinfo_type; |
| 477 | |
| 478 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 479 | var RSL_IE_Body bcch_ie; |
| 480 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 481 | data := bcch_ie.other.payload; |
| 482 | } |
| 483 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 484 | var RSL_IE_Body l3_ie; |
| 485 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 486 | data := l3_ie.l3_info.payload; |
| 487 | } |
| 488 | } else { |
| 489 | setverdict(fail, "Don't understand this System Information message"); |
| 490 | mtc.stop; |
| 491 | } |
| 492 | |
| 493 | var boolean handled := false; |
| 494 | |
| 495 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 496 | handled := true; |
| 497 | |
| 498 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 499 | if (not isbound(data)) { |
| 500 | si.si1 := omit; |
| 501 | } else { |
| 502 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 503 | } |
| 504 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 505 | if (not isbound(data)) { |
| 506 | si.si2 := omit; |
| 507 | } else { |
| 508 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 509 | } |
| 510 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 511 | if (not isbound(data)) { |
| 512 | si.si2bis := omit; |
| 513 | } else { |
| 514 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 515 | } |
| 516 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 517 | if (not isbound(data)) { |
| 518 | si.si2ter := omit; |
| 519 | } else { |
| 520 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 521 | } |
| 522 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 523 | if (not isbound(data)) { |
| 524 | si.si2quater := {}; |
| 525 | } else { |
| 526 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 527 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 528 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 529 | } |
| 530 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 531 | if (not isbound(data)) { |
| 532 | si.si3 := omit; |
| 533 | } else { |
| 534 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 535 | } |
| 536 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 537 | if (not isbound(data)) { |
| 538 | si.si4 := omit; |
| 539 | } else { |
| 540 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 541 | } |
| 542 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 543 | if (not isbound(data)) { |
| 544 | si.si13 := omit; |
| 545 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 546 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 547 | } |
| 548 | } else { |
| 549 | handled := false; |
| 550 | } |
| 551 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 552 | handled := true; |
| 553 | |
| 554 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 555 | if (not isbound(data)) { |
| 556 | si.si5 := omit; |
| 557 | } else { |
| 558 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 559 | } |
| 560 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 561 | if (not isbound(data)) { |
| 562 | si.si5bis := omit; |
| 563 | } else { |
| 564 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 565 | } |
| 566 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 567 | if (not isbound(data)) { |
| 568 | si.si5ter := omit; |
| 569 | } else { |
| 570 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 571 | } |
| 572 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 573 | if (not isbound(data)) { |
| 574 | si.si6 := omit; |
| 575 | } else { |
| 576 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 577 | } |
| 578 | } else { |
| 579 | handled := false; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | if (not handled) { |
| 584 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 585 | } |
| 586 | } |
| 587 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 588 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 589 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 590 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 591 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 592 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 593 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 594 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 595 | 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] | 596 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 597 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 598 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 599 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 600 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 601 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 602 | /* StatsD */ |
| 603 | var StatsD_Checker_CT vc_STATSD; |
| 604 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 605 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 606 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 607 | /* for old legacy-tests only */ |
| 608 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 609 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 610 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 611 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 612 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 613 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 614 | /* Osmux is enabled through VTY */ |
| 615 | var boolean g_osmux_enabled := false; |
| 616 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 617 | /*Configure T(tias) over VTY, seconds */ |
| 618 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 619 | /*Configure T(tiar) over VTY, seconds */ |
| 620 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 621 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 622 | /* 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] | 623 | timer T_guard := 30.0; |
| 624 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 625 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 626 | var CounterNameValsList g_ctr_bsc; |
| 627 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 628 | |
| 629 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 630 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 631 | } |
| 632 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 633 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 634 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 635 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 636 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 637 | /* port number to which to establish the IPA OML connections */ |
| 638 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 639 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 640 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 641 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 642 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 643 | /* port number to which to listen for STATSD metrics */ |
| 644 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 645 | /* IP address at which the test binds */ |
| 646 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 647 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 648 | RAN_Configurations mp_bssap_cfg := { |
| 649 | { |
| 650 | transport := BSSAP_TRANSPORT_AoIP, |
| 651 | sccp_service_type := "mtp3_itu", |
| 652 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 653 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 654 | own_ssn := 254, |
| 655 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 656 | peer_ssn := 254, |
| 657 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 658 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 659 | }, |
| 660 | { |
| 661 | transport := BSSAP_TRANSPORT_AoIP, |
| 662 | sccp_service_type := "mtp3_itu", |
| 663 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 664 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 665 | own_ssn := 254, |
| 666 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 667 | peer_ssn := 254, |
| 668 | sio := '83'O, |
| 669 | rctx := 2 |
| 670 | }, |
| 671 | { |
| 672 | transport := BSSAP_TRANSPORT_AoIP, |
| 673 | sccp_service_type := "mtp3_itu", |
| 674 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 675 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 676 | own_ssn := 254, |
| 677 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 678 | peer_ssn := 254, |
| 679 | sio := '83'O, |
| 680 | rctx := 3 |
| 681 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 682 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 683 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 684 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 685 | phys_chan_configs phys_chan_config := { |
| 686 | "CCCH+SDCCH4+CBCH", |
| 687 | "TCH/F", |
| 688 | "TCH/F", |
| 689 | "TCH/F", |
| 690 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 691 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 692 | "PDCH", |
| 693 | "PDCH" |
| 694 | }; |
| 695 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 696 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 697 | sccp_service_type := "mtp3_itu", |
| 698 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 699 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 700 | own_ssn := 252, /* SMLC side SSN */ |
| 701 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 702 | peer_ssn := 250, /* BSC side SSN */ |
| 703 | sio := '83'O, |
| 704 | rctx := 6 |
| 705 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 706 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 707 | |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 708 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 709 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 710 | } |
| 711 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 712 | friend function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 713 | |
| 714 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 715 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 716 | pars.aoip := true; |
| 717 | } else { |
| 718 | pars.aoip := false; |
| 719 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 720 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 721 | pars.mscpool.bssap_idx := bssap_idx; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 722 | pars.expect_tsc := BTS_TSC[0]; |
Vadim Yanitskiy | 96bb9cb | 2021-12-10 21:14:15 +0300 | [diff] [blame] | 723 | pars.imsi := f_rnd_imsi('00101'H); |
| 724 | |
| 725 | log(testcasename(), ": using IMSI ", pars.imsi); |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 726 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 727 | return pars; |
| 728 | } |
| 729 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 730 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 731 | |
| 732 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 733 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 734 | log("initial msc rate counters: ", g_ctr_msc); |
| 735 | } |
| 736 | |
| 737 | 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] | 738 | 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] | 739 | } |
| 740 | |
| 741 | /* f_ctrs_msc_init(); |
| 742 | * f_do_thing(on_msc := 0); |
| 743 | * f_do_thing(on_msc := 0); |
| 744 | * f_do_other(on_msc := 1); |
| 745 | * f_ctrs_msc_add(0, "thing", 2); |
| 746 | * f_ctrs_msc_add(1, "other"); |
| 747 | * f_ctrs_msc_verify(); |
| 748 | */ |
| 749 | private function f_ctrs_msc_verify() runs on test_CT { |
| 750 | log("verifying msc rate counters: ", g_ctr_msc); |
| 751 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 752 | } |
| 753 | |
| 754 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 755 | * f_ctrs_msc_init(); |
| 756 | * f_do_thing(on_msc := 0); |
| 757 | * f_do_thing(on_msc := 0); |
| 758 | * f_do_thing(on_msc := 0); |
| 759 | * f_ctrs_msc_expect(0, "thing", 3); |
| 760 | */ |
| 761 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 762 | f_ctrs_msc_add(msc_nr, countername, val); |
| 763 | f_ctrs_msc_verify(); |
| 764 | } |
| 765 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 766 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 767 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 768 | private function f_ctrs_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 769 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
Neels Hofmeyr | 4dec8cc | 2021-11-29 15:59:44 +0100 | [diff] [blame] | 770 | log("initial bts rate counters: ", g_ctr_bts); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 774 | f_ctrs_bts_init(bts_count, counternames); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 775 | f_ctrs_bsc_init(counternames); |
| 776 | } |
| 777 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 778 | private function f_ctrs_bsc_and_bts_handover_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 779 | var CounterNameVals bts_names := counternames_bsc_bts_handover & counternames_bts_handover; |
Neels Hofmeyr | 4dec8cc | 2021-11-29 15:59:44 +0100 | [diff] [blame] | 780 | f_ctrs_bts_init(bts_count, bts_names); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 781 | f_ctrs_bsc_init(counternames_bsc_bts_handover); |
| 782 | } |
| 783 | |
| 784 | private function f_ctrs_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 785 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 789 | f_ctrs_bts_add(bts_nr, countername, val); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 790 | f_ctrs_bsc_add(countername, val); |
| 791 | } |
| 792 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 793 | function f_ctrs_bts_verify() runs on test_CT { |
| 794 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 795 | } |
| 796 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 797 | /* f_ctrs_bsc_and_bts_init(); |
| 798 | * f_do_thing(on_bts := 0); |
| 799 | * f_do_thing(on_bts := 0); |
| 800 | * f_do_other(on_bts := 1); |
| 801 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 802 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 803 | * f_ctrs_bsc_and_bts_verify(); |
| 804 | */ |
| 805 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 806 | f_ctrs_bts_verify(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 807 | f_ctrs_bsc_verify(); |
| 808 | } |
| 809 | |
| 810 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 811 | * f_ctrs_bsc_and_bts_init(); |
| 812 | * f_do_thing(on_bts := 0); |
| 813 | * f_do_thing(on_bts := 0); |
| 814 | * f_do_thing(on_bts := 0); |
| 815 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 816 | */ |
| 817 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 818 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 819 | f_ctrs_bsc_and_bts_verify(); |
| 820 | } |
| 821 | |
| 822 | |
| 823 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 824 | |
| 825 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 826 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 827 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 828 | } |
| 829 | |
| 830 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 831 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 832 | } |
| 833 | |
| 834 | /* f_ctrs_bsc_init(); |
| 835 | * f_do_thing(); |
| 836 | * f_do_thing(); |
| 837 | * f_do_other(); |
| 838 | * f_ctrs_bsc_add("thing", 2); |
| 839 | * f_ctrs_bsc_add("other"); |
| 840 | * f_ctrs_bsc_verify(); |
| 841 | */ |
| 842 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 843 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 844 | } |
| 845 | |
| 846 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 847 | * f_ctrs_bsc_init(); |
| 848 | * f_do_thing(); |
| 849 | * f_ctrs_bsc_expect("thing", 1); |
| 850 | */ |
| 851 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 852 | f_ctrs_bsc_add(countername, val); |
| 853 | f_ctrs_bsc_verify(); |
| 854 | } |
| 855 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 856 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 857 | friend function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 858 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 859 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 860 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 861 | } |
| 862 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 863 | 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] | 864 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 865 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 866 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 867 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 868 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 869 | T.start; |
| 870 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 871 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 872 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 873 | 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] | 874 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 875 | [] 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] | 876 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 877 | 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] | 878 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 879 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 880 | repeat; |
| 881 | } |
| 882 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 883 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 884 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 885 | /* If we received a RESET after ours was sent, it |
| 886 | may be a race condition where the other peer beacame |
| 887 | available after we sent it, but we are in a desired |
| 888 | state anyway, so go forward. */ |
| 889 | if (not reset_received) { |
| 890 | setverdict(fail); |
| 891 | } |
| 892 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 893 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 894 | } |
| 895 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 896 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 897 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 898 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 899 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 900 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 901 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 902 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 903 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 904 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 907 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 908 | * \param clnt IPA_Client for which to establish |
| 909 | * \param bsc_host IP address / hostname of the BSC |
| 910 | * \param bsc_port TCP port number of the BSC |
| 911 | * \param i number identifying this BTS |
| 912 | * \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] | 913 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 914 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 915 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 916 | timer T := 10.0; |
| 917 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 918 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 919 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA") alive; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 920 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 921 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 922 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 923 | if (handler_mode) { |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 924 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL") alive; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 925 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 926 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 927 | |
| 928 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 929 | if (handler_mode) { |
| 930 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 931 | } else { |
| 932 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 933 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 934 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 935 | 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] | 936 | if (handler_mode) { |
| 937 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 938 | return; |
| 939 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 940 | |
| 941 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 942 | T.start; |
| 943 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 944 | [] 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] | 945 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 946 | 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] | 947 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 948 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 949 | [] IPA_RSL[i].receive { repeat } |
| 950 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 951 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 952 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 953 | } |
| 954 | } |
| 955 | } |
| 956 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 957 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 958 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 959 | return; |
| 960 | } |
| 961 | clnt.vc_IPA.stop; |
| 962 | if (isbound(clnt.vc_RSL)) { |
| 963 | clnt.vc_RSL.stop; |
| 964 | } |
| 965 | } |
| 966 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 967 | /* 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] | 968 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 969 | timer T := secs_max; |
| 970 | T.start; |
| 971 | while (true) { |
| 972 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 973 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 974 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 975 | * until all MO's are initialized */ |
| 976 | T.start(1.0); |
| 977 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 978 | return; |
| 979 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 980 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 981 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 982 | 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] | 983 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 984 | } |
| 985 | } |
| 986 | } |
| 987 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 988 | /* 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] | 989 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 990 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 991 | [] T_guard.timeout { |
| 992 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 993 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 994 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 995 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 996 | [] 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] | 997 | 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] | 998 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 999 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1000 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1001 | } |
| 1002 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1003 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1004 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1005 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1006 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1007 | } |
| 1008 | } |
| 1009 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1010 | function f_init_mgcp(charstring id) runs on test_CT { |
| 1011 | id := id & "-MGCP"; |
| 1012 | |
| 1013 | var MGCPOps ops := { |
| 1014 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 1015 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 1016 | }; |
| 1017 | var MGCP_conn_parameters mgcp_pars := { |
| 1018 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 1019 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1020 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 1021 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 1022 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 1023 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1024 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1025 | }; |
| 1026 | |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 1027 | vc_MGCP := MGCP_Emulation_CT.create(id) alive; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1028 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 1029 | } |
| 1030 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1031 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 1032 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 1033 | * OsmuxCID IE. |
| 1034 | */ |
| 1035 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 1036 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 1037 | if (allow) { |
| 1038 | f_vty_transceive(BSCVTY, "osmux on"); |
| 1039 | } else { |
| 1040 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1041 | } |
| 1042 | f_vty_transceive(BSCVTY, "exit"); |
| 1043 | f_vty_transceive(BSCVTY, "exit"); |
| 1044 | g_osmux_enabled := allow; |
| 1045 | } |
| 1046 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1047 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1048 | if (BSCVTY.checkstate("Mapped")) { |
| 1049 | /* skip initialization if already executed once */ |
| 1050 | return; |
| 1051 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1052 | map(self:BSCVTY, system:BSCVTY); |
| 1053 | f_vty_set_prompts(BSCVTY); |
| 1054 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1055 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1056 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1057 | } |
| 1058 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1059 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1060 | { |
| 1061 | // log on TTCN3 log output |
| 1062 | log(log_msg); |
| 1063 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1064 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1065 | } |
| 1066 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1067 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1068 | { |
| 1069 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1070 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1071 | } |
| 1072 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1073 | } |
| 1074 | |
| 1075 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1076 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1077 | |
| 1078 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1079 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1080 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1081 | repeat; |
| 1082 | } |
| 1083 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1084 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1085 | repeat; |
| 1086 | } |
| 1087 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1088 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1089 | repeat; |
| 1090 | } |
| 1091 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1092 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1093 | repeat; |
| 1094 | } |
| 1095 | |
| 1096 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1097 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1098 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1099 | repeat; |
| 1100 | } |
| 1101 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1102 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1103 | repeat; |
| 1104 | } |
| 1105 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1106 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1107 | repeat; |
| 1108 | } |
| 1109 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1110 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1111 | repeat; |
| 1112 | } |
| 1113 | } |
| 1114 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1115 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1116 | private type record of boolean my_BooleanList; |
| 1117 | |
| 1118 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1119 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1120 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1121 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1122 | 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] | 1123 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1124 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1125 | * stepping into that config node. */ |
| 1126 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1127 | continue; |
| 1128 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1129 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1130 | if (allow_attach_list[msc_nr]) { |
| 1131 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1132 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1133 | } else { |
| 1134 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1135 | } |
| 1136 | f_vty_transceive(pt, "exit"); |
| 1137 | f_vty_transceive(pt, "exit"); |
| 1138 | } |
| 1139 | } |
| 1140 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1141 | /* global initialization function |
| 1142 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1143 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1144 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1145 | */ |
| 1146 | 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] | 1147 | 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] | 1148 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1149 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1150 | if (g_initialized) { |
| 1151 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1152 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1153 | g_initialized := true; |
| 1154 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1155 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1156 | activate(as_Tguard()); |
| 1157 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1158 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 1159 | f_vty_allow_osmux(allow_osmux); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1160 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1161 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1162 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1163 | |
Neels Hofmeyr | 9db8e0e | 2021-08-23 20:45:58 +0200 | [diff] [blame] | 1164 | /* Make sure each MSC's internal state is "DISCONNECTED" at first */ |
| 1165 | for (bssap_idx := 0; bssap_idx < NUM_MSC; bssap_idx := bssap_idx+1) { |
| 1166 | f_vty_transceive(BSCVTY, "msc " & int2str(bssap_idx) & " bssmap reset", strict := false); |
| 1167 | } |
| 1168 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1169 | 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] | 1170 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1171 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1172 | * MSC-side BSSAP emulation */ |
| 1173 | if (handler_mode) { |
| 1174 | var RanOps ranops := MSC_RanOps; |
| 1175 | ranops.use_osmux := g_osmux_enabled; |
| 1176 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1177 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1178 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1179 | } else { |
| 1180 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1181 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1182 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1183 | f_legacy_bssap_reset(); |
| 1184 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1185 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1186 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1187 | if (mp_enable_lcs_tests) { |
| 1188 | if (handler_mode) { |
| 1189 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1190 | } else { |
| 1191 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1192 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1193 | } |
| 1194 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1195 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1196 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1197 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1198 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1199 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1200 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1201 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1202 | f_init_mgcp("VirtMSC"); |
| 1203 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1204 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1205 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1206 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1207 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1208 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1209 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1210 | runs on test_CT { |
| 1211 | /* wait until osmo-bts-omldummy has respawned */ |
| 1212 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1213 | |
| 1214 | /* start RSL connection */ |
| 1215 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1216 | /* wait until BSC tells us "connected" */ |
| 1217 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1218 | } |
| 1219 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1220 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1221 | template SystemInformationConfig expect_si) |
| 1222 | runs on test_CT { |
| 1223 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1224 | |
| 1225 | f_init_bts(bts_idx, handler_mode); |
| 1226 | |
| 1227 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1228 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1229 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1230 | */ |
| 1231 | f_sleep(5.0); |
| 1232 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1233 | |
| 1234 | deactivate(sysinfo); |
| 1235 | |
| 1236 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1237 | setverdict(pass); |
| 1238 | } else { |
| 1239 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1240 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1241 | setverdict(fail, "received SI does not match expectations"); |
| 1242 | return; |
| 1243 | } |
| 1244 | } |
| 1245 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1246 | /* 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] | 1247 | 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] | 1248 | runs on test_CT return RSL_Message { |
| 1249 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1250 | timer T := t_secs; |
| 1251 | |
| 1252 | T.start; |
| 1253 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1254 | [] 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] | 1255 | T.stop; |
| 1256 | } |
| 1257 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1258 | [] T.timeout { |
| 1259 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1260 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1261 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | } |
| 1263 | return rx_rsl_ud.rsl; |
| 1264 | } |
| 1265 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1266 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1267 | 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] | 1268 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1269 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1270 | } |
| 1271 | |
| 1272 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1273 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1274 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1275 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1276 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1277 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1278 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1279 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1280 | 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] | 1281 | 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] | 1282 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1283 | } |
| 1284 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1285 | const CounterNameVals counternames_bts_chreq := { |
| 1286 | { "chreq:total", 0 }, |
| 1287 | { "chreq:attempted_emerg", 0 }, |
| 1288 | { "chreq:attempted_call", 0 }, |
| 1289 | { "chreq:attempted_location_upd", 0 }, |
| 1290 | { "chreq:attempted_pag", 0 }, |
| 1291 | { "chreq:attempted_pdch", 0 }, |
| 1292 | { "chreq:attempted_other", 0 }, |
| 1293 | { "chreq:attempted_unknown", 0 }, |
| 1294 | { "chreq:successful", 0 }, |
| 1295 | { "chreq:successful_emerg", 0 }, |
| 1296 | { "chreq:successful_call", 0 }, |
| 1297 | { "chreq:successful_location_upd", 0 }, |
| 1298 | { "chreq:successful_pag", 0 }, |
| 1299 | { "chreq:successful_pdch", 0 }, |
| 1300 | { "chreq:successful_other", 0 }, |
| 1301 | { "chreq:successful_unknown", 0 }, |
| 1302 | { "chreq:no_channel", 0 }, |
| 1303 | { "chreq:max_delay_exceeded", 0 } |
| 1304 | }; |
| 1305 | |
| 1306 | /* verify the "chreq:*" counters */ |
| 1307 | private function f_chan_act_counter(OCT1 ra, charstring chreq_ctr_suffix) runs on test_CT |
| 1308 | { |
| 1309 | var GsmFrameNumber fn := 23; |
| 1310 | |
| 1311 | f_logp(BSCVTY, "f_chan_act_counter(" & chreq_ctr_suffix & ")"); |
| 1312 | |
| 1313 | var RSL_Message rx_rsl; |
| 1314 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1315 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1316 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1317 | |
| 1318 | f_ctrs_bts_add(0, "chreq:total"); |
| 1319 | f_ctrs_bts_add(0, "chreq:attempted_" & chreq_ctr_suffix); |
| 1320 | f_ctrs_bts_verify(); |
| 1321 | |
| 1322 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 1323 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 1324 | |
| 1325 | f_ctrs_bts_add(0, "chreq:successful"); |
| 1326 | f_ctrs_bts_add(0, "chreq:successful_" & chreq_ctr_suffix); |
| 1327 | f_ctrs_bts_verify(); |
| 1328 | |
| 1329 | /* test is done, release RSL Conn Fail Ind to clean up */ |
| 1330 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1331 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1332 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 1333 | f_sleep(1.0); |
| 1334 | } |
| 1335 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1336 | testcase TC_chan_act_counter() runs on test_CT { |
| 1337 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1338 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1339 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1340 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1341 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1342 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1343 | f_vty_allow_emerg_bts(true, 0); |
| 1344 | |
| 1345 | f_ctrs_bts_init(1, counternames_bts_chreq); |
| 1346 | |
| 1347 | /* emergency call: RA & 0xe0 == 0xa0 --> CHREQ_T_EMERG_CALL */ |
| 1348 | f_chan_act_counter('a3'O, "emerg"); |
| 1349 | |
| 1350 | /* voice TCH/H: RA & 0xf0 == 0x40 --> CHREQ_T_VOICE_CALL_TCH_H */ |
| 1351 | f_chan_act_counter('43'O, "call"); |
| 1352 | |
| 1353 | /* LU: RA & 0xf0 == 0x00 --> CHREQ_T_LOCATION_UPD */ |
| 1354 | f_chan_act_counter('03'O, "location_upd"); |
| 1355 | |
| 1356 | /* Paging: RA & 0xf0 == 0x20 --> CHREQ_T_PAG_R_TCH_F */ |
| 1357 | f_chan_act_counter('23'O, "pag"); |
| 1358 | /* Paging: RA & 0xf0 == 0x30 --> CHREQ_T_PAG_R_TCH_FH */ |
| 1359 | f_chan_act_counter('33'O, "pag"); |
| 1360 | |
| 1361 | /* LU: RA & 0xfc == 0x78 --> CHREQ_T_PDCH_TWO_PHASE */ |
| 1362 | /* no PCU, so PDCH not allowed. Skip this test for now. */ |
| 1363 | /* f_chan_act_counter('7b'O, "pdch"); */ |
| 1364 | |
| 1365 | /* LU: RA & 0xf0 == 0x10 --> CHREQ_T_SDCCH */ |
| 1366 | f_chan_act_counter('13'O, "other"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1367 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1368 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1369 | } |
| 1370 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1371 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1372 | 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] | 1373 | var RSL_Message rx_rsl; |
| 1374 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1375 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1376 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1377 | |
| 1378 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1379 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1380 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1381 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1382 | } |
| 1383 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1384 | /* Normal variant */ |
| 1385 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1386 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1387 | f_TC_chan_act_ack_noest(); |
| 1388 | } |
| 1389 | |
| 1390 | /* Emergency call variant */ |
| 1391 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1392 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1393 | f_init(1); |
| 1394 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1395 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1396 | } |
| 1397 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1398 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1399 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1400 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1401 | |
| 1402 | var RSL_Message rx_rsl; |
| 1403 | var GsmRrMessage rr; |
| 1404 | |
| 1405 | f_init(1); |
| 1406 | f_vty_allow_emerg_bts(false, 0); |
| 1407 | |
| 1408 | IPA_RSL[0].clear; |
| 1409 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1410 | |
| 1411 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1412 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1413 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1414 | setverdict(pass); |
| 1415 | } else { |
| 1416 | setverdict(fail, "immediate assignment not rejected"); |
| 1417 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1418 | |
| 1419 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1420 | } |
| 1421 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1422 | /* Test behavior if MSC never answers to CR */ |
| 1423 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1424 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1425 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1426 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1427 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1428 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1429 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1430 | |
| 1431 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1432 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1433 | |
| 1434 | var octetstring l3 := '00010203040506'O |
| 1435 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1436 | |
| 1437 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1438 | |
| 1439 | /* 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] | 1440 | /* 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] | 1441 | 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] | 1442 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1443 | } |
| 1444 | |
| 1445 | /* Test behavior if MSC answers with CREF to CR */ |
| 1446 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1447 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1448 | var RSL_Message rx_rsl; |
| 1449 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1450 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1451 | |
| 1452 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1453 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1454 | |
| 1455 | var octetstring l3 := '00010203040506'O |
| 1456 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1457 | |
| 1458 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1459 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1460 | |
| 1461 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1462 | 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] | 1463 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1464 | } |
| 1465 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1466 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1467 | testcase TC_chan_act_nack() runs on test_CT { |
| 1468 | var RSL_Message rx_rsl; |
| 1469 | var integer chact_nack; |
| 1470 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1471 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1472 | |
| 1473 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1474 | |
| 1475 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1476 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1477 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1478 | |
| 1479 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1480 | |
| 1481 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1482 | f_sleep(0.5); |
| 1483 | |
| 1484 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1485 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1486 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1487 | } |
| 1488 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1489 | /* Test for channel exhaustion due to RACH overload */ |
| 1490 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1491 | var ASP_RSL_Unitdata rsl_ud; |
| 1492 | var integer i; |
| 1493 | var integer chreq_total, chreq_nochan; |
| 1494 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1495 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1496 | |
| 1497 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1498 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1499 | |
Neels Hofmeyr | 85fa37f | 2021-10-06 13:50:38 +0200 | [diff] [blame] | 1500 | /* GSM 44.018 Table 9.1.8.2: |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1501 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1502 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1503 | 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] | 1504 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1505 | } |
| 1506 | |
| 1507 | IPA_RSL[0].clear; |
| 1508 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1509 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1510 | 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] | 1511 | |
| 1512 | /* now expect additional channel activations to fail */ |
| 1513 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1514 | |
| 1515 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1516 | [] 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] | 1517 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1518 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1519 | [] 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] | 1520 | var GsmRrMessage rr; |
| 1521 | /* match on IMM ASS REJ */ |
| 1522 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1523 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1524 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1525 | 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] | 1526 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1527 | chreq_nochan+1); |
| 1528 | setverdict(pass); |
| 1529 | } else { |
| 1530 | repeat; |
| 1531 | } |
| 1532 | } |
| 1533 | [] IPA_RSL[0].receive { repeat; } |
| 1534 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1535 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1536 | } |
| 1537 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1538 | /* Test channel deactivation due to silence from MS */ |
| 1539 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1540 | var RslChannelNr chan_nr; |
| 1541 | |
| 1542 | f_init(1); |
| 1543 | |
| 1544 | /* Request for a dedicated channel */ |
| 1545 | chan_nr := f_chreq_act_ack('23'O); |
| 1546 | |
| 1547 | /* Wait some time until the channel is released */ |
| 1548 | f_sleep(2.0); |
| 1549 | |
| 1550 | /* Expect CHANnel RELease */ |
| 1551 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1552 | [] 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] | 1553 | log("Received CHANnel RELease"); |
| 1554 | setverdict(pass); |
| 1555 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1556 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1557 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1558 | * Assignment Reject since a dedicated channel was |
| 1559 | * already allocated, and Immediate Assignment was |
| 1560 | * already sent. */ |
| 1561 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1562 | } |
| 1563 | [] IPA_RSL[0].receive { |
| 1564 | setverdict(fail, "Unexpected RSL message!"); |
| 1565 | } |
| 1566 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1567 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1568 | } |
| 1569 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1570 | /*********************************************************************** |
| 1571 | * Assignment Testing |
| 1572 | ***********************************************************************/ |
| 1573 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1574 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1575 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1576 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1577 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1578 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1579 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1580 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1581 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1582 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1583 | } |
| 1584 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1585 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1586 | 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] | 1587 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1588 | var RSL_Message rx_rsl; |
| 1589 | var DchanTuple dt; |
| 1590 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1591 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1592 | |
| 1593 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1594 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1595 | /* send assignment without AoIP IEs */ |
| 1596 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1597 | } else { |
| 1598 | /* Send assignmetn without CIC in IPA case */ |
| 1599 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1600 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1601 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1602 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1603 | alt { |
| 1604 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1605 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1606 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1607 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1608 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1609 | setverdict(pass); |
| 1610 | } |
| 1611 | [] BSSAP.receive { repeat; } |
| 1612 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1613 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1614 | } |
| 1615 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1616 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1617 | 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] | 1618 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1619 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1620 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1621 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1622 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1623 | if (osmux_enabled) { |
| 1624 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1625 | } else { |
| 1626 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1627 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1628 | } else { |
| 1629 | 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] | 1630 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1631 | } |
| 1632 | return ass_cmd; |
| 1633 | } |
| 1634 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1635 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1636 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1637 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1638 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1639 | |
| 1640 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1641 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
| 1642 | var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1643 | var template BSSMAP_IE_KC128 kc128 := omit; |
| 1644 | if (ispresent(enc)) { |
| 1645 | var TestHdlrEncrParams v_enc := valueof(enc); |
| 1646 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg)); |
| 1647 | chosenEncryptionAlgorithm := valueof( |
| 1648 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
Oliver Smith | 598e1ed | 2021-07-09 10:28:40 +0200 | [diff] [blame] | 1649 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg)), 1))); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1650 | if (ispresent(v_enc.enc_kc128)) { |
| 1651 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1652 | } |
| 1653 | } |
| 1654 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1655 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1656 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1657 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1658 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1659 | encryptionInformation := encryptionInformation, |
| 1660 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1661 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1662 | } else { |
| 1663 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1664 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1665 | encryptionInformation := encryptionInformation, |
| 1666 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1667 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1668 | } |
| 1669 | return ho_req; |
| 1670 | } |
| 1671 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1672 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1673 | 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] | 1674 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1675 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1676 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1677 | if (expect_osmux) { |
| 1678 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1679 | } else { |
| 1680 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1681 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1682 | } else { |
| 1683 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1684 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1685 | } |
| 1686 | return exp_compl; |
| 1687 | } |
| 1688 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1689 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1690 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1691 | runs on test_CT { |
| 1692 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1693 | var RSL_Message rx_rsl; |
| 1694 | var DchanTuple dt; |
| 1695 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1696 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1697 | |
| 1698 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1699 | /* send assignment without AoIP IEs */ |
| 1700 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1701 | alt { |
| 1702 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1703 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1704 | setverdict(pass); |
| 1705 | } else { |
| 1706 | setverdict(fail, fail_text); |
| 1707 | } |
| 1708 | } |
| 1709 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1710 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1711 | setverdict(pass); |
| 1712 | } else { |
| 1713 | setverdict(fail, fail_text); |
| 1714 | } |
| 1715 | } |
| 1716 | [] BSSAP.receive { repeat; } |
| 1717 | } |
| 1718 | } |
| 1719 | testcase TC_assignment_csd() runs on test_CT { |
| 1720 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1721 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1722 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1723 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1724 | 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] | 1725 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1726 | } |
| 1727 | |
| 1728 | testcase TC_assignment_ctm() runs on test_CT { |
| 1729 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1730 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1731 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1732 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1733 | 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] | 1734 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1735 | } |
| 1736 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1737 | type record DchanTuple { |
| 1738 | integer sccp_conn_id, |
| 1739 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1740 | } |
| 1741 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 1742 | type record of DchanTuple DchanTuples; |
| 1743 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1744 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1745 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1746 | runs on test_CT return RslChannelNr { |
| 1747 | var RSL_Message rx_rsl; |
| 1748 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1749 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1750 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1751 | 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] | 1752 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1753 | return chan_nr; |
| 1754 | } |
| 1755 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1756 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1757 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1758 | runs on test_CT return DchanTuple { |
| 1759 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1760 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1761 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1762 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1763 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1764 | |
| 1765 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1766 | |
| 1767 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1768 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1769 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1770 | |
| 1771 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1772 | } |
| 1773 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1774 | /* Like f_est_dchan(), but for the first lchan of a dynamic timeslot: first ACK the deactivation of PDCH. */ |
| 1775 | function f_est_dchan_dyn(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1776 | runs on test_CT return DchanTuple { |
| 1777 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1778 | var DchanTuple dt; |
| 1779 | |
| 1780 | /* Send CHAN RQD */ |
| 1781 | var RSL_Message rx_rsl; |
| 1782 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1783 | |
| 1784 | /* The dyn TS first deactivates PDCH */ |
| 1785 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1786 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1787 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1788 | |
| 1789 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1790 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1791 | |
| 1792 | /* Now activates the signalling channel */ |
| 1793 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, fn+10)); |
| 1794 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 1795 | |
| 1796 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1797 | |
| 1798 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1799 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1800 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1801 | |
| 1802 | return dt; |
| 1803 | } |
| 1804 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1805 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1806 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1807 | var RSL_Message rx_rsl; |
| 1808 | /* expect BSC to disable the channel */ |
| 1809 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1810 | /* respond with CHAN REL ACK */ |
| 1811 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1812 | |
| 1813 | /* expect Clear Complete from BSC */ |
| 1814 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1815 | |
| 1816 | /* MSC disconnects as instructed. */ |
| 1817 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1818 | } |
| 1819 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1820 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1821 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1822 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1823 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1824 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1825 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1826 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1827 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1828 | |
| 1829 | /* simulate RLL REL IND */ |
| 1830 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1831 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1832 | /* expect Clear Request on MSC side */ |
| 1833 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1834 | |
| 1835 | /* Instruct BSC to clear channel */ |
| 1836 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1837 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1838 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1839 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1840 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1841 | |
| 1842 | /* wait for SCCP emulation to do its job */ |
| 1843 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1844 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1845 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1846 | } |
| 1847 | |
| 1848 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1849 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1850 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1851 | var DchanTuple dt; |
| 1852 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1853 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1854 | |
| 1855 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1856 | |
| 1857 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1858 | 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] | 1859 | /* TODO: different cause values? */ |
| 1860 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1861 | /* expect Clear Request from BSC */ |
| 1862 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1863 | |
| 1864 | /* Instruct BSC to clear channel */ |
| 1865 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1866 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1867 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1868 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1869 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1870 | |
| 1871 | /* wait for SCCP emulation to do its job */ |
| 1872 | f_sleep(1.0); |
| 1873 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1874 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1875 | } |
| 1876 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1877 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1878 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1879 | testcase TC_early_conn_fail() runs on test_CT { |
| 1880 | var RSL_Message rx_rsl; |
| 1881 | var DchanTuple dt; |
| 1882 | |
| 1883 | f_init(1); |
| 1884 | |
| 1885 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1886 | 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] | 1887 | |
| 1888 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1889 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1890 | |
| 1891 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1892 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1893 | |
| 1894 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1895 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1896 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1897 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1898 | } |
| 1899 | |
| 1900 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1901 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1902 | testcase TC_late_conn_fail() runs on test_CT { |
| 1903 | var RSL_Message rx_rsl; |
| 1904 | var DchanTuple dt; |
| 1905 | |
| 1906 | f_init(1); |
| 1907 | |
| 1908 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1909 | |
| 1910 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1911 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1912 | |
| 1913 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1914 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1915 | |
| 1916 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1917 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1918 | |
| 1919 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1920 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1921 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1922 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1923 | |
| 1924 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1925 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1926 | |
| 1927 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1928 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1929 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1930 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1931 | } |
| 1932 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1933 | private function f_TC_stats_conn_fail(charstring id) runs on MSC_ConnHdlr { |
| 1934 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 1935 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1936 | |
| 1937 | f_statsd_reset(); |
| 1938 | |
| 1939 | /* Establish SDCCH */ |
| 1940 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1941 | f_establish_fully(ass_cmd, exp_fail); |
| 1942 | |
| 1943 | /* Expect stats to be 0 */ |
| 1944 | var StatsDExpects expect := { |
| 1945 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 0, max := 0}, |
| 1946 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 0, max := 0} |
| 1947 | }; |
| 1948 | f_statsd_expect(expect); |
| 1949 | |
| 1950 | /* Simulate CONN FAIL IND on SDCCH */ |
| 1951 | RSL.send(ts_ASP_RSL_UD( |
| 1952 | ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL), |
| 1953 | IPAC_PROTO_RSL_TRX0)); |
| 1954 | |
Neels Hofmeyr | 58be48a | 2021-09-07 18:39:21 +0200 | [diff] [blame] | 1955 | f_sleep(1.0); |
| 1956 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1957 | /* Expect stats to be 1 */ |
| 1958 | expect := { |
| 1959 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 1, max := 1}, |
| 1960 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 1, max := 1} |
| 1961 | }; |
| 1962 | f_statsd_expect(expect); |
| 1963 | } |
| 1964 | testcase TC_stats_conn_fail() runs on test_CT { |
| 1965 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 1966 | var MSC_ConnHdlr vc_conn; |
| 1967 | |
| 1968 | f_init(1, true); |
| 1969 | f_sleep(1.0); |
| 1970 | |
| 1971 | vc_conn := f_start_handler(refers(f_TC_stats_conn_fail), pars); |
| 1972 | vc_conn.done; |
| 1973 | |
| 1974 | f_shutdown_helper(); |
| 1975 | } |
| 1976 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1977 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1978 | boolean expect_deact_sacch := true, |
| 1979 | boolean expect_rr_chan_rel := true, |
| 1980 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1981 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1982 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1983 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1984 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1985 | |
| 1986 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1987 | var boolean got_deact_sacch := false; |
| 1988 | var boolean got_rr_chan_rel := false; |
| 1989 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1990 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1991 | var RSL_IE_Body l3_ie; |
| 1992 | var PDU_ML3_NW_MS l3; |
| 1993 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1994 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1995 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1996 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1997 | [] 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] | 1998 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1999 | repeat; |
| 2000 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2001 | [not istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CellSelectInd))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2002 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2003 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2004 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 2005 | setverdict(fail, "cannot find L3"); |
| 2006 | mtc.stop; |
| 2007 | } |
| 2008 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 2009 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2010 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2011 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 2012 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 2013 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2014 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 2015 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2016 | setverdict(pass); |
| 2017 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2018 | log("EXPECTED CELLS: ", expect_cells); |
| 2019 | setverdict(fail, "Received cells list on RR Channel Release does not match expectations"); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2020 | } |
| 2021 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2022 | |
| 2023 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 2024 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 2025 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 2026 | if (match(got_cause, expect_rr_cause)) { |
| 2027 | setverdict(pass); |
| 2028 | } else { |
| 2029 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 2030 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 2031 | } |
| 2032 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2033 | repeat; |
| 2034 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2035 | [istemplatekind(expect_cells, "omit")] 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] | 2036 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2037 | |
| 2038 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 2039 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 2040 | setverdict(fail, "cannot find L3"); |
| 2041 | mtc.stop; |
| 2042 | } |
| 2043 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 2044 | |
| 2045 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 2046 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 2047 | if (match(got_cause, expect_rr_cause)) { |
| 2048 | setverdict(pass); |
| 2049 | } else { |
| 2050 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 2051 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 2052 | } |
| 2053 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 2054 | repeat; |
| 2055 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2056 | [] 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] | 2057 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2058 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2059 | if (handle_rll_rel) { |
| 2060 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 2061 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2062 | repeat; |
| 2063 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2064 | [] 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] | 2065 | /* respond with CHAN REL ACK */ |
| 2066 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 2067 | } |
| 2068 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2069 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2070 | repeat; |
| 2071 | } |
| 2072 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2073 | |
| 2074 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 2075 | " got_rll_rel_req=", got_rll_rel_req); |
| 2076 | |
| 2077 | if (expect_deact_sacch != got_deact_sacch) { |
| 2078 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 2079 | } |
| 2080 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 2081 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 2082 | } |
| 2083 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 2084 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 2085 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2086 | } |
| 2087 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2088 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 2089 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 2090 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2091 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2092 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2093 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2094 | |
| 2095 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2096 | |
| 2097 | /* Instruct BSC to clear channel */ |
| 2098 | var BssmapCause cause := 0; |
| 2099 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2100 | |
| 2101 | /* expect Clear Complete from BSC on A */ |
| 2102 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2103 | /* release the SCCP connection */ |
| 2104 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2105 | } |
| 2106 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2107 | 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] | 2108 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2109 | } |
| 2110 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2111 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 2112 | var BSSAP_N_DATA_ind rx_di; |
| 2113 | var DchanTuple dt; |
| 2114 | |
| 2115 | f_init(1); |
| 2116 | |
| 2117 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2118 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2119 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2120 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 2121 | |
| 2122 | /* Instruct BSC to clear channel */ |
| 2123 | var BssmapCause cause := 0; |
| 2124 | if (tx_csfb_ind) { |
| 2125 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2126 | } else { |
| 2127 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2128 | } |
| 2129 | |
| 2130 | /* expect Clear Complete from BSC on A */ |
| 2131 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2132 | /* release the SCCP connection */ |
| 2133 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2134 | } |
| 2135 | |
| 2136 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 2137 | SystemInformationConfig_default, use that: */ |
| 2138 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 2139 | |
| 2140 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 2141 | f_shutdown_helper(); |
| 2142 | } |
| 2143 | |
| 2144 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 2145 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 2146 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2147 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 2148 | Indicator or not shouldn't matter at all. */ |
| 2149 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 2150 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 2151 | } |
| 2152 | |
| 2153 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 2154 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2155 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2156 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 2157 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 2158 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 2159 | } |
| 2160 | |
| 2161 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 2162 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2163 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 2164 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 2165 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 2166 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2167 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 2168 | var BSSAP_N_DATA_ind rx_di; |
| 2169 | var DchanTuple dt; |
| 2170 | |
| 2171 | f_init(1); |
| 2172 | |
| 2173 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2174 | |
| 2175 | /* Instruct BSC to clear channel */ |
| 2176 | var BssmapCause cause := 0; |
| 2177 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2178 | |
| 2179 | /* expect Clear Complete from BSC on A */ |
| 2180 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2181 | /* release the SCCP connection */ |
| 2182 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2183 | } |
| 2184 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2185 | 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] | 2186 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2187 | } |
| 2188 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2189 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 2190 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2191 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2192 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2193 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2194 | |
| 2195 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2196 | |
| 2197 | /* release the SCCP connection */ |
| 2198 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2199 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2200 | 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] | 2201 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2202 | } |
| 2203 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2204 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2205 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2206 | var DchanTuple dt; |
| 2207 | |
| 2208 | f_init(1); |
| 2209 | |
| 2210 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2211 | |
| 2212 | /* release the SCCP connection */ |
| 2213 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2214 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2215 | 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] | 2216 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2217 | } |
| 2218 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2219 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2220 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2221 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2222 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2223 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2224 | |
| 2225 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2226 | |
| 2227 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2228 | IPA_RSL[0].clear; |
| 2229 | |
| 2230 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2231 | 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] | 2232 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2233 | [] 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] | 2234 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2235 | } |
| 2236 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2237 | 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] | 2238 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2239 | } |
| 2240 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2241 | /* Verify T(iar) triggers and releases the channel */ |
| 2242 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2243 | var DchanTuple dt; |
| 2244 | |
| 2245 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2246 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2247 | T(iar) >= T(ias)*2 */ |
| 2248 | g_bsc_sccp_timer_ias := 2; |
| 2249 | g_bsc_sccp_timer_iar := 5; |
| 2250 | |
| 2251 | f_init(1); |
| 2252 | |
| 2253 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2254 | 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] | 2255 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2256 | } |
| 2257 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2258 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2259 | runs on test_CT |
| 2260 | { |
| 2261 | var DchanTuple dt; |
| 2262 | |
| 2263 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2264 | var BssmapCause cause := 0; |
| 2265 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2266 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2267 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2268 | } |
| 2269 | |
| 2270 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2274 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2275 | f_init(1); |
| 2276 | |
| 2277 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2278 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2279 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2280 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2281 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2282 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
Vadim Yanitskiy | e18aebb | 2021-01-03 13:10:43 +0100 | [diff] [blame] | 2283 | |
| 2284 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2285 | } |
| 2286 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2287 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2288 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2289 | timer T := 2.0; |
| 2290 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2291 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2292 | |
| 2293 | var octetstring l3 := '00010203040506'O; |
| 2294 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2295 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2296 | |
| 2297 | T.start; |
| 2298 | alt { |
| 2299 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2300 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2301 | } |
| 2302 | [] BSSAP.receive {} |
| 2303 | [] IPA_RSL[0].receive {} |
| 2304 | [] T.timeout {} |
| 2305 | } |
| 2306 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2307 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2308 | } |
| 2309 | |
| 2310 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2311 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2312 | var RslChannelNr chan_nr; |
| 2313 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2314 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2315 | |
| 2316 | chan_nr := f_chreq_act_ack() |
| 2317 | |
| 2318 | var octetstring l3 := '00010203040506'O; |
| 2319 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2320 | |
| 2321 | timer T := 2.0; |
| 2322 | T.start; |
| 2323 | alt { |
| 2324 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2325 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2326 | } |
| 2327 | [] BSSAP.receive { repeat; } |
| 2328 | [] IPA_RSL[0].receive { repeat; } |
| 2329 | [] T.timeout {} |
| 2330 | } |
| 2331 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2332 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2333 | } |
| 2334 | |
| 2335 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2336 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2337 | timer T := 2.0; |
| 2338 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2339 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2340 | |
| 2341 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2342 | |
| 2343 | var octetstring l3 := '00010203040506'O; |
| 2344 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2345 | |
| 2346 | T.start; |
| 2347 | alt { |
| 2348 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2349 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2350 | } |
| 2351 | [] BSSAP.receive { repeat; } |
| 2352 | [] IPA_RSL[0].receive { repeat; } |
| 2353 | [] T.timeout {} |
| 2354 | } |
| 2355 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2356 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2357 | } |
| 2358 | |
| 2359 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2360 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2361 | timer T := 2.0; |
| 2362 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2363 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2364 | |
| 2365 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2366 | |
| 2367 | var octetstring l3 := '00010203040506'O; |
| 2368 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2369 | |
| 2370 | T.start; |
| 2371 | alt { |
| 2372 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2373 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2374 | } |
| 2375 | [] BSSAP.receive { repeat; } |
| 2376 | [] IPA_RSL[0].receive { repeat; } |
| 2377 | [] T.timeout {} |
| 2378 | } |
| 2379 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2380 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2381 | } |
| 2382 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2383 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2384 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2385 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2386 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2387 | |
| 2388 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2389 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2390 | |
| 2391 | f_establish_fully(ass_cmd, exp_compl); |
| 2392 | |
| 2393 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2394 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2395 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2396 | BSSAP.receive(PDU_BSSAP:{ |
| 2397 | discriminator := '1'B, |
| 2398 | spare := '0000000'B, |
| 2399 | dlci := 'C3'O, |
| 2400 | lengthIndicator := ?, |
| 2401 | pdu := { dtap := '0904'O } |
| 2402 | }); |
| 2403 | |
| 2404 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2405 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2406 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2407 | var template (value) RslLinkId link_id; |
| 2408 | var template (value) OCT1 dlci; |
| 2409 | |
| 2410 | if (i mod 2 == 0) { |
| 2411 | /* SAPI0 on FACCH or SDCCH */ |
| 2412 | link_id := ts_RslLinkID_DCCH(0); |
| 2413 | dlci := '80'O; |
| 2414 | } else { |
| 2415 | /* SAPI3 on SACCH */ |
| 2416 | link_id := ts_RslLinkID_SACCH(3); |
| 2417 | dlci := 'C3'O; |
| 2418 | } |
| 2419 | |
| 2420 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2421 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2422 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2423 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2424 | } |
| 2425 | } |
| 2426 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2427 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2428 | var MSC_ConnHdlr vc_conn; |
| 2429 | |
| 2430 | f_init(1, true); |
| 2431 | f_sleep(1.0); |
| 2432 | |
| 2433 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2434 | vc_conn.done; |
| 2435 | |
| 2436 | f_shutdown_helper(); |
| 2437 | } |
| 2438 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2439 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2440 | template myBSSMAP_Cause cause := ?, |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2441 | template (present) BIT2 cc := ?, |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2442 | float T_val := 2.0) |
| 2443 | runs on test_CT { |
| 2444 | var BSSAP_N_DATA_ind rx_di; |
| 2445 | timer T; |
| 2446 | |
| 2447 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2448 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2449 | |
| 2450 | T.start(T_val); |
| 2451 | alt { |
| 2452 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2453 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2454 | if (not match(rx_cause, tr_cause)) { |
| 2455 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2456 | rx_cause, " vs expected ", tr_cause); |
| 2457 | } |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2458 | |
| 2459 | /* Who ever on the earth decided to define this field as two separate bits?!? */ |
| 2460 | var BIT2 rx_cc := rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c2 |
| 2461 | & rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c1; |
| 2462 | if (not match(rx_cc, cc)) { |
| 2463 | setverdict(fail, "Rx unexpected Control Channel type: ", |
| 2464 | rx_cc, " vs expected ", cc); |
| 2465 | } |
| 2466 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2467 | setverdict(pass); |
| 2468 | } |
| 2469 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2470 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2471 | } |
| 2472 | [] T.timeout { |
| 2473 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2474 | } |
| 2475 | } |
| 2476 | } |
| 2477 | |
| 2478 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2479 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2480 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2481 | var RSL_Message rx_rsl; |
| 2482 | var DchanTuple dt; |
| 2483 | |
| 2484 | f_init(1); |
| 2485 | |
| 2486 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2487 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2488 | |
| 2489 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2490 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2491 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2492 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2493 | |
| 2494 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2495 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2496 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2497 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2498 | |
| 2499 | /* Clean up the connection */ |
| 2500 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2501 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2502 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2503 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2504 | } |
| 2505 | |
| 2506 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2507 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2508 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2509 | var RSL_Message rx_rsl; |
| 2510 | var DchanTuple dt; |
| 2511 | |
| 2512 | f_init(1); |
| 2513 | |
| 2514 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2515 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2516 | |
| 2517 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2518 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2519 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2520 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2521 | |
| 2522 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2523 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2524 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2525 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2526 | |
| 2527 | /* Clean up the connection */ |
| 2528 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2529 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2530 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2531 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2532 | } |
| 2533 | |
| 2534 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2535 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2536 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2537 | var RSL_Message rx_rsl; |
| 2538 | var DchanTuple dt; |
| 2539 | |
| 2540 | f_init(1); |
| 2541 | |
| 2542 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2543 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2544 | |
| 2545 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2546 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2547 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2548 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2549 | |
| 2550 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2551 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2552 | |
| 2553 | /* Clean up the connection */ |
| 2554 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2555 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2556 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2557 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2558 | } |
| 2559 | |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2560 | /* Check DLCI CC (Control Channel type) bits in SAPI N Reject */ |
| 2561 | testcase TC_rll_sapi_n_reject_dlci_cc() runs on test_CT { |
| 2562 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2563 | var RSL_Message rx_rsl; |
| 2564 | var DchanTuple dt; |
| 2565 | |
| 2566 | f_init(1); |
| 2567 | |
| 2568 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2569 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2570 | |
| 2571 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2572 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2573 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2574 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2575 | |
| 2576 | /* MS sends unexpected ERROR INDication on DCCH/ACCH SAPI=3 */ |
| 2577 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2578 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED, '10'B); |
| 2579 | |
| 2580 | /* Clean up the connection */ |
| 2581 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2582 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2583 | |
| 2584 | f_shutdown_helper(); |
| 2585 | } |
| 2586 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2587 | testcase TC_si_default() runs on test_CT { |
| 2588 | f_init(0); |
| 2589 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2590 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2591 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2592 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2593 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2594 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2595 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2596 | { |
| 2597 | select (earfcn_index) { |
| 2598 | case (0) { |
| 2599 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2600 | return 111; |
| 2601 | } |
| 2602 | case (1) { |
| 2603 | return 1; |
| 2604 | } |
| 2605 | case (2) { |
| 2606 | return 0; |
| 2607 | } |
| 2608 | case (3) { |
| 2609 | return 65535; |
| 2610 | } |
| 2611 | case else { |
| 2612 | return 23 * (earfcn_index - 3); |
| 2613 | } |
| 2614 | } |
| 2615 | } |
| 2616 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2617 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2618 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2619 | |
| 2620 | f_init(0); |
| 2621 | |
| 2622 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2623 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2624 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2625 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2626 | } |
| 2627 | |
| 2628 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2629 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2630 | if (not istemplatekind(expect_cells, "omit")) { |
| 2631 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2632 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2633 | var BSSAP_N_DATA_ind rx_di; |
| 2634 | var DchanTuple dt; |
| 2635 | |
| 2636 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2637 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2638 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2639 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2640 | |
| 2641 | /* Instruct BSC to clear channel */ |
| 2642 | var BssmapCause cause := 0; |
| 2643 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2644 | |
| 2645 | /* expect Clear Complete from BSC on A */ |
| 2646 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2647 | /* release the SCCP connection */ |
| 2648 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2649 | } |
| 2650 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2651 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := expect_cells); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2652 | } |
| 2653 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2654 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2655 | 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] | 2656 | } |
| 2657 | } |
| 2658 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2659 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2660 | { |
| 2661 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2662 | var integer si2quater_count := (count + 2) / 3; |
| 2663 | |
| 2664 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2665 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2666 | var integer index := i / 3; |
| 2667 | var integer earfcn_index := i mod 3; |
| 2668 | if (index >= lengthof(si2quater)) { |
| 2669 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2670 | } |
| 2671 | 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); |
| 2672 | } |
| 2673 | |
| 2674 | return si2quater; |
| 2675 | } |
| 2676 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2677 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2678 | { |
| 2679 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2680 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2681 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2682 | for (var integer i := 0; i < count; i := i + 1) { |
| 2683 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2684 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2685 | } |
| 2686 | |
| 2687 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2688 | } |
| 2689 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2690 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2691 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2692 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2693 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2694 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2695 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2696 | } |
| 2697 | |
| 2698 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2699 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2700 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2701 | } |
| 2702 | |
| 2703 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2704 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2705 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2706 | } |
| 2707 | |
| 2708 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2709 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2710 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2711 | } |
| 2712 | |
| 2713 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2714 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2715 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2716 | } |
| 2717 | |
| 2718 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2719 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2720 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2721 | } |
| 2722 | |
| 2723 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2724 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2725 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2726 | } |
| 2727 | |
| 2728 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2729 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2730 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2731 | } |
| 2732 | |
| 2733 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2734 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2735 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2736 | } |
| 2737 | |
| 2738 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2739 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2740 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2741 | } |
| 2742 | |
| 2743 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2744 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2745 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2746 | } |
| 2747 | |
| 2748 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2749 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2750 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2751 | } |
| 2752 | |
| 2753 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2754 | * 48 EARFCNs. */ |
| 2755 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2756 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2757 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2758 | f_init(0); |
| 2759 | |
| 2760 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2761 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2762 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2763 | } |
| 2764 | |
| 2765 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2766 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2767 | var charstring vty_error; |
| 2768 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2769 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2770 | f_vty_transceive(BSCVTY, "end"); |
| 2771 | |
| 2772 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2773 | log("Got expected VTY error: ", vty_error); |
| 2774 | setverdict(pass); |
| 2775 | } else { |
| 2776 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2777 | } |
| 2778 | |
| 2779 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2780 | |
| 2781 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2782 | 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] | 2783 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2784 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2785 | } |
| 2786 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2787 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2788 | { |
| 2789 | var uint8_t count := 0; |
| 2790 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2791 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2792 | count := count + 1; |
| 2793 | } |
| 2794 | } |
| 2795 | return count; |
| 2796 | } |
| 2797 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2798 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2799 | { |
| 2800 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2801 | var SystemInformationType1 last_si1; |
| 2802 | |
| 2803 | timer T := 30.0; |
| 2804 | T.start; |
| 2805 | alt { |
| 2806 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2807 | tr_RSL_BCCH_INFO, |
| 2808 | tr_RSL_NO_SACCH_FILL, |
| 2809 | tr_RSL_SACCH_FILL)) |
| 2810 | ) -> value rx_rsl_ud { |
| 2811 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2812 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2813 | repeat; |
| 2814 | } |
| 2815 | last_si1 := g_system_information[rsl_idx].si1; |
| 2816 | g_system_information[rsl_idx].si1 := omit; |
| 2817 | T.stop; |
| 2818 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2819 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2820 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2821 | } |
| 2822 | return last_si1; |
| 2823 | } |
| 2824 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2825 | /* verify ACC rotate feature */ |
| 2826 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2827 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2828 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2829 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2830 | var uint8_t count; |
| 2831 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2832 | |
| 2833 | f_init(0, guard_timeout := 60.0); |
| 2834 | |
| 2835 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2836 | "access-control-class-rotate 3", |
| 2837 | "access-control-class-rotate-quantum 1"}); |
| 2838 | |
| 2839 | /* Init and get first sysinfo */ |
| 2840 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2841 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2842 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2843 | last_si1 := f_recv_next_si1(0); |
| 2844 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2845 | count := f_acc09_count_allowed(acc); |
| 2846 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2847 | |
| 2848 | if (count != 3) { |
| 2849 | log("RSL: EXPECTED SI ACC len=3"); |
| 2850 | setverdict(fail, "received SI does not match expectations"); |
| 2851 | break; |
| 2852 | } |
| 2853 | |
| 2854 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2855 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2856 | times_allowed[j] := times_allowed[j] + 1; |
| 2857 | } |
| 2858 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2859 | } |
| 2860 | |
| 2861 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2862 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2863 | if (j != 5 and times_allowed[j] < 3) { |
| 2864 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2865 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2866 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2867 | } |
| 2868 | } |
| 2869 | |
| 2870 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2871 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2872 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2873 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2874 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2875 | /* verify ACC startup ramp+rotate feature */ |
| 2876 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2877 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2878 | var SystemInformationType1 last_si1; |
| 2879 | var AccessControlClass acc; |
| 2880 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2881 | var uint8_t count; |
| 2882 | var uint8_t prev_count; |
| 2883 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2884 | |
| 2885 | f_init(0, guard_timeout := 80.0); |
| 2886 | |
| 2887 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2888 | "access-control-class-rotate 0", |
| 2889 | "access-control-class-rotate-quantum 1", |
| 2890 | "access-control-class-ramping", |
| 2891 | "access-control-class-ramping-step-interval 5", |
| 2892 | "access-control-class-ramping-step-size 5"}); |
| 2893 | |
| 2894 | /* Init and get first sysinfo */ |
| 2895 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2896 | last_si1 := g_system_information[0].si1; |
| 2897 | acc := last_si1.rach_control.acc; |
| 2898 | count := f_acc09_count_allowed(acc); |
| 2899 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2900 | while (count > 0) { |
| 2901 | last_si1 := f_recv_next_si1(0); |
| 2902 | acc := last_si1.rach_control.acc; |
| 2903 | count := f_acc09_count_allowed(acc); |
| 2904 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2905 | } |
| 2906 | |
| 2907 | /* Increase adm subset size, we should see ramping start up */ |
| 2908 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2909 | prev_count := 0; |
| 2910 | while (true) { |
| 2911 | last_si1 := f_recv_next_si1(0); |
| 2912 | acc := last_si1.rach_control.acc; |
| 2913 | count := f_acc09_count_allowed(acc); |
| 2914 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2915 | |
| 2916 | if (prev_count > count) { |
| 2917 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2918 | break; |
| 2919 | } |
| 2920 | |
| 2921 | if (count == 9) { |
| 2922 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2923 | } |
| 2924 | |
| 2925 | prev_count := count; |
| 2926 | } |
| 2927 | |
| 2928 | setverdict(pass); |
| 2929 | |
| 2930 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2931 | "rach access-control-class 4 allowed", |
| 2932 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2933 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2934 | } |
| 2935 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2936 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2937 | var charstring ctrl_resp; |
| 2938 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2939 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2940 | |
| 2941 | /* See https://osmocom.org/issues/2729 */ |
| 2942 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2943 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2944 | } |
| 2945 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2946 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2947 | var charstring ctrl_resp; |
| 2948 | |
| 2949 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2950 | |
| 2951 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2952 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2953 | } |
| 2954 | |
Neels Hofmeyr | 0bc470d | 2021-08-21 13:37:13 +0200 | [diff] [blame] | 2955 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 2956 | private function f_tc_stat_num_msc_connected_msc_connhdlr(integer expect_num_msc_connected) runs on MSC_ConnHdlr { |
| 2957 | g_pars := f_gen_test_hdlr_pars(); |
| 2958 | var StatsDExpects expect := { |
| 2959 | { name := "TTCN3.bsc.0.num_msc.connected", mtype := "g", min := expect_num_msc_connected, max := expect_num_msc_connected }, |
| 2960 | { name := "TTCN3.bsc.0.num_msc.total", mtype := "g", min := NUM_MSC, max := NUM_MSC } |
| 2961 | }; |
| 2962 | f_statsd_expect(expect); |
| 2963 | } |
| 2964 | |
| 2965 | private function f_tc_stat_num_msc_connected_test_ct(void_fn tc_fn, integer nr_msc) runs on test_CT |
| 2966 | { |
| 2967 | var MSC_ConnHdlr vc_conn; |
| 2968 | |
| 2969 | f_init(nr_bts := 1, handler_mode := true, nr_msc := nr_msc); |
| 2970 | f_sleep(1.0); |
| 2971 | vc_conn := f_start_handler(tc_fn); |
| 2972 | vc_conn.done; |
| 2973 | |
| 2974 | /* Also verify stat exposed on CTRL interface */ |
| 2975 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:connected", int2str(nr_msc)); |
| 2976 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:total", int2str(NUM_MSC)); |
| 2977 | |
| 2978 | f_shutdown_helper(); |
| 2979 | } |
| 2980 | |
| 2981 | /* Verify that when 1 MSC is active, that num_msc:connected reports 1. */ |
| 2982 | private function f_tc_stat_num_msc_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 2983 | f_tc_stat_num_msc_connected_msc_connhdlr(1); |
| 2984 | } |
| 2985 | testcase TC_stat_num_msc_connected_1() runs on test_CT { |
| 2986 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_1), 1); |
| 2987 | } |
| 2988 | |
| 2989 | /* Verify that when 2 MSCs are active, that num_msc:connected reports 2. */ |
| 2990 | private function f_tc_stat_num_msc_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 2991 | f_tc_stat_num_msc_connected_msc_connhdlr(2); |
| 2992 | } |
| 2993 | testcase TC_stat_num_msc_connected_2() runs on test_CT { |
| 2994 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_2), 2); |
| 2995 | } |
| 2996 | |
| 2997 | /* Verify that when 3 MSCs are active, that num_msc:connected reports 3. */ |
| 2998 | private function f_tc_stat_num_msc_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 2999 | f_tc_stat_num_msc_connected_msc_connhdlr(3); |
| 3000 | } |
| 3001 | testcase TC_stat_num_msc_connected_3() runs on test_CT { |
| 3002 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_3), 3); |
| 3003 | } |
| 3004 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3005 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 3006 | private function f_tc_stat_num_bts_connected_msc_connhdlr(integer expect_num_bts_connected) runs on MSC_ConnHdlr { |
| 3007 | g_pars := f_gen_test_hdlr_pars(); |
| 3008 | var StatsDExpects expect := { |
| 3009 | { name := "TTCN3.bsc.0.num_bts.oml_connected", mtype := "g", min := expect_num_bts_connected, max := NUM_BTS_CFG }, |
| 3010 | { name := "TTCN3.bsc.0.num_bts.all_trx_rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 3011 | { name := "TTCN3.bsc.0.num_bts.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG }, |
| 3012 | { name := "TTCN3.bsc.0.num_trx.rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 3013 | { name := "TTCN3.bsc.0.num_trx.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG } |
| 3014 | }; |
| 3015 | f_statsd_expect(expect); |
| 3016 | } |
| 3017 | |
| 3018 | private function f_tc_stat_num_bts_connected_test_ct(void_fn tc_fn, integer nr_bts) runs on test_CT { |
| 3019 | var MSC_ConnHdlr vc_conn; |
| 3020 | |
| 3021 | f_init(nr_bts := nr_bts, handler_mode := true, nr_msc := 1); |
| 3022 | f_sleep(1.0); |
| 3023 | vc_conn := f_start_handler(tc_fn); |
| 3024 | vc_conn.done; |
| 3025 | |
| 3026 | /* Also verify stat exposed on CTRL interface */ |
| 3027 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:all_trx_rsl_connected", int2str(nr_bts)); |
| 3028 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:total", int2str(NUM_BTS_CFG)); |
| 3029 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:rsl_connected", int2str(nr_bts)); |
| 3030 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:total", int2str(NUM_BTS_CFG)); |
| 3031 | |
Neels Hofmeyr | a41ae30 | 2021-09-06 22:06:02 +0200 | [diff] [blame] | 3032 | /* Verify rf_states exposed on CTRL interface */ |
| 3033 | var charstring expect_net_rf_states := ""; |
| 3034 | for (var integer i := 0; i < NUM_BTS_CFG; i := i + 1) { |
| 3035 | var charstring expect_bts_rf_states := int2str(i) & ",0,"; |
| 3036 | if (i < NUM_BTS) { |
| 3037 | /* In these tests, OML for the first NUM_BTS are always connected via osmo-bts-omldummy */ |
| 3038 | expect_bts_rf_states := expect_bts_rf_states & "operational,unlocked,"; |
| 3039 | } else { |
| 3040 | /* For remaining i < NUM_BTS_CFG, OML is not connected, i.e. inoperational */ |
| 3041 | expect_bts_rf_states := expect_bts_rf_states & "inoperational,locked,"; |
| 3042 | } |
| 3043 | /* The RF policy is still global in osmo-bsc, i.e. always "on" */ |
| 3044 | expect_bts_rf_states := expect_bts_rf_states & "on,"; |
| 3045 | if (i < nr_bts) { |
| 3046 | /* For BTS where RSL is connected, the RSL state will be "up" */ |
| 3047 | expect_bts_rf_states := expect_bts_rf_states & "rsl-up;"; |
| 3048 | } else { |
| 3049 | expect_bts_rf_states := expect_bts_rf_states & "rsl-down;"; |
| 3050 | } |
| 3051 | |
| 3052 | f_ctrl_get_exp(IPA_CTRL, "bts." & int2str(i) & ".rf_states", expect_bts_rf_states); |
| 3053 | expect_net_rf_states := expect_net_rf_states & expect_bts_rf_states; |
| 3054 | } |
| 3055 | f_ctrl_get_exp(IPA_CTRL, "rf_states", expect_net_rf_states); |
| 3056 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3057 | f_shutdown_helper(); |
| 3058 | } |
| 3059 | |
| 3060 | /* Verify that when 1 BTS is connected, that num_{bts,trx}:*_connected reports 1. */ |
| 3061 | private function f_tc_stat_num_bts_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 3062 | f_tc_stat_num_bts_connected_msc_connhdlr(1); |
| 3063 | } |
| 3064 | testcase TC_stat_num_bts_connected_1() runs on test_CT { |
| 3065 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_1), 1); |
| 3066 | } |
| 3067 | |
| 3068 | /* Verify that when 2 BTS is connected, that num_{bts,trx}:*_connected reports 2. */ |
| 3069 | private function f_tc_stat_num_bts_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 3070 | f_tc_stat_num_bts_connected_msc_connhdlr(2); |
| 3071 | } |
| 3072 | testcase TC_stat_num_bts_connected_2() runs on test_CT { |
| 3073 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_2), 2); |
| 3074 | } |
| 3075 | |
| 3076 | /* Verify that when 3 BTS is connected, that num_{bts,trx}:*_connected reports 3. */ |
| 3077 | private function f_tc_stat_num_bts_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 3078 | f_tc_stat_num_bts_connected_msc_connhdlr(3); |
| 3079 | } |
| 3080 | testcase TC_stat_num_bts_connected_3() runs on test_CT { |
| 3081 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_3), 3); |
| 3082 | } |
| 3083 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3084 | testcase TC_ctrl() runs on test_CT { |
| 3085 | var charstring ctrl_resp; |
| 3086 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3087 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3088 | |
| 3089 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 3090 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 3091 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 3092 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 3093 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3094 | |
| 3095 | var integer bts_nr := 0; |
| 3096 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 3097 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 3098 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 3099 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 3100 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 3101 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 3102 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 3103 | |
| 3104 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 3105 | f_sleep(2.0); |
| 3106 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 3107 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 3108 | } |
| 3109 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 3110 | |
| 3111 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 3112 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3113 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 3114 | } |
| 3115 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3116 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 3117 | "location-state" over the SCCPlite IPA conn */ |
| 3118 | testcase TC_ctrl_location() runs on test_CT { |
| 3119 | var MSC_ConnHdlr vc_conn; |
| 3120 | var integer bts_nr := 0; |
| 3121 | |
| 3122 | f_init(1, true); |
| 3123 | f_sleep(1.0); |
| 3124 | |
| 3125 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 3126 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3127 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 3128 | |
| 3129 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 3130 | f_sleep(2.0); |
| 3131 | |
| 3132 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 3133 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3134 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 3135 | |
| 3136 | /* should match the one from config */ |
| 3137 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 3138 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3139 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3140 | } |
| 3141 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3142 | |
| 3143 | /*********************************************************************** |
| 3144 | * Paging Testing |
| 3145 | ***********************************************************************/ |
| 3146 | |
| 3147 | type record Cell_Identity { |
| 3148 | GsmMcc mcc, |
| 3149 | GsmMnc mnc, |
| 3150 | GsmLac lac, |
| 3151 | GsmCellId ci |
| 3152 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 3153 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3154 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3155 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3156 | type set of integer BtsIdList; |
| 3157 | |
| 3158 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 3159 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 3160 | if (bts_id == bts_ids[j]) { |
| 3161 | return true; |
| 3162 | } |
| 3163 | } |
| 3164 | return false; |
| 3165 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3166 | |
| 3167 | /* core paging test helper function; used by most paging test cases */ |
| 3168 | private function f_pageing_helper(hexstring imsi, |
| 3169 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3170 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3171 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3172 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3173 | { |
| 3174 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3175 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3176 | var RSL_Message rx_rsl; |
| 3177 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3178 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3179 | |
| 3180 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3181 | |
| 3182 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 3183 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3184 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3185 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3186 | |
| 3187 | if (isvalue(rsl_chneed)) { |
| 3188 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 3189 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 3190 | } else { |
| 3191 | bssmap_chneed := omit; |
| 3192 | } |
| 3193 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3194 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 3195 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3196 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3197 | if (not istemplatekind(tmsi, "omit")) { |
| 3198 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3199 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3200 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3201 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3202 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3203 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3204 | 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] | 3205 | /* check channel type, paging group */ |
| 3206 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 3207 | setverdict(fail, "Paging for wrong paging group"); |
| 3208 | } |
| 3209 | if (ispresent(rsl_chneed) and |
| 3210 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 3211 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 3212 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3213 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 3214 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3215 | /* do a quick check on all not-included BTSs if they received paging */ |
| 3216 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3217 | timer T := 0.1; |
| 3218 | if (f_bts_in_list(i, bts_ids)) { |
| 3219 | continue; |
| 3220 | } |
| 3221 | T.start; |
| 3222 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3223 | [] 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] | 3224 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 3225 | } |
| 3226 | [] IPA_RSL[i].receive { repeat; } |
| 3227 | [] T.timeout { } |
| 3228 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3229 | } |
| 3230 | |
| 3231 | setverdict(pass); |
| 3232 | } |
| 3233 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3234 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3235 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3236 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 3237 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 3238 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3239 | /* PAGING by IMSI + TMSI */ |
| 3240 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 3241 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3242 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 3243 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3244 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3245 | } |
| 3246 | |
| 3247 | /* PAGING by IMSI + TMSI */ |
| 3248 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 3249 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3250 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3251 | 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] | 3252 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3253 | } |
| 3254 | |
| 3255 | /* Paging with different "channel needed' values */ |
| 3256 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 3257 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3258 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3259 | 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] | 3260 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3261 | } |
| 3262 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 3263 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3264 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3265 | 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] | 3266 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3267 | } |
| 3268 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 3269 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3270 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3271 | 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] | 3272 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3273 | } |
| 3274 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 3275 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3276 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3277 | 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] | 3278 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3279 | } |
| 3280 | |
| 3281 | /* Paging by CGI */ |
| 3282 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 3283 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3284 | 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] | 3285 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3286 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3287 | } |
| 3288 | |
| 3289 | /* Paging by LAC+CI */ |
| 3290 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 3291 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3292 | 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] | 3293 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3294 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3295 | } |
| 3296 | |
| 3297 | /* Paging by CI */ |
| 3298 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 3299 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3300 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3301 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3302 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3303 | } |
| 3304 | |
| 3305 | /* Paging by LAI */ |
| 3306 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 3307 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3308 | 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] | 3309 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3310 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3311 | } |
| 3312 | |
| 3313 | /* Paging by LAC */ |
| 3314 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 3315 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3316 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3317 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3318 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3319 | } |
| 3320 | |
| 3321 | /* Paging by "all in BSS" */ |
| 3322 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 3323 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3324 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3325 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3326 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3327 | } |
| 3328 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3329 | /* 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] | 3330 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 3331 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3332 | 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] | 3333 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3334 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3335 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3336 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3337 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3338 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 3339 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3340 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3341 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3342 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3343 | } |
| 3344 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3345 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3346 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 3347 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3348 | 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] | 3349 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3350 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3351 | } |
| 3352 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3353 | /* 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] | 3354 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 3355 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3356 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 3357 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3358 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3359 | } |
| 3360 | |
| 3361 | /* Paging on empty list: Verify none of them page */ |
| 3362 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3363 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3364 | cid_list := { cIl_LAC := { } }; |
| 3365 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3366 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3367 | } |
| 3368 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3369 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3370 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3371 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3372 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3373 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3374 | f_shutdown_helper(); |
| 3375 | } |
| 3376 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3377 | /* Verify paging retransmission interval + count */ |
| 3378 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3379 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3380 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3381 | /* Verify PCH load */ |
| 3382 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3383 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3384 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3385 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3386 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3387 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3388 | |
| 3389 | /* tell BSC there is no paging space anymore */ |
| 3390 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3391 | f_sleep(0.2); |
| 3392 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3393 | |
| 3394 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3395 | * there would be 8 retransmissions during 4 seconds */ |
| 3396 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3397 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3398 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3399 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3400 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3401 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3402 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3403 | [] T_retrans.timeout { |
| 3404 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3405 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3406 | T_retrans.start; |
| 3407 | repeat; |
| 3408 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3409 | [] T.timeout { |
| 3410 | setverdict(pass); |
| 3411 | } |
| 3412 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3413 | |
| 3414 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3415 | } |
| 3416 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3417 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3418 | testcase TC_paging_counter() runs on test_CT { |
| 3419 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3420 | timer T := 4.0; |
| 3421 | var integer i; |
| 3422 | var integer paging_attempted_bsc; |
| 3423 | var integer paging_attempted_bts[NUM_BTS]; |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3424 | var integer paging_expired_bsc; |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3425 | var integer paging_expired_bts[NUM_BTS]; |
| 3426 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3427 | |
| 3428 | f_init(); |
| 3429 | |
| 3430 | /* read counters before paging */ |
| 3431 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3432 | if (Misc_Helpers.f_osmo_repo_is("nightly")) { /* osmo-bsc > 1.8.0 */ |
| 3433 | paging_expired_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired"); |
| 3434 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3435 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3436 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3437 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3438 | } |
| 3439 | |
| 3440 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3441 | |
| 3442 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3443 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3444 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3445 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3446 | paging_attempted_bts[i]+1); |
| 3447 | } |
| 3448 | |
| 3449 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3450 | f_sleep(12.0); |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3451 | if (Misc_Helpers.f_osmo_repo_is("nightly")) { /* osmo-bsc > 1.8.0 */ |
| 3452 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired", paging_expired_bsc+1); |
| 3453 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3454 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3455 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3456 | paging_expired_bts[i]+1); |
| 3457 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3458 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3459 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3460 | } |
| 3461 | |
| 3462 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3463 | /* Verify paging stops after A-RESET */ |
| 3464 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3465 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3466 | timer T := 3.0; |
| 3467 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3468 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3469 | |
| 3470 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3471 | 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] | 3472 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3473 | [] 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] | 3474 | [] BSSAP.receive { repeat; } |
| 3475 | } |
| 3476 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3477 | /* Wait to avoid a possible race condition if a paging message is |
| 3478 | * received right before the reset ACK. */ |
| 3479 | f_sleep(0.2); |
| 3480 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3481 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3482 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3483 | IPA_RSL[i].clear; |
| 3484 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3485 | |
| 3486 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3487 | T.start; |
| 3488 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3489 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3490 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3491 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3492 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3493 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3494 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3495 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3496 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3497 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3498 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3499 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3500 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3501 | [] T.timeout { |
| 3502 | setverdict(pass); |
| 3503 | } |
| 3504 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3505 | |
| 3506 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3507 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3508 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3509 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3510 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3511 | * pick the first configured MSC. This behavior is required in order to make |
| 3512 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3513 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3514 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3515 | */ |
| 3516 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3517 | |
| 3518 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3519 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3520 | |
| 3521 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3522 | var DchanTuple dt; |
| 3523 | 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] | 3524 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3525 | |
| 3526 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3527 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3528 | |
| 3529 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3530 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3531 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3532 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3533 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3534 | T.start; |
| 3535 | alt { |
| 3536 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3537 | setverdict(pass); |
| 3538 | } |
| 3539 | [] BSSAP.receive { |
| 3540 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3541 | } |
| 3542 | [] T.timeout { |
| 3543 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3544 | } |
| 3545 | } |
| 3546 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3547 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3548 | } |
| 3549 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3550 | /* Test RSL link drop causes counter increment */ |
| 3551 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3552 | var integer rsl_fail; |
| 3553 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3554 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3555 | |
| 3556 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3557 | |
| 3558 | bts[0].rsl.vc_IPA.stop; |
| 3559 | |
| 3560 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3561 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3562 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | /* TODO: Test OML link drop causes counter increment */ |
| 3566 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3567 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3568 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3569 | timer T := 10.0; |
| 3570 | |
| 3571 | bts[0].rsl.id := "IPA-0-RSL"; |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 3572 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA") alive; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3573 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3574 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3575 | 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] | 3576 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3577 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3578 | |
| 3579 | f_init_mgcp("VirtMSC"); |
| 3580 | |
| 3581 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3582 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3583 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3584 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3585 | |
| 3586 | /* wait for IPA OML link to connect and then disconnect */ |
| 3587 | T.start; |
| 3588 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3589 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3590 | T.stop; |
| 3591 | return true; |
| 3592 | } |
| 3593 | [] IPA_RSL[0].receive { repeat } |
| 3594 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3595 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3596 | } |
| 3597 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3598 | return false; |
| 3599 | } |
| 3600 | |
| 3601 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3602 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3603 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3604 | setverdict(pass); |
| 3605 | } else { |
| 3606 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3607 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3608 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3609 | } |
| 3610 | |
| 3611 | |
| 3612 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3613 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3614 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3615 | setverdict(pass); |
| 3616 | } else { |
| 3617 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3618 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3619 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3620 | } |
| 3621 | |
| 3622 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3623 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3624 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3625 | ***********************************************************************/ |
| 3626 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3627 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3628 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3629 | import from RSL_Emulation all; |
| 3630 | import from MSC_ConnectionHandler all; |
| 3631 | |
| 3632 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3633 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3634 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3635 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3636 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3637 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3638 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3639 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3640 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3641 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3642 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3643 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3644 | if (isvalue(bts[2])) { |
| 3645 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3646 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3647 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3648 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3649 | if (mp_enable_lcs_tests) { |
| 3650 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3651 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3652 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3653 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3654 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3655 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3656 | } |
| 3657 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3658 | function f_start_handler_create(template (omit) TestHdlrParams pars := omit) |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3659 | runs on test_CT return MSC_ConnHdlr { |
| 3660 | var charstring id := testcasename(); |
| 3661 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3662 | var integer bssap_idx := 0; |
| 3663 | if (isvalue(pars)) { |
| 3664 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3665 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3666 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3667 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3668 | return vc_conn; |
| 3669 | } |
| 3670 | |
| 3671 | function f_start_handler_run(MSC_ConnHdlr vc_conn, void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3672 | runs on test_CT return MSC_ConnHdlr { |
| 3673 | var charstring id := testcasename(); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3674 | /* Emit a marker to appear in the SUT's own logging output */ |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3675 | f_logp(BSCVTY, id & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3676 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3677 | return vc_conn; |
| 3678 | } |
| 3679 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3680 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3681 | runs on test_CT return MSC_ConnHdlr { |
| 3682 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 3683 | } |
| 3684 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3685 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3686 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3687 | runs on MSC_ConnHdlr { |
| 3688 | if (isvalue(pars)) { |
| 3689 | g_pars := valueof(pars); |
| 3690 | } |
| 3691 | fn.apply(id); |
| 3692 | } |
| 3693 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3694 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 3695 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 3696 | f_vty_transceive(BSCVTY, "network"); |
| 3697 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 3698 | f_vty_transceive(BSCVTY, "exit"); |
| 3699 | f_vty_transceive(BSCVTY, "exit"); |
| 3700 | } |
| 3701 | |
| 3702 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 3703 | /* keep in sync with docker-playground.git ttcn3-bsc-test/osmo-bsc.cfg */ |
| 3704 | f_vty_encryption_a5("0 1 3"); |
| 3705 | } |
| 3706 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3707 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3708 | 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] | 3709 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3710 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3711 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3712 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3713 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3714 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3715 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3716 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3717 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3718 | } |
| 3719 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3720 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3721 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3722 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3723 | |
| 3724 | f_init(1, true); |
| 3725 | f_sleep(1.0); |
| 3726 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3727 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3728 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3729 | } |
| 3730 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3731 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3732 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3733 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3734 | |
| 3735 | f_init(1, true); |
| 3736 | f_sleep(1.0); |
| 3737 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3738 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3739 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3740 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 3741 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 3742 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 3743 | var MSC_ConnHdlr vc_conn; |
| 3744 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3745 | |
| 3746 | pars.encr := valueof(t_EncrParams('05'O, f_rnd_octstring(8))); /* A5/0 and A5/2 (0x01|0x04)*/ |
| 3747 | pars.encr_exp_enc_alg := '04'O; /* A5/2 */ |
| 3748 | |
| 3749 | f_init(1, true); |
| 3750 | f_vty_encryption_a5("0 1 2 3"); |
| 3751 | f_sleep(1.0); |
| 3752 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3753 | vc_conn.done; |
| 3754 | f_vty_encryption_a5_reset(); |
| 3755 | f_shutdown_helper(); |
| 3756 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 3757 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 3758 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 3759 | var MSC_ConnHdlr vc_conn; |
| 3760 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3761 | |
| 3762 | pars.encr := valueof(t_EncrParams('06'O, f_rnd_octstring(8))); /* A5/1 and A5/2 (0x02|0x04)*/ |
| 3763 | pars.encr_exp_enc_alg := '02'O; /* A5/1 */ |
| 3764 | |
| 3765 | f_init(1, true); |
| 3766 | f_vty_encryption_a5("1 2"); |
| 3767 | f_sleep(1.0); |
| 3768 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3769 | vc_conn.done; |
| 3770 | f_vty_encryption_a5_reset(); |
| 3771 | f_shutdown_helper(); |
| 3772 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3773 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3774 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3775 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3776 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3777 | |
| 3778 | f_init(1, true); |
| 3779 | f_sleep(1.0); |
| 3780 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3781 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3782 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3783 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3784 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 3785 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 3786 | var MSC_ConnHdlr vc_conn; |
| 3787 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3788 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3789 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3790 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3791 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3792 | f_sleep(1.0); |
| 3793 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3794 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3795 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3796 | f_shutdown_helper(); |
| 3797 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3798 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3799 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3800 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3801 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3802 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3803 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3804 | |
| 3805 | f_establish_fully(ass_cmd, exp_compl); |
| 3806 | } |
| 3807 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3808 | var MSC_ConnHdlr vc_conn; |
| 3809 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3810 | |
| 3811 | f_init(1, true); |
| 3812 | f_sleep(1.0); |
| 3813 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3814 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3815 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3816 | } |
| 3817 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3818 | |
| 3819 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3820 | 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] | 3821 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3822 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3823 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3824 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3825 | 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] | 3826 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3827 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3828 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3829 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3830 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3831 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3832 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3833 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3834 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3835 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3836 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3837 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3838 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3839 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3840 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3841 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3842 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3843 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3844 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3845 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3846 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3847 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3848 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3849 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3850 | } |
| 3851 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3852 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3853 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3854 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3855 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3856 | f_init(1, true); |
| 3857 | f_sleep(1.0); |
| 3858 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3859 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3860 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3861 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3862 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 3863 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3864 | var MSC_ConnHdlr vc_conn; |
| 3865 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3866 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 3867 | |
| 3868 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3869 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3870 | f_sleep(1.0); |
| 3871 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3872 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3873 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3874 | f_shutdown_helper(); |
| 3875 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3876 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 3877 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 3878 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 3879 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3880 | var MSC_ConnHdlr vc_conn; |
| 3881 | |
| 3882 | f_init(1, true); |
| 3883 | f_sleep(1.0); |
| 3884 | |
| 3885 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 3886 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 3887 | vc_conn.done; |
| 3888 | f_shutdown_helper(); |
| 3889 | } |
| 3890 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3891 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3892 | 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] | 3893 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3894 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3895 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3896 | |
| 3897 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3898 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3899 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3900 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3901 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3902 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3903 | var MSC_ConnHdlr vc_conn; |
| 3904 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3905 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3906 | f_sleep(1.0); |
| 3907 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3908 | 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] | 3909 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3910 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3911 | } |
| 3912 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3913 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 3914 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 3915 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3916 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3917 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3918 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3919 | |
| 3920 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 3921 | |
| 3922 | var BSSMAP_FIELD_CodecType codecType; |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3923 | |
| 3924 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 3925 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 3926 | |
| 3927 | f_create_chan_and_exp(); |
| 3928 | /* we should now have a COMPL_L3 at the MSC */ |
| 3929 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3930 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 3931 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3932 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3933 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 3934 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3935 | var MSC_ConnHdlr vc_conn; |
| 3936 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3937 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3938 | f_sleep(1.0); |
| 3939 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 3940 | pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3941 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3942 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3943 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3944 | } |
| 3945 | |
| 3946 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3947 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3948 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3949 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3950 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3951 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3952 | |
| 3953 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3954 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3955 | |
| 3956 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3957 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3958 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3959 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3960 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3961 | }; |
| 3962 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3963 | } |
| 3964 | |
| 3965 | testcase TC_assignment_sign() runs on test_CT { |
| 3966 | var MSC_ConnHdlr vc_conn; |
| 3967 | |
| 3968 | f_init(1, true); |
| 3969 | f_sleep(1.0); |
| 3970 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3971 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3972 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3973 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3974 | } |
| 3975 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3976 | /*********************************************************************** |
| 3977 | * Codec (list) testing |
| 3978 | ***********************************************************************/ |
| 3979 | |
| 3980 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3981 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3982 | return boolean { |
| 3983 | select (a_elem.codecType) { |
| 3984 | case (GSM_FR) { |
| 3985 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3986 | return true; |
| 3987 | } |
| 3988 | } |
| 3989 | case (GSM_HR) { |
| 3990 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3991 | return true; |
| 3992 | } |
| 3993 | } |
| 3994 | case (GSM_EFR) { |
| 3995 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3996 | return true; |
| 3997 | } |
| 3998 | } |
| 3999 | case (FR_AMR) { |
| 4000 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 4001 | return true; |
| 4002 | } |
| 4003 | } |
| 4004 | case (HR_AMR) { |
| 4005 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 4006 | return true; |
| 4007 | } |
| 4008 | } |
| 4009 | case else { } |
| 4010 | } |
| 4011 | return false; |
| 4012 | } |
| 4013 | |
| 4014 | /* check if the given rsl_mode is compatible with the a_list */ |
| 4015 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 4016 | return boolean { |
| 4017 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 4018 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 4019 | return true; |
| 4020 | } |
| 4021 | } |
| 4022 | return false; |
| 4023 | } |
| 4024 | |
| 4025 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 4026 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4027 | return BSSMAP_IE_ChannelType { |
| 4028 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 4029 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 4030 | select (a_elem.codecType) { |
| 4031 | case (GSM_FR) { |
| 4032 | ret.channelRateAndType := ChRate_TCHF; |
| 4033 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 4034 | } |
| 4035 | case (GSM_HR) { |
| 4036 | ret.channelRateAndType := ChRate_TCHH; |
| 4037 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 4038 | } |
| 4039 | case (GSM_EFR) { |
| 4040 | ret.channelRateAndType := ChRate_TCHF; |
| 4041 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 4042 | } |
| 4043 | case (FR_AMR) { |
| 4044 | ret.channelRateAndType := ChRate_TCHF; |
| 4045 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 4046 | } |
| 4047 | case (HR_AMR) { |
| 4048 | ret.channelRateAndType := ChRate_TCHH; |
| 4049 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 4050 | } |
| 4051 | case else { |
| 4052 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4053 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4054 | } |
| 4055 | } |
| 4056 | return ret; |
| 4057 | } |
| 4058 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4059 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 4060 | return template RSL_IE_Body { |
| 4061 | var template RSL_IE_Body mode_ie := { |
| 4062 | chan_mode := { |
| 4063 | len := ?, |
| 4064 | reserved := ?, |
| 4065 | dtx_d := ?, |
| 4066 | dtx_u := ?, |
| 4067 | spd_ind := RSL_SPDI_SPEECH, |
| 4068 | ch_rate_type := -, |
| 4069 | coding_alg_rate := - |
| 4070 | } |
| 4071 | } |
| 4072 | |
| 4073 | select (a_elem.codecType) { |
| 4074 | case (GSM_FR) { |
| 4075 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4076 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 4077 | } |
| 4078 | case (GSM_HR) { |
| 4079 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 4080 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 4081 | } |
| 4082 | case (GSM_EFR) { |
| 4083 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4084 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 4085 | } |
| 4086 | case (FR_AMR) { |
| 4087 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4088 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 4089 | } |
| 4090 | case (HR_AMR) { |
| 4091 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 4092 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 4093 | } |
| 4094 | } |
| 4095 | return mode_ie; |
| 4096 | } |
| 4097 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4098 | type record CodecListTest { |
| 4099 | BSSMAP_IE_SpeechCodecList codec_list, |
| 4100 | charstring id |
| 4101 | } |
| 4102 | type record of CodecListTest CodecListTests |
| 4103 | |
| 4104 | 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] | 4105 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 4106 | 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] | 4107 | |
| 4108 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4109 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4110 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4111 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 4112 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4113 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 4114 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 4115 | g_pars.expect_mr_s0_s7; |
| 4116 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4117 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4118 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4119 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4120 | log("expecting ASS COMPL like this: ", exp_compl); |
| 4121 | |
| 4122 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4123 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4124 | if (not g_pars.expect_channel_mode_modify) { |
| 4125 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 4126 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4127 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4128 | var RSL_IE_Body mode_ie; |
| 4129 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 4130 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4131 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4132 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4133 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4134 | if (not match(mode_ie, t_mode_ie)) { |
| 4135 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 4136 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4137 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4138 | |
| 4139 | var RSL_IE_Body mr_conf; |
| 4140 | if (g_pars.expect_mr_conf_ie != omit) { |
| 4141 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 4142 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 4143 | mtc.stop; |
| 4144 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4145 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4146 | |
| 4147 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 4148 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 4149 | g_pars.expect_mr_conf_ie); |
| 4150 | } |
| 4151 | } else { |
| 4152 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 4153 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 4154 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 4155 | mtc.stop; |
| 4156 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4157 | } |
| 4158 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4159 | } |
| 4160 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4161 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 4162 | |
| 4163 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4164 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4165 | |
| 4166 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4167 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4168 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4169 | } |
| 4170 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4171 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4172 | log("expecting ASS FAIL like this: ", exp_fail); |
| 4173 | |
| 4174 | f_establish_fully(ass_cmd, exp_fail); |
| 4175 | } |
| 4176 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4177 | const CounterNameVals counternames_bsc_bts_assignment := { |
| 4178 | { "assignment:attempted", 0 }, |
| 4179 | { "assignment:completed", 0 }, |
| 4180 | { "assignment:stopped", 0 }, |
| 4181 | { "assignment:no_channel", 0 }, |
| 4182 | { "assignment:timeout", 0 }, |
| 4183 | { "assignment:failed", 0 }, |
| 4184 | { "assignment:error", 0 } |
| 4185 | }; |
| 4186 | |
| 4187 | const CounterNameVals counternames_bts_assignment := { |
| 4188 | { "assignment:attempted_sign", 0 }, |
| 4189 | { "assignment:attempted_speech", 0 }, |
| 4190 | { "assignment:completed_sign", 0 }, |
| 4191 | { "assignment:completed_speech", 0 }, |
| 4192 | { "assignment:stopped_sign", 0 }, |
| 4193 | { "assignment:stopped_speech", 0 }, |
| 4194 | { "assignment:no_channel_sign", 0 }, |
| 4195 | { "assignment:no_channel_speech", 0 }, |
| 4196 | { "assignment:timeout_sign", 0 }, |
| 4197 | { "assignment:timeout_speech", 0 }, |
| 4198 | { "assignment:failed_sign", 0 }, |
| 4199 | { "assignment:failed_speech", 0 }, |
| 4200 | { "assignment:error_sign", 0 }, |
| 4201 | { "assignment:error_speech", 0 } |
| 4202 | }; |
| 4203 | |
| 4204 | function f_ctrs_bsc_and_bts_assignment_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 4205 | var CounterNameVals bts_names := counternames_bsc_bts_assignment & counternames_bts_assignment; |
| 4206 | f_ctrs_bts_init(bts_count, bts_names); |
| 4207 | f_ctrs_bsc_init(counternames_bsc_bts_assignment); |
| 4208 | } |
| 4209 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4210 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4211 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4212 | var MSC_ConnHdlr vc_conn; |
| 4213 | |
| 4214 | f_init(1, true); |
| 4215 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4216 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4217 | |
| 4218 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4219 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4220 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4221 | |
| 4222 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4223 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4224 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4225 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4226 | f_ctrs_bts_verify(); |
| 4227 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4228 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4229 | } |
| 4230 | |
| 4231 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4232 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4233 | var MSC_ConnHdlr vc_conn; |
| 4234 | |
| 4235 | f_init(1, true); |
| 4236 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4237 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4238 | |
| 4239 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4240 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4241 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4242 | |
| 4243 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4244 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4245 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4246 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4247 | f_ctrs_bts_verify(); |
| 4248 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4249 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4250 | } |
| 4251 | |
| 4252 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4253 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4254 | var MSC_ConnHdlr vc_conn; |
| 4255 | |
| 4256 | f_init(1, true); |
| 4257 | f_sleep(1.0); |
| 4258 | |
| 4259 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4260 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4261 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4262 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4263 | } |
| 4264 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4265 | /* Allow 5,90k only (current default config) */ |
| 4266 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4267 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4268 | "amr-config 12_2k forbidden", |
| 4269 | "amr-config 10_2k forbidden", |
| 4270 | "amr-config 7_95k forbidden", |
| 4271 | "amr-config 7_40k forbidden", |
| 4272 | "amr-config 6_70k forbidden", |
| 4273 | "amr-config 5_90k allowed", |
| 4274 | "amr-config 5_15k forbidden", |
| 4275 | "amr-config 4_75k forbidden" |
| 4276 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4277 | } |
| 4278 | |
| 4279 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 4280 | * ("Config-NB-Code = 1") */ |
| 4281 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4282 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4283 | "amr-config 12_2k allowed", |
| 4284 | "amr-config 10_2k forbidden", |
| 4285 | "amr-config 7_95k forbidden", |
| 4286 | "amr-config 7_40k allowed", |
| 4287 | "amr-config 6_70k forbidden", |
| 4288 | "amr-config 5_90k allowed", |
| 4289 | "amr-config 5_15k forbidden", |
| 4290 | "amr-config 4_75k allowed" |
| 4291 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4292 | } |
| 4293 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4294 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 4295 | var charstring tch; |
| 4296 | if (fr) { |
| 4297 | tch := "tch-f"; |
| 4298 | } else { |
| 4299 | tch := "tch-h"; |
| 4300 | } |
| 4301 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 4302 | } |
| 4303 | |
| 4304 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 4305 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 4306 | f_vty_amr_start_mode_set(fr, "auto"); |
| 4307 | } |
| 4308 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4309 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4310 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4311 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4312 | |
| 4313 | /* Note: This setups the codec configuration. The parameter payload in |
| 4314 | * mr_conf must be consistant with the parameter codecElements in pars |
| 4315 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4316 | var RSL_IE_Body mr_conf := { |
| 4317 | other := { |
| 4318 | len := 2, |
| 4319 | payload := '2804'O |
| 4320 | } |
| 4321 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4322 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4323 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4324 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4325 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4326 | pars.expect_mr_conf_ie := mr_conf; |
| 4327 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4328 | f_init(1, true); |
| 4329 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4330 | f_vty_amr_start_mode_set(true, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4331 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4332 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4333 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4334 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4335 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4336 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4337 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4338 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4339 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4340 | f_ctrs_bts_verify(); |
| 4341 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4342 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4343 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4344 | } |
| 4345 | |
| 4346 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4347 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4348 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4349 | |
| 4350 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4351 | var RSL_IE_Body mr_conf := { |
| 4352 | other := { |
| 4353 | len := 2, |
| 4354 | payload := '2804'O |
| 4355 | } |
| 4356 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4357 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4358 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4359 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4360 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4361 | pars.expect_mr_conf_ie := mr_conf; |
| 4362 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4363 | f_init(1, true); |
| 4364 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4365 | f_vty_amr_start_mode_set(false, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4366 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4367 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4368 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4369 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4370 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4371 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4372 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4373 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4374 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4375 | f_ctrs_bts_verify(); |
| 4376 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4377 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4378 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4379 | } |
| 4380 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4381 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 4382 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 4383 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4384 | var MSC_ConnHdlr vc_conn; |
| 4385 | |
| 4386 | f_init(1, true); |
| 4387 | f_sleep(1.0); |
| 4388 | |
| 4389 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 4390 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 4391 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 4392 | f_disable_all_sdcch(); |
| 4393 | f_disable_all_tch_h(); |
| 4394 | |
| 4395 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4396 | pars.expect_channel_mode_modify := true; |
| 4397 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4398 | vc_conn.done; |
| 4399 | |
| 4400 | f_enable_all_sdcch(); |
| 4401 | f_enable_all_tch(); |
| 4402 | f_shutdown_helper(); |
| 4403 | } |
| 4404 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4405 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 4406 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 4407 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4408 | var MSC_ConnHdlr vc_conn; |
| 4409 | |
| 4410 | var RSL_IE_Body mr_conf := { |
| 4411 | other := { |
| 4412 | len := 2, |
| 4413 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 4414 | } |
| 4415 | }; |
| 4416 | |
| 4417 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4418 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4419 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4420 | pars.expect_mr_conf_ie := mr_conf; |
| 4421 | |
| 4422 | f_init(1, true); |
| 4423 | f_sleep(1.0); |
| 4424 | |
| 4425 | /* First set nonzero start mode bits */ |
| 4426 | f_vty_amr_start_mode_set(true, "4"); |
| 4427 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4428 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4429 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4430 | f_vty_amr_start_mode_set(true, "auto"); |
| 4431 | |
| 4432 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4433 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4434 | |
| 4435 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4436 | f_vty_amr_start_mode_set(true, "1"); |
| 4437 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4438 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4439 | } |
| 4440 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4441 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 4442 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4443 | runs on test_CT { |
| 4444 | |
| 4445 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4446 | var MSC_ConnHdlr vc_conn; |
| 4447 | |
| 4448 | /* See note above */ |
| 4449 | var RSL_IE_Body mr_conf := { |
| 4450 | other := { |
| 4451 | len := lengthof(mrconf), |
| 4452 | payload := mrconf |
| 4453 | } |
| 4454 | }; |
| 4455 | |
| 4456 | if (fr) { |
| 4457 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4458 | } else { |
| 4459 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4460 | } |
| 4461 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4462 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4463 | pars.expect_mr_conf_ie := mr_conf; |
| 4464 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4465 | |
| 4466 | f_init(1, true); |
| 4467 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4468 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4469 | f_sleep(1.0); |
| 4470 | |
| 4471 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4472 | vc_conn.done; |
| 4473 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4474 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4475 | } |
| 4476 | |
| 4477 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4478 | runs on test_CT { |
| 4479 | |
| 4480 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4481 | var MSC_ConnHdlr vc_conn; |
| 4482 | |
| 4483 | if (fr) { |
| 4484 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4485 | } else { |
| 4486 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4487 | } |
| 4488 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4489 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4490 | |
| 4491 | f_init(1, true); |
| 4492 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4493 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4494 | f_sleep(1.0); |
| 4495 | |
| 4496 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4497 | vc_conn.done; |
| 4498 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4499 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4500 | } |
| 4501 | |
| 4502 | |
| 4503 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4504 | * set. */ |
| 4505 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4506 | 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] | 4507 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4508 | } |
| 4509 | |
| 4510 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4511 | * rates set. */ |
| 4512 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4513 | 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] | 4514 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4515 | } |
| 4516 | |
| 4517 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4518 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4519 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4520 | 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] | 4521 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4522 | } |
| 4523 | |
| 4524 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4525 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4526 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4527 | 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] | 4528 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4529 | } |
| 4530 | |
| 4531 | /* The following block of tests selects more and more rates until all four |
| 4532 | * possible rates are in the active set (full rate) */ |
| 4533 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4534 | 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] | 4535 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4536 | } |
| 4537 | |
| 4538 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4539 | 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] | 4540 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4541 | } |
| 4542 | |
| 4543 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4544 | 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] | 4545 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4546 | } |
| 4547 | |
| 4548 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4549 | 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] | 4550 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4551 | } |
| 4552 | |
| 4553 | /* The following block of tests selects more and more rates until all three |
| 4554 | * possible rates are in the active set (half rate) */ |
| 4555 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4556 | 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] | 4557 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4558 | } |
| 4559 | |
| 4560 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4561 | 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] | 4562 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4563 | } |
| 4564 | |
| 4565 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4566 | 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] | 4567 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4568 | } |
| 4569 | |
| 4570 | /* The following block tests what happens when the MSC does offer rate |
| 4571 | * configurations that are not supported by the BSC. Normally such situations |
| 4572 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4573 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4574 | * to offer rates that are not applicable anyway. */ |
| 4575 | |
| 4576 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4577 | /* Try to include 12,2k in into the active set even though the channel |
| 4578 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4579 | 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] | 4580 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4581 | } |
| 4582 | |
| 4583 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4584 | /* See what happens when all rates are selected at once. Since then |
| 4585 | * Also S1 is selected, this setting will be prefered and we should |
| 4586 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4587 | 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] | 4588 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4589 | } |
| 4590 | |
| 4591 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4592 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4593 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4594 | * 5,90k, and 4,75k, into the active set. */ |
| 4595 | 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] | 4596 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4597 | } |
| 4598 | |
| 4599 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4600 | /* Try to select no rates at all */ |
| 4601 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4602 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4603 | } |
| 4604 | |
| 4605 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4606 | /* Try to select only unsupported rates */ |
| 4607 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4608 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4609 | } |
| 4610 | |
| 4611 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4612 | /* Try to select 12,2k for half rate */ |
| 4613 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4614 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4615 | } |
| 4616 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4617 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4618 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4619 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4620 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4621 | } |
| 4622 | |
| 4623 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4624 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4625 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4626 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4627 | } |
| 4628 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4629 | testcase TC_assignment_codec_amr_f_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 4630 | /* "amr tch-f modes 0 2 4 7" => total 4 modes and start mode 4 => '11'B on the wire */ |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4631 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4632 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4633 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4634 | } |
| 4635 | |
| 4636 | testcase TC_assignment_codec_amr_h_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 4637 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4638 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4639 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4640 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4641 | } |
| 4642 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4643 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4644 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4645 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4646 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4647 | 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] | 4648 | } |
| 4649 | |
| 4650 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4651 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4652 | 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] | 4653 | } |
| 4654 | |
| 4655 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4656 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4657 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4658 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4659 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4660 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4661 | 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] | 4662 | } |
| 4663 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4664 | private function f_disable_all_sdcch() runs on test_CT { |
| 4665 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4666 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4667 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4668 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4669 | } |
| 4670 | |
| 4671 | private function f_enable_all_sdcch() runs on test_CT { |
| 4672 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4673 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4674 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4675 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4676 | } |
| 4677 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4678 | /* Allow HR only */ |
| 4679 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4680 | g_pars := f_gen_test_hdlr_pars(); |
| 4681 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4682 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4683 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4684 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4685 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4686 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4687 | f_establish_fully(ass_cmd, exp_compl); |
| 4688 | } |
| 4689 | |
| 4690 | /* Allow FR only */ |
| 4691 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4692 | g_pars := f_gen_test_hdlr_pars(); |
| 4693 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4694 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4695 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4696 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4697 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4698 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4699 | f_establish_fully(ass_cmd, exp_compl); |
| 4700 | } |
| 4701 | |
| 4702 | /* Allow HR only (expect assignment failure) */ |
| 4703 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4704 | g_pars := f_gen_test_hdlr_pars(); |
| 4705 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4706 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4707 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4708 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4709 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4710 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4711 | f_establish_fully(ass_cmd, exp_fail); |
| 4712 | } |
| 4713 | |
| 4714 | /* Allow FR only (expect assignment failure) */ |
| 4715 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4716 | g_pars := f_gen_test_hdlr_pars(); |
| 4717 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4718 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4719 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4720 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4721 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4722 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4723 | f_establish_fully(ass_cmd, exp_fail); |
| 4724 | } |
| 4725 | |
| 4726 | /* Allow FR and HR, but prefer FR */ |
| 4727 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4728 | g_pars := f_gen_test_hdlr_pars(); |
| 4729 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4730 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4731 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4732 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4733 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4734 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4735 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4736 | f_establish_fully(ass_cmd, exp_compl); |
| 4737 | } |
| 4738 | |
| 4739 | /* Allow FR and HR, but prefer HR */ |
| 4740 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4741 | g_pars := f_gen_test_hdlr_pars(); |
| 4742 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4743 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4744 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4745 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4746 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4747 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4748 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4749 | f_establish_fully(ass_cmd, exp_compl); |
| 4750 | } |
| 4751 | |
| 4752 | /* Allow FR and HR, but prefer FR */ |
| 4753 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4754 | g_pars := f_gen_test_hdlr_pars(); |
| 4755 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4756 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4757 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4758 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4759 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4760 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4761 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4762 | f_establish_fully(ass_cmd, exp_compl); |
| 4763 | } |
| 4764 | |
| 4765 | /* Allow FR and HR, but prefer HR */ |
| 4766 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4767 | g_pars := f_gen_test_hdlr_pars(); |
| 4768 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4769 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4770 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4771 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4772 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4773 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4774 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4775 | f_establish_fully(ass_cmd, exp_compl); |
| 4776 | } |
| 4777 | |
| 4778 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4779 | * to work without conflicts */ |
| 4780 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4781 | var MSC_ConnHdlr vc_conn; |
| 4782 | f_init(1, true); |
| 4783 | f_sleep(1.0); |
| 4784 | f_enable_all_tch(); |
| 4785 | f_disable_all_tch_f(); |
| 4786 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4787 | vc_conn.done; |
| 4788 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4789 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4790 | } |
| 4791 | |
| 4792 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4793 | * to fail. */ |
| 4794 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4795 | var MSC_ConnHdlr vc_conn; |
| 4796 | f_init(1, true); |
| 4797 | f_sleep(1.0); |
| 4798 | f_enable_all_tch(); |
| 4799 | f_disable_all_tch_f(); |
| 4800 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4801 | vc_conn.done; |
| 4802 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4803 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4804 | } |
| 4805 | |
| 4806 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4807 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4808 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4809 | var MSC_ConnHdlr vc_conn; |
| 4810 | f_init(1, true); |
| 4811 | f_sleep(1.0); |
| 4812 | f_enable_all_tch(); |
| 4813 | f_disable_all_tch_f(); |
| 4814 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4815 | vc_conn.done; |
| 4816 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4817 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4818 | } |
| 4819 | |
| 4820 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4821 | * are exhausted, this is expected to work without conflicts. */ |
| 4822 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4823 | var MSC_ConnHdlr vc_conn; |
| 4824 | f_init(1, true); |
| 4825 | f_sleep(1.0); |
| 4826 | f_enable_all_tch(); |
| 4827 | f_disable_all_tch_f(); |
| 4828 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4829 | vc_conn.done; |
| 4830 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4831 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4832 | } |
| 4833 | |
| 4834 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4835 | * to work without conflicts */ |
| 4836 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4837 | var MSC_ConnHdlr vc_conn; |
| 4838 | f_init(1, true); |
| 4839 | f_sleep(1.0); |
| 4840 | f_enable_all_tch(); |
| 4841 | f_disable_all_tch_h(); |
| 4842 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4843 | vc_conn.done; |
| 4844 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4845 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4846 | } |
| 4847 | |
| 4848 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4849 | * to fail. */ |
| 4850 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4851 | var MSC_ConnHdlr vc_conn; |
| 4852 | f_init(1, true); |
| 4853 | f_sleep(1.0); |
| 4854 | f_enable_all_tch(); |
| 4855 | f_disable_all_tch_h(); |
| 4856 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4857 | vc_conn.done; |
| 4858 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4859 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4860 | } |
| 4861 | |
| 4862 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4863 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4864 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4865 | var MSC_ConnHdlr vc_conn; |
| 4866 | f_init(1, true); |
| 4867 | f_sleep(1.0); |
| 4868 | f_enable_all_tch(); |
| 4869 | f_disable_all_tch_h(); |
| 4870 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4871 | vc_conn.done; |
| 4872 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4873 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4874 | } |
| 4875 | |
| 4876 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4877 | * are exhausted, this is expected to work without conflicts. */ |
| 4878 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4879 | var MSC_ConnHdlr vc_conn; |
| 4880 | f_init(1, true); |
| 4881 | f_sleep(1.0); |
| 4882 | f_enable_all_tch(); |
| 4883 | f_disable_all_tch_h(); |
| 4884 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4885 | vc_conn.done; |
| 4886 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4887 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4888 | } |
| 4889 | |
| 4890 | /* Allow FR and HR, but prefer HR */ |
| 4891 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4892 | g_pars := f_gen_test_hdlr_pars(); |
| 4893 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4894 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4895 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4896 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4897 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4898 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4899 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4900 | f_establish_fully(ass_cmd, exp_compl); |
| 4901 | } |
| 4902 | |
| 4903 | /* Allow FR and HR, but prefer FR */ |
| 4904 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4905 | g_pars := f_gen_test_hdlr_pars(); |
| 4906 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4907 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4908 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4909 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4910 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4911 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4912 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4913 | f_establish_fully(ass_cmd, exp_compl); |
| 4914 | } |
| 4915 | |
| 4916 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4917 | * HR, which is the prefered type, is selected. */ |
| 4918 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4919 | var MSC_ConnHdlr vc_conn; |
| 4920 | f_init(1, true); |
| 4921 | f_sleep(1.0); |
| 4922 | f_enable_all_tch(); |
| 4923 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4924 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4925 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4926 | } |
| 4927 | |
| 4928 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4929 | * FR, which is the prefered type, is selected. */ |
| 4930 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4931 | var MSC_ConnHdlr vc_conn; |
| 4932 | f_init(1, true); |
| 4933 | f_sleep(1.0); |
| 4934 | f_enable_all_tch(); |
| 4935 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4936 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4937 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4938 | } |
| 4939 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 4940 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 4941 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 4942 | g_pars := f_gen_test_hdlr_pars(); |
| 4943 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 4944 | |
| 4945 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4946 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4947 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4948 | var template uint3_t tsc := ?; |
| 4949 | |
| 4950 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4951 | f_create_bssmap_exp(l3_enc); |
| 4952 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4953 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4954 | |
| 4955 | /* we should now have a COMPL_L3 at the MSC */ |
| 4956 | timer T := 10.0; |
| 4957 | T.start; |
| 4958 | alt { |
| 4959 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4960 | [] T.timeout { |
| 4961 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4962 | } |
| 4963 | } |
| 4964 | } |
| 4965 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 4966 | var MSC_ConnHdlr vc_conn; |
| 4967 | f_init(1, true); |
| 4968 | f_sleep(1.0); |
| 4969 | f_disable_all_sdcch(); |
| 4970 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 4971 | vc_conn.done; |
| 4972 | f_enable_all_sdcch(); |
| 4973 | f_shutdown_helper(); |
| 4974 | } |
| 4975 | |
| 4976 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 4977 | expected that no TCH will be selected for signalling and assigment will fail |
| 4978 | because it's dictated by VTY config */ |
| 4979 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 4980 | var RSL_Message rsl_unused, rsl_msg; |
| 4981 | var GsmRrMessage rr; |
| 4982 | f_init(1, false); |
| 4983 | f_sleep(1.0); |
| 4984 | f_vty_allow_tch_for_signalling(false, 0); |
| 4985 | f_disable_all_sdcch(); |
| 4986 | |
| 4987 | /* RA containing reason=LU */ |
| 4988 | f_ipa_tx(0, ts_RSL_CHAN_RQD('02'O, 2342)); |
| 4989 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 4990 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 4991 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 4992 | setverdict(fail, "Expected reject"); |
| 4993 | } |
| 4994 | |
| 4995 | f_vty_allow_tch_for_signalling(true, 0); |
| 4996 | f_enable_all_sdcch(); |
| 4997 | f_shutdown_helper(); |
| 4998 | } |
| 4999 | |
| 5000 | /* Request a voice channel with all SDCCH exhausted, it is |
| 5001 | * expected that TCH channel will be allocated since the VTY option is only |
| 5002 | * aimed at signalling requests */ |
| 5003 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 5004 | g_pars := f_gen_test_hdlr_pars(); |
| 5005 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 5006 | |
| 5007 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 5008 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 5009 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 5010 | var template uint3_t tsc := ?; |
| 5011 | |
| 5012 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 5013 | f_create_bssmap_exp(l3_enc); |
| 5014 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 5015 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 5016 | |
| 5017 | /* we should now have a COMPL_L3 at the MSC */ |
| 5018 | timer T := 10.0; |
| 5019 | T.start; |
| 5020 | alt { |
| 5021 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 5022 | [] T.timeout { |
| 5023 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 5024 | } |
| 5025 | } |
| 5026 | } |
| 5027 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 5028 | var MSC_ConnHdlr vc_conn; |
| 5029 | f_init(1, true); |
| 5030 | f_sleep(1.0); |
| 5031 | f_vty_allow_tch_for_signalling(false, 0); |
| 5032 | f_disable_all_sdcch(); |
| 5033 | |
| 5034 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 5035 | vc_conn.done; |
| 5036 | |
| 5037 | f_vty_allow_tch_for_signalling(true, 0); |
| 5038 | f_enable_all_sdcch(); |
| 5039 | f_shutdown_helper(); |
| 5040 | } |
| 5041 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5042 | testcase TC_assignment_osmux() runs on test_CT { |
| 5043 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5044 | var MSC_ConnHdlr vc_conn; |
| 5045 | |
| 5046 | /* See note above */ |
| 5047 | var RSL_IE_Body mr_conf := { |
| 5048 | other := { |
| 5049 | len := 2, |
| 5050 | payload := '2804'O |
| 5051 | } |
| 5052 | }; |
| 5053 | |
| 5054 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 5055 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 5056 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 5057 | pars.expect_mr_conf_ie := mr_conf; |
| 5058 | pars.use_osmux := true; |
| 5059 | |
| 5060 | f_init(1, true, true); |
| 5061 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5062 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5063 | |
| 5064 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5065 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5066 | |
| 5067 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 5068 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5069 | } |
| 5070 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5071 | /* test the procedure of the MSC requesting a Classmark Update: |
| 5072 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 5073 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5074 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 5075 | g_pars := f_gen_test_hdlr_pars(); |
| 5076 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5077 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5078 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5079 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5080 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 5081 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 5082 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5083 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 5084 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 5085 | setverdict(pass); |
| 5086 | } |
| 5087 | testcase TC_classmark() runs on test_CT { |
| 5088 | var MSC_ConnHdlr vc_conn; |
| 5089 | f_init(1, true); |
| 5090 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5091 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5092 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5093 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5094 | } |
| 5095 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5096 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 5097 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 5098 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 5099 | g_pars := f_gen_test_hdlr_pars(); |
| 5100 | f_MscConnHdlr_init_vty(); |
| 5101 | |
| 5102 | f_create_chan_and_exp(); |
| 5103 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5104 | |
| 5105 | /* Send CommonID */ |
| 5106 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 5107 | |
| 5108 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 5109 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 5110 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 5111 | |
| 5112 | setverdict(pass); |
| 5113 | } |
| 5114 | testcase TC_common_id() runs on test_CT { |
| 5115 | var MSC_ConnHdlr vc_conn; |
| 5116 | f_init(1, true); |
| 5117 | f_sleep(1.0); |
| 5118 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 5119 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5120 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5121 | } |
| 5122 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5123 | 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] | 5124 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5125 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5126 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5127 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5128 | /* send the single message we want to send */ |
| 5129 | f_rsl_send_l3(l3); |
| 5130 | } |
| 5131 | |
| 5132 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 5133 | timer T := sec; |
| 5134 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5135 | T.start; |
| 5136 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5137 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 5138 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5139 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5140 | } |
| 5141 | [] T.timeout { |
| 5142 | setverdict(pass); |
| 5143 | } |
| 5144 | } |
| 5145 | } |
| 5146 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5147 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5148 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 5149 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 5150 | f_bssap_expect_nothing(); |
| 5151 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5152 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 5153 | var MSC_ConnHdlr vc_conn; |
| 5154 | f_init(1, true); |
| 5155 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5156 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5157 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5158 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5159 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5160 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5161 | |
| 5162 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5163 | 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] | 5164 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 5165 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5166 | } |
| 5167 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 5168 | var MSC_ConnHdlr vc_conn; |
| 5169 | f_init(1, true); |
| 5170 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5171 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5172 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5173 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5174 | } |
| 5175 | |
| 5176 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5177 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5178 | 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] | 5179 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 5180 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5181 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5182 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 5183 | var MSC_ConnHdlr vc_conn; |
| 5184 | f_init(1, true); |
| 5185 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5186 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5187 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5188 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5189 | } |
| 5190 | |
| 5191 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5192 | /* short message from MS should be ignored */ |
| 5193 | 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] | 5194 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5195 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5196 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5197 | |
| 5198 | /* send short message */ |
| 5199 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 5200 | f_bssap_expect_nothing(); |
| 5201 | } |
| 5202 | testcase TC_err_82_short_msg() runs on test_CT { |
| 5203 | var MSC_ConnHdlr vc_conn; |
| 5204 | f_init(1, true); |
| 5205 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5206 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5207 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5208 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5209 | } |
| 5210 | |
| 5211 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5212 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 5213 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 5214 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 5215 | timer T := 3.0 |
| 5216 | alt { |
| 5217 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 5218 | setverdict(pass); |
| 5219 | } |
| 5220 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 5221 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5222 | } |
| 5223 | } |
| 5224 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 5225 | var MSC_ConnHdlr vc_conn; |
| 5226 | f_init(1, true); |
| 5227 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5228 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5229 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5230 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5231 | } |
| 5232 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5233 | /*********************************************************************** |
| 5234 | * Handover |
| 5235 | ***********************************************************************/ |
| 5236 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5237 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 5238 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 5239 | runs on test_CT { |
| 5240 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5241 | " timeslot "&int2str(ts_nr)&" "; |
| 5242 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 5243 | } |
| 5244 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5245 | /* 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] | 5246 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 5247 | uint8_t bts_nr, uint8_t trx_nr, |
| 5248 | in RslChannelNr chan_nr) |
| 5249 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5250 | /* FIXME: resolve those from component-global state */ |
| 5251 | var integer ts_nr := chan_nr.tn; |
| 5252 | var integer ss_nr; |
| 5253 | if (ischosen(chan_nr.u.ch0)) { |
| 5254 | ss_nr := 0; |
| 5255 | } else if (ischosen(chan_nr.u.lm)) { |
| 5256 | ss_nr := chan_nr.u.lm.sub_chan; |
| 5257 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 5258 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 5259 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 5260 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 5261 | } else { |
| 5262 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5263 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5264 | } |
| 5265 | |
| 5266 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5267 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5268 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5269 | } |
| 5270 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5271 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 5272 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 5273 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 5274 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 5275 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5276 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 5277 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 5278 | { |
| 5279 | 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] | 5280 | } |
| 5281 | |
| 5282 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 5283 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 5284 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5285 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5286 | |
| 5287 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5288 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5289 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5290 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5291 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5292 | |
| 5293 | var HandoverState hs := { |
| 5294 | rr_ho_cmpl_seen := false, |
| 5295 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5296 | old_chan_nr := -, |
| 5297 | expect_target_tsc := BTS_TSC[1] |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5298 | }; |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5299 | /* issue hand-over command on VTY, from BTS 0 to BTS 1 */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5300 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5301 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5302 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5303 | |
| 5304 | /* From the MGW perspective, a handover is is characterized by |
| 5305 | * performing one MDCX operation with the MGW. So we expect to see |
| 5306 | * one more MDCX during handover. */ |
| 5307 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5308 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5309 | alt { |
| 5310 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5311 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5312 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 5313 | /* Since this is an internal handover we expect the BSC to inform the |
| 5314 | * MSC about the event */ |
| 5315 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 5316 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5317 | /* Check the amount of MGCP transactions is still consistant with the |
| 5318 | * test expectation */ |
| 5319 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5320 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5321 | var RSL_Message chan_act := f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr); |
| 5322 | |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5323 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 5324 | * g_chan_nr to the new lchan that was handed over to. It lives in bts 1, so look it up at RSL1_PROC. */ |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5325 | f_verify_encr_info(chan_act); |
| 5326 | |
| 5327 | f_chan_act_verify_tsc(chan_act, BTS_TSC[1]); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5328 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5329 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5330 | } |
| 5331 | |
| 5332 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5333 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5334 | var MSC_ConnHdlr vc_conn; |
| 5335 | f_init(2, true); |
| 5336 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5337 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5338 | pars.expect_tsc := BTS_TSC[0]; |
| 5339 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5340 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5341 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5342 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5343 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5344 | |
| 5345 | /* from f_establish_fully() */ |
| 5346 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5347 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5348 | /* from handover */ |
| 5349 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5350 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5351 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5352 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5353 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5354 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5355 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5356 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5357 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5358 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5359 | function f_tc_ho_int_a5(OCT1 encr_alg, charstring enc_a5 := "0 1 3") runs on test_CT { |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5360 | var MSC_ConnHdlr vc_conn; |
| 5361 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5362 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5363 | |
| 5364 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5365 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5366 | f_sleep(1.0); |
| 5367 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5368 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5369 | |
| 5370 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 5371 | vc_conn.done; |
| 5372 | |
| 5373 | /* from f_establish_fully() */ |
| 5374 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5375 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5376 | /* from handover */ |
| 5377 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5378 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5379 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5380 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5381 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5382 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5383 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5384 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5385 | f_shutdown_helper(); |
| 5386 | } |
| 5387 | |
| 5388 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 5389 | f_tc_ho_int_a5('01'O); |
| 5390 | } |
| 5391 | |
| 5392 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 5393 | f_tc_ho_int_a5('02'O); |
| 5394 | } |
| 5395 | |
| 5396 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 5397 | f_tc_ho_int_a5('08'O); |
| 5398 | } |
| 5399 | |
| 5400 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5401 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5402 | } |
| 5403 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5404 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 5405 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 5406 | g_pars := f_gen_test_hdlr_pars(); |
| 5407 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5408 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5409 | |
| 5410 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5411 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5412 | |
| 5413 | f_establish_fully(ass_cmd, exp_compl); |
| 5414 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 5415 | |
| 5416 | var HandoverState hs := { |
| 5417 | rr_ho_cmpl_seen := false, |
| 5418 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5419 | old_chan_nr := -, |
| 5420 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5421 | }; |
| 5422 | /* issue hand-over command on VTY */ |
| 5423 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 5424 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5425 | f_rslem_suspend(RSL1_PROC); |
| 5426 | |
| 5427 | /* From the MGW perspective, a handover is is characterized by |
| 5428 | * performing one MDCX operation with the MGW. So we expect to see |
| 5429 | * one more MDCX during handover. */ |
| 5430 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5431 | |
| 5432 | var RSL_Message rsl; |
| 5433 | var PDU_ML3_NW_MS l3; |
| 5434 | var RslChannelNr new_chan_nr; |
| 5435 | var GsmArfcn arfcn; |
| 5436 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5437 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5438 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5439 | setverdict(fail, "Expected handoverCommand"); |
| 5440 | mtc.stop; |
| 5441 | } |
| 5442 | } |
| 5443 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5444 | new_chan_nr, arfcn); |
| 5445 | |
| 5446 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5447 | |
| 5448 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5449 | * before performing a hand-over */ |
| 5450 | f_rslem_resume(RSL1_PROC); |
| 5451 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5452 | |
| 5453 | f_sleep(1.0); |
| 5454 | |
| 5455 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5456 | * and the old lchan reports a Radio Link Failure. */ |
| 5457 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5458 | |
| 5459 | var PDU_BSSAP rx_clear_request; |
| 5460 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5461 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5462 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5463 | |
| 5464 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5465 | |
| 5466 | var MgcpCommand mgcp; |
| 5467 | interleave { |
| 5468 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5469 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5470 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5471 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5472 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5473 | } |
| 5474 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5475 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5476 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5477 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5478 | } |
| 5479 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 5480 | } |
| 5481 | |
| 5482 | f_sleep(0.5); |
| 5483 | setverdict(pass); |
| 5484 | } |
| 5485 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5486 | var MSC_ConnHdlr vc_conn; |
| 5487 | f_init(2, true); |
| 5488 | f_sleep(1.0); |
| 5489 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5490 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5491 | |
| 5492 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5493 | vc_conn.done; |
| 5494 | |
| 5495 | /* from f_establish_fully() */ |
| 5496 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5497 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5498 | /* from handover */ |
| 5499 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5500 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5501 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5502 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5503 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5504 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:stopped"); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5505 | f_ctrs_bsc_and_bts_verify(); |
| 5506 | f_shutdown_helper(); |
| 5507 | } |
| 5508 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5509 | /* 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] | 5510 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5511 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5512 | var template MgcpResponse mgcp_resp; |
| 5513 | var MGCP_RecvFrom mrf; |
| 5514 | var template MgcpMessage msg_resp; |
| 5515 | var template MgcpMessage msg_dlcx := { |
| 5516 | command := tr_DLCX() |
| 5517 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5518 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5519 | if (g_pars.aoip) { |
| 5520 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5521 | log("Got first DLCX: ", mgcp); |
| 5522 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5523 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5524 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5525 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 5526 | log("Got second DLCX: ", mgcp); |
| 5527 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 5528 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5529 | } else { |
| 5530 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 5531 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 5532 | log("Got first DLCX: ", mrf.msg.command); |
| 5533 | msg_resp := { |
| 5534 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 5535 | } |
| 5536 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 5537 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5538 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5539 | } |
| 5540 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5541 | private function f_ho_out_of_this_bsc(template (omit) BSSMAP_oldToNewBSSIEs exp_oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5542 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 5543 | var NcellReports neighbor_rep := { |
| 5544 | { rxlev := 20, bcch_freq := 0, bsic := 11 } |
| 5545 | }; |
| 5546 | var octetstring l3_mr := enc_GsmRrL3Message(valueof(ts_MEAS_REP(true, 8, 8, reps := neighbor_rep))); |
| 5547 | RSL.send(ts_RSL_MEAS_RES(g_chan_nr, 0, ts_RSL_IE_UplinkMeas, ts_RSL_IE_BS_Power(0), ts_RSL_IE_L1Info, |
| 5548 | l3_mr, 0)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5549 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5550 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5551 | |
| 5552 | f_sleep(0.5); |
| 5553 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5554 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5555 | * containing an RR Handover Command coming from the target BSS... */ |
| 5556 | |
| 5557 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5558 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5559 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5560 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5561 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5562 | |
| 5563 | /* expect the Handover Command to go out on RR */ |
| 5564 | var RSL_Message rsl_ho_cmd |
| 5565 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5566 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5567 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5568 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5569 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5570 | setverdict(fail); |
| 5571 | } else { |
| 5572 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5573 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5574 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5575 | setverdict(fail); |
| 5576 | } else { |
| 5577 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5578 | setverdict(pass); |
| 5579 | } |
| 5580 | } |
| 5581 | |
| 5582 | /* When the other BSS has reported a completed handover, this side is |
| 5583 | * torn down. */ |
| 5584 | |
| 5585 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 5586 | var BssmapCause cause := enum2int(cause_val); |
| 5587 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5588 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5589 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5590 | |
| 5591 | interleave { |
| 5592 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 5593 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 5594 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5595 | [] BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5596 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5597 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5598 | } |
| 5599 | |
| 5600 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5601 | g_pars := f_gen_test_hdlr_pars(); |
| 5602 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5603 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5604 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5605 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5606 | f_establish_fully(ass_req, exp_compl); |
| 5607 | |
| 5608 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5609 | } |
| 5610 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 5611 | var MSC_ConnHdlr vc_conn; |
| 5612 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 5613 | f_init_vty(); |
| 5614 | f_bts_0_cfg(BSCVTY, |
| 5615 | {"neighbor-list mode automatic", |
| 5616 | "handover 1", |
| 5617 | "handover algorithm 2", |
| 5618 | "handover2 window rxlev averaging 1", |
| 5619 | "neighbor lac 99 arfcn 123 bsic any"}); |
| 5620 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5621 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5622 | f_init(1, true); |
| 5623 | f_sleep(1.0); |
| 5624 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5625 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5626 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5627 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 5628 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5629 | |
| 5630 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5631 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5632 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5633 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5634 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5635 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 5636 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5637 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5638 | } |
| 5639 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5640 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5641 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 5642 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5643 | octetstring l3 := '0123456789'O) |
| 5644 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5645 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 5646 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5647 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5648 | var template PDU_BSSAP exp_data := { |
| 5649 | discriminator := '1'B, |
| 5650 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5651 | dlci := dlci, |
| 5652 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5653 | pdu := { |
| 5654 | dtap := l3 |
| 5655 | } |
| 5656 | }; |
| 5657 | BSSAP.receive(exp_data); |
| 5658 | setverdict(pass); |
| 5659 | } |
| 5660 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5661 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5662 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5663 | template (value) OCT1 dlci := '00'O, |
| 5664 | octetstring l3 := '0123456789'O) |
| 5665 | runs on MSC_ConnHdlr { |
| 5666 | BSSAP.send(PDU_BSSAP:{ |
| 5667 | discriminator := '1'B, |
| 5668 | spare := '0000000'B, |
| 5669 | dlci := dlci, |
| 5670 | lengthIndicator := lengthof(l3), |
| 5671 | pdu := { |
| 5672 | dtap := l3 |
| 5673 | } |
| 5674 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5675 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5676 | setverdict(pass); |
| 5677 | } |
| 5678 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5679 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 5680 | * simply never sends a BSSMAP Handover Command. */ |
| 5681 | 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] | 5682 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5683 | |
| 5684 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5685 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5686 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5687 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5688 | f_establish_fully(ass_req, exp_compl); |
| 5689 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5690 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5691 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5692 | |
| 5693 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5694 | |
| 5695 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 5696 | * Let's give it a bit extra. */ |
| 5697 | f_sleep(15.0); |
| 5698 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5699 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5700 | f_sleep(1.0); |
| 5701 | } |
| 5702 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 5703 | var MSC_ConnHdlr vc_conn; |
| 5704 | |
| 5705 | f_init(1, true); |
| 5706 | f_sleep(1.0); |
| 5707 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5708 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5709 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5710 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 5711 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5712 | |
| 5713 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5714 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5715 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5716 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5717 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5718 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5719 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5720 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5721 | } |
| 5722 | |
| 5723 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 5724 | * RR Handover Failure. */ |
| 5725 | 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] | 5726 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5727 | |
| 5728 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5729 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5730 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5731 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5732 | f_establish_fully(ass_req, exp_compl); |
| 5733 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5734 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5735 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5736 | |
| 5737 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5738 | |
| 5739 | f_sleep(0.5); |
| 5740 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5741 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5742 | * containing an RR Handover Command coming from the target BSS... */ |
| 5743 | |
| 5744 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5745 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5746 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5747 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5748 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5749 | |
| 5750 | /* expect the Handover Command to go out on RR */ |
| 5751 | var RSL_Message rsl_ho_cmd |
| 5752 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5753 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5754 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5755 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5756 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5757 | setverdict(fail); |
| 5758 | } else { |
| 5759 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5760 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5761 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5762 | setverdict(fail); |
| 5763 | } else { |
| 5764 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5765 | setverdict(pass); |
| 5766 | } |
| 5767 | } |
| 5768 | |
| 5769 | f_sleep(0.2); |
| 5770 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5771 | |
| 5772 | /* Should tell the MSC about the failure */ |
| 5773 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5774 | |
| 5775 | f_sleep(1.0); |
| 5776 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5777 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5778 | f_sleep(1.0); |
| 5779 | |
| 5780 | setverdict(pass); |
| 5781 | f_sleep(1.0); |
| 5782 | } |
| 5783 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5784 | var MSC_ConnHdlr vc_conn; |
| 5785 | |
| 5786 | f_init(1, true); |
| 5787 | f_sleep(1.0); |
| 5788 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5789 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5790 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5791 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5792 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5793 | |
| 5794 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5795 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5796 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5797 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5798 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5799 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5800 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5801 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5802 | } |
| 5803 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5804 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5805 | * (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] | 5806 | * and the lchan is released. */ |
| 5807 | 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] | 5808 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5809 | |
| 5810 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5811 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5812 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5813 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5814 | f_establish_fully(ass_req, exp_compl); |
| 5815 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5816 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5817 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5818 | |
| 5819 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5820 | |
| 5821 | f_sleep(0.5); |
| 5822 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5823 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5824 | * containing an RR Handover Command coming from the target BSS... */ |
| 5825 | |
| 5826 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5827 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5828 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5829 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5830 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5831 | |
| 5832 | /* expect the Handover Command to go out on RR */ |
| 5833 | var RSL_Message rsl_ho_cmd |
| 5834 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5835 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5836 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5837 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5838 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5839 | setverdict(fail); |
| 5840 | } else { |
| 5841 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5842 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5843 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5844 | setverdict(fail); |
| 5845 | } else { |
| 5846 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5847 | setverdict(pass); |
| 5848 | } |
| 5849 | } |
| 5850 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5851 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5852 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5853 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5854 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5855 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5856 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5857 | log("Got BSSMAP Clear Request"); |
| 5858 | /* Instruct BSC to clear channel */ |
| 5859 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5860 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5861 | |
| 5862 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5863 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5864 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5865 | log("Got Deact SACCH"); |
| 5866 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5867 | [] 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] | 5868 | log("Got RR Release"); |
| 5869 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5870 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5871 | log("Got RF Chan Rel"); |
| 5872 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5873 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5874 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5875 | } |
| 5876 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5877 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5878 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5879 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5880 | setverdict(pass); |
| 5881 | f_sleep(1.0); |
| 5882 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5883 | 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] | 5884 | var MSC_ConnHdlr vc_conn; |
| 5885 | |
| 5886 | f_init(1, true); |
| 5887 | f_sleep(1.0); |
| 5888 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5889 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5890 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5891 | 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] | 5892 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5893 | |
| 5894 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5895 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5896 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5897 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5898 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5899 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5900 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5901 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5902 | } |
| 5903 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5904 | private function f_ho_into_this_bsc(charstring id, template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5905 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5906 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5907 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5908 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5909 | * before we get started. */ |
| 5910 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5911 | f_rslem_register(0, new_chan_nr); |
| 5912 | g_chan_nr := new_chan_nr; |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5913 | var uint3_t expect_target_tsc := BTS_TSC[0]; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5914 | f_sleep(1.0); |
| 5915 | |
| 5916 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5917 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5918 | activate(as_Media()); |
| 5919 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5920 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5921 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5922 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 5923 | enc := g_pars.encr))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5924 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5925 | |
| 5926 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5927 | |
| 5928 | var PDU_BSSAP rx_bssap; |
| 5929 | var octetstring ho_command_str; |
| 5930 | |
| 5931 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5932 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5933 | /* we're sure that the channel activation is done now, verify the parameters in it */ |
| 5934 | var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 5935 | f_verify_encr_info(chan_act); |
| 5936 | f_chan_act_verify_tsc(chan_act, expect_target_tsc); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5937 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5938 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5939 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5940 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5941 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5942 | |
| 5943 | var GsmArfcn arfcn; |
| 5944 | var RslChannelNr actual_new_chan_nr; |
| 5945 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5946 | actual_new_chan_nr, arfcn); |
| 5947 | |
| 5948 | if (actual_new_chan_nr != new_chan_nr) { |
| 5949 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5950 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5951 | setverdict(fail); |
| 5952 | return; |
| 5953 | } |
| 5954 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5955 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5956 | var uint3_t got_tsc := rr_chan_desc_tsc(ho_command.msgs.rrm.handoverCommand.channelDescription2); |
| 5957 | if (not match(got_tsc, expect_target_tsc)) { |
| 5958 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 5959 | expect_target_tsc, " got ", got_tsc); |
| 5960 | mtc.stop; |
| 5961 | } else { |
| 5962 | log("handoverCommand: verified TSC = ", got_tsc); |
| 5963 | } |
| 5964 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5965 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5966 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5967 | * the new lchan with a Handover RACH: */ |
| 5968 | |
| 5969 | /* send handover detect */ |
| 5970 | |
| 5971 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5972 | |
| 5973 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5974 | |
| 5975 | /* send handover complete over the new channel */ |
| 5976 | |
| 5977 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5978 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5979 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5980 | |
| 5981 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5982 | setverdict(pass); |
| 5983 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5984 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5985 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5986 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5987 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 5988 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 5989 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5990 | } |
| 5991 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5992 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5993 | } else { |
| 5994 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5995 | } |
| 5996 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 5997 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5998 | setverdict(pass); |
| 5999 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6000 | 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] | 6001 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6002 | |
| 6003 | f_init(1, true); |
| 6004 | f_sleep(1.0); |
| 6005 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6006 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6007 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6008 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6009 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6010 | |
| 6011 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 6012 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6013 | |
| 6014 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6015 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 6016 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6017 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 6018 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6019 | } |
| 6020 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6021 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 6022 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6023 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6024 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6025 | } |
| 6026 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6027 | function f_tc_ho_into_this_bsc_a5(OCT1 encr_alg) runs on test_CT { |
| 6028 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6029 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 6030 | f_tc_ho_into_this_bsc_main(pars); |
| 6031 | f_shutdown_helper(); |
| 6032 | } |
| 6033 | |
| 6034 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
| 6035 | f_tc_ho_into_this_bsc_a5('01'O); |
| 6036 | } |
| 6037 | |
| 6038 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
| 6039 | f_tc_ho_into_this_bsc_a5('02'O); |
| 6040 | } |
| 6041 | |
| 6042 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
| 6043 | f_tc_ho_into_this_bsc_a5('08'O); |
| 6044 | } |
| 6045 | |
| 6046 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
| 6047 | f_tc_ho_into_this_bsc_a5('10'O); |
| 6048 | } |
| 6049 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6050 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 6051 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6052 | pars.host_aoip_tla := "::6"; |
| 6053 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6054 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6055 | } |
| 6056 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6057 | /* Similar to TC_ho_into_this_bsc, but when in SRVCC, HO Req contains "Old BSS |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6058 | to New BSS Information" IE with "Last Used E-UTRAN PLMN Id", which, when the |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6059 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 6060 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 6061 | neighbors. */ |
| 6062 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 6063 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6064 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6065 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6066 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 6067 | |
| 6068 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6069 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6070 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6071 | f_shutdown_helper(); |
| 6072 | } |
| 6073 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6074 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 6075 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 6076 | list when the channel is released. */ |
| 6077 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 6078 | f_init_vty(); |
| 6079 | f_vty_allow_srvcc_fast_return(true, 0) |
| 6080 | |
| 6081 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6082 | pars.last_used_eutran_plmn := '323454'O; |
| 6083 | pars.exp_fast_return := false; |
| 6084 | f_tc_ho_into_this_bsc_main(pars); |
| 6085 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6086 | f_shutdown_helper(); |
| 6087 | } |
| 6088 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6089 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 6090 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 6091 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 6092 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 6093 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 6094 | setverdict(pass); |
| 6095 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6096 | |
| 6097 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 6098 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6099 | var MSC_ConnHdlr vc_conn; |
| 6100 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6101 | |
| 6102 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6103 | if (disable_fast_return) { |
| 6104 | f_vty_allow_srvcc_fast_return(true, 0); |
| 6105 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6106 | f_sleep(1.0); |
| 6107 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6108 | f_ctrs_bsc_and_bts_handover_init(); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6109 | |
| 6110 | pars.last_used_eutran_plmn := '323454'O; |
| 6111 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6112 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 6113 | |
| 6114 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 6115 | vc_conn.done; |
| 6116 | |
| 6117 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 6118 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 6119 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 6120 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 6121 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 6122 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed", 1); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 6123 | |
| 6124 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 6125 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6126 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6127 | |
| 6128 | if (disable_fast_return) { |
| 6129 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6130 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6131 | f_shutdown_helper(); |
| 6132 | } |
| 6133 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6134 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 6135 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 6136 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 6137 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 6138 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 6139 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 6140 | } |
| 6141 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 6142 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 6143 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 6144 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 6145 | } |
| 6146 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6147 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 6148 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6149 | f_rslem_register(0, new_chan_nr); |
| 6150 | g_chan_nr := new_chan_nr; |
| 6151 | f_sleep(1.0); |
| 6152 | |
| 6153 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6154 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6155 | activate(as_Media()); |
| 6156 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6157 | 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] | 6158 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6159 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6160 | |
| 6161 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6162 | |
| 6163 | var PDU_BSSAP rx_bssap; |
| 6164 | var octetstring ho_command_str; |
| 6165 | |
| 6166 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6167 | |
| 6168 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6169 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6170 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6171 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6172 | |
| 6173 | var GsmArfcn arfcn; |
| 6174 | var RslChannelNr actual_new_chan_nr; |
| 6175 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6176 | actual_new_chan_nr, arfcn); |
| 6177 | |
| 6178 | if (actual_new_chan_nr != new_chan_nr) { |
| 6179 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6180 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6181 | setverdict(fail); |
| 6182 | return; |
| 6183 | } |
| 6184 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6185 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 6186 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 6187 | f_sleep(1.0); |
| 6188 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6189 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6190 | * tells the MS to handover to the new lchan. In this case, the MS |
| 6191 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 6192 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 6193 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 6194 | * BSSMAP Clear Command: */ |
| 6195 | |
| 6196 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6197 | var BssmapCause cause := enum2int(cause_val); |
| 6198 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6199 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6200 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6201 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6202 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6203 | setverdict(pass); |
| 6204 | f_sleep(1.0); |
| 6205 | |
| 6206 | setverdict(pass); |
| 6207 | } |
| 6208 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 6209 | var MSC_ConnHdlr vc_conn; |
| 6210 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6211 | |
| 6212 | f_init(1, true); |
| 6213 | f_sleep(1.0); |
| 6214 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6215 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6216 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6217 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6218 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6219 | |
| 6220 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 6221 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6222 | |
| 6223 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6224 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6225 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6226 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6227 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6228 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6229 | } |
| 6230 | |
| 6231 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 6232 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6233 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6234 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6235 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6236 | * before we get started. */ |
| 6237 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6238 | f_rslem_register(0, new_chan_nr); |
| 6239 | g_chan_nr := new_chan_nr; |
| 6240 | f_sleep(1.0); |
| 6241 | |
| 6242 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6243 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6244 | activate(as_Media()); |
| 6245 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6246 | 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] | 6247 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6248 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6249 | |
| 6250 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6251 | |
| 6252 | var PDU_BSSAP rx_bssap; |
| 6253 | var octetstring ho_command_str; |
| 6254 | |
| 6255 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6256 | |
| 6257 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6258 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6259 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6260 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6261 | |
| 6262 | var GsmArfcn arfcn; |
| 6263 | var RslChannelNr actual_new_chan_nr; |
| 6264 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6265 | actual_new_chan_nr, arfcn); |
| 6266 | |
| 6267 | if (actual_new_chan_nr != new_chan_nr) { |
| 6268 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6269 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6270 | setverdict(fail); |
| 6271 | return; |
| 6272 | } |
| 6273 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6274 | |
| 6275 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6276 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6277 | * the new lchan with a Handover RACH: */ |
| 6278 | |
| 6279 | /* send handover detect */ |
| 6280 | |
| 6281 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6282 | |
| 6283 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6284 | |
| 6285 | /* The MSC chooses to clear the connection now, maybe we got the |
| 6286 | * Handover RACH on the new cell but the MS still signaled Handover |
| 6287 | * Failure to the old BSS? */ |
| 6288 | |
| 6289 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6290 | var BssmapCause cause := enum2int(cause_val); |
| 6291 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6292 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6293 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6294 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6295 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6296 | f_sleep(1.0); |
| 6297 | } |
| 6298 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 6299 | var MSC_ConnHdlr vc_conn; |
| 6300 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6301 | |
| 6302 | f_init(1, true); |
| 6303 | f_sleep(1.0); |
| 6304 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6305 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6306 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6307 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6308 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6309 | |
| 6310 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 6311 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6312 | |
| 6313 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6314 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6315 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6316 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6317 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6318 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6319 | } |
| 6320 | |
| 6321 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 6322 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 6323 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6324 | f_rslem_register(0, new_chan_nr); |
| 6325 | g_chan_nr := new_chan_nr; |
| 6326 | f_sleep(1.0); |
| 6327 | |
| 6328 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6329 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6330 | activate(as_Media()); |
| 6331 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6332 | 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] | 6333 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6334 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6335 | |
| 6336 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6337 | |
| 6338 | var PDU_BSSAP rx_bssap; |
| 6339 | var octetstring ho_command_str; |
| 6340 | |
| 6341 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6342 | |
| 6343 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6344 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6345 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6346 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6347 | |
| 6348 | var GsmArfcn arfcn; |
| 6349 | var RslChannelNr actual_new_chan_nr; |
| 6350 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6351 | actual_new_chan_nr, arfcn); |
| 6352 | |
| 6353 | if (actual_new_chan_nr != new_chan_nr) { |
| 6354 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6355 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6356 | setverdict(fail); |
| 6357 | return; |
| 6358 | } |
| 6359 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6360 | |
| 6361 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6362 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6363 | * on the new lchan. */ |
| 6364 | |
| 6365 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6366 | |
| 6367 | /* Did osmo-bsc also send a Clear Request? */ |
| 6368 | timer T := 0.5; |
| 6369 | T.start; |
| 6370 | alt { |
| 6371 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6372 | [] T.timeout { } |
| 6373 | } |
| 6374 | |
| 6375 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 6376 | * asked for it, this is a Handover Failure after all). */ |
| 6377 | |
| 6378 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6379 | var BssmapCause cause := enum2int(cause_val); |
| 6380 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6381 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6382 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6383 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6384 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6385 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6386 | } |
| 6387 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 6388 | var MSC_ConnHdlr vc_conn; |
| 6389 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6390 | |
| 6391 | f_init(1, true); |
| 6392 | f_sleep(1.0); |
| 6393 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6394 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6395 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6396 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6397 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6398 | |
| 6399 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 6400 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6401 | |
| 6402 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6403 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6404 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6405 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6406 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6407 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6408 | } |
| 6409 | |
| 6410 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 6411 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 6412 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6413 | f_rslem_register(0, new_chan_nr); |
| 6414 | g_chan_nr := new_chan_nr; |
| 6415 | f_sleep(1.0); |
| 6416 | |
| 6417 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6418 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6419 | activate(as_Media()); |
| 6420 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6421 | 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] | 6422 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6423 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6424 | |
| 6425 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6426 | |
| 6427 | var PDU_BSSAP rx_bssap; |
| 6428 | var octetstring ho_command_str; |
| 6429 | |
| 6430 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6431 | |
| 6432 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6433 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6434 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6435 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6436 | |
| 6437 | var GsmArfcn arfcn; |
| 6438 | var RslChannelNr actual_new_chan_nr; |
| 6439 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6440 | actual_new_chan_nr, arfcn); |
| 6441 | |
| 6442 | if (actual_new_chan_nr != new_chan_nr) { |
| 6443 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6444 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6445 | setverdict(fail); |
| 6446 | return; |
| 6447 | } |
| 6448 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6449 | |
| 6450 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6451 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6452 | * on the new lchan. */ |
| 6453 | |
| 6454 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6455 | |
| 6456 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6457 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6458 | |
| 6459 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6460 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6461 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6462 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6463 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6464 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6465 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6466 | f_sleep(1.0); |
| 6467 | } |
| 6468 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 6469 | var MSC_ConnHdlr vc_conn; |
| 6470 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6471 | |
| 6472 | f_init(1, true); |
| 6473 | f_sleep(1.0); |
| 6474 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6475 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6476 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6477 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6478 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6479 | |
| 6480 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 6481 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6482 | |
| 6483 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6484 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6485 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6486 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6487 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6488 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6489 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6490 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6491 | type record of charstring Commands; |
| 6492 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6493 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6494 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6495 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6496 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6497 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6498 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6499 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6500 | } |
| 6501 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 6502 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 6503 | { |
| 6504 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 6505 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 6506 | f_vty_transceive(pt, cmds[i]); |
| 6507 | } |
| 6508 | f_vty_transceive(pt, "end"); |
| 6509 | } |
| 6510 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6511 | private function f_probe_for_handover(charstring log_label, |
| 6512 | charstring log_descr, |
| 6513 | charstring handover_vty_cmd, |
| 6514 | boolean expect_handover, |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6515 | boolean is_inter_bsc_handover := false, |
| 6516 | template uint3_t expect_target_tsc := ?) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6517 | runs on MSC_ConnHdlr |
| 6518 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 6519 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 6520 | * lchans to be established on bts 1 or bts 2. */ |
| 6521 | f_rslem_suspend(RSL1_PROC); |
| 6522 | f_rslem_suspend(RSL2_PROC); |
| 6523 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6524 | var RSL_Message rsl; |
| 6525 | |
| 6526 | var charstring log_msg := " (expecting handover)" |
| 6527 | if (not expect_handover) { |
| 6528 | log_msg := " (expecting NO handover)"; |
| 6529 | } |
| 6530 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 6531 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 6532 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6533 | timer T := 2.0; |
| 6534 | T.start; |
| 6535 | |
| 6536 | alt { |
| 6537 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 6538 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 6539 | log("Rx L3 from net: ", l3); |
| 6540 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 6541 | var RslChannelNr new_chan_nr; |
| 6542 | var GsmArfcn arfcn; |
| 6543 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 6544 | new_chan_nr, arfcn); |
| 6545 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 6546 | log(l3.msgs.rrm.handoverCommand); |
| 6547 | |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6548 | /* Verify correct TSC in handoverCommand */ |
| 6549 | var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.handoverCommand.channelDescription2); |
| 6550 | if (not match(got_tsc, expect_target_tsc)) { |
| 6551 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 6552 | expect_target_tsc, " got ", got_tsc); |
| 6553 | mtc.stop; |
| 6554 | } else { |
| 6555 | log("handoverCommand: verified TSC = ", got_tsc, " (matches ", |
| 6556 | expect_target_tsc, ")"); |
| 6557 | } |
| 6558 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6559 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 6560 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 6561 | * anyway. */ |
| 6562 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 6563 | f_rslem_resume(RSL1_PROC); |
| 6564 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 6565 | f_rslem_resume(RSL2_PROC); |
| 6566 | |
| 6567 | if (expect_handover and not is_inter_bsc_handover) { |
| 6568 | setverdict(pass); |
| 6569 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 6570 | } else { |
| 6571 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 6572 | & log_label & ": " & log_descr); |
| 6573 | } |
| 6574 | |
| 6575 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 6576 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 6577 | * Handover Failure. */ |
| 6578 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6579 | |
| 6580 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 6581 | f_sleep(0.5); |
| 6582 | RSL1.clear; |
| 6583 | RSL2.clear; |
| 6584 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 6585 | break; |
| 6586 | } else { |
| 6587 | repeat; |
| 6588 | } |
| 6589 | } |
| 6590 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 6591 | if (expect_handover and is_inter_bsc_handover) { |
| 6592 | setverdict(pass); |
| 6593 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 6594 | } else { |
| 6595 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 6596 | & log_label & ": " & log_descr); |
| 6597 | } |
| 6598 | |
| 6599 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 6600 | |
| 6601 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 6602 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 6603 | * setting a short timeout and waiting is the only way. */ |
| 6604 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 6605 | f_sleep(1.5); |
| 6606 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 6607 | |
| 6608 | break; |
| 6609 | } |
| 6610 | [] T.timeout { |
| 6611 | if (expect_handover) { |
| 6612 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 6613 | & log_label & ": " & log_descr); |
| 6614 | } else { |
| 6615 | setverdict(pass); |
| 6616 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 6617 | } |
| 6618 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 6619 | break; |
| 6620 | } |
| 6621 | } |
| 6622 | |
| 6623 | f_rslem_resume(RSL1_PROC); |
| 6624 | f_rslem_resume(RSL2_PROC); |
| 6625 | f_sleep(3.0); |
| 6626 | RSL.clear; |
| 6627 | |
| 6628 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 6629 | } |
| 6630 | |
| 6631 | /* Test the effect of various neighbor configuration scenarios: |
| 6632 | * |
| 6633 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 6634 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 6635 | */ |
| 6636 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 6637 | g_pars := f_gen_test_hdlr_pars(); |
| 6638 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6639 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6640 | |
| 6641 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6642 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6643 | |
| 6644 | /* Establish lchan at bts 0 */ |
| 6645 | f_establish_fully(ass_cmd, exp_compl); |
| 6646 | |
| 6647 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 6648 | f_vty_enter_cfg_network(BSCVTY); |
| 6649 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 6650 | f_vty_transceive(BSCVTY, "end"); |
| 6651 | } |
| 6652 | |
| 6653 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 6654 | f_tc_ho_neighbor_config_start(); |
| 6655 | |
| 6656 | /* |
| 6657 | * bts 0 ARFCN 871 BSIC 10 |
| 6658 | * bts 1 ARFCN 871 BSIC 11 |
| 6659 | * bts 2 ARFCN 871 BSIC 12 |
| 6660 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6661 | */ |
| 6662 | |
| 6663 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6664 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6665 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 6666 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6667 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6668 | |
| 6669 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 6670 | "handover any to arfcn 13 bsic 39", |
| 6671 | false); |
| 6672 | |
| 6673 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 6674 | "handover any to arfcn 871 bsic 12", |
| 6675 | false); |
| 6676 | |
| 6677 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 6678 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6679 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6680 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6681 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 6682 | var MSC_ConnHdlr vc_conn; |
| 6683 | f_init(3, true, guard_timeout := 60.0); |
| 6684 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6685 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6686 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 6687 | vc_conn.done; |
| 6688 | |
| 6689 | /* f_tc_ho_neighbor_config_start() */ |
| 6690 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6691 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6692 | |
| 6693 | /* 1.a */ |
| 6694 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6695 | * handover quickly by sending a Handover Failure message. */ |
| 6696 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6697 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6698 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6699 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6700 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6701 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6702 | |
| 6703 | /* 1.b */ |
| 6704 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6705 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6706 | |
| 6707 | /* 1.c */ |
| 6708 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6709 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6710 | |
| 6711 | /* 1.d */ |
| 6712 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6713 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6714 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6715 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6716 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6717 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6718 | |
| 6719 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6720 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6721 | } |
| 6722 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6723 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 6724 | f_tc_ho_neighbor_config_start(); |
| 6725 | |
| 6726 | /* |
| 6727 | * bts 0 ARFCN 871 BSIC 10 |
| 6728 | * bts 1 ARFCN 871 BSIC 11 |
| 6729 | * bts 2 ARFCN 871 BSIC 12 |
| 6730 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6731 | */ |
| 6732 | |
| 6733 | 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] | 6734 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6735 | f_sleep(0.5); |
| 6736 | |
| 6737 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 6738 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6739 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6740 | |
| 6741 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6742 | "handover any to arfcn 871 bsic 12", |
| 6743 | false); |
| 6744 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6745 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 6746 | var MSC_ConnHdlr vc_conn; |
| 6747 | f_init(3, true, guard_timeout := 50.0); |
| 6748 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6749 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6750 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 6751 | vc_conn.done; |
| 6752 | |
| 6753 | /* f_tc_ho_neighbor_config_start() */ |
| 6754 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6755 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6756 | |
| 6757 | /* 2.a */ |
| 6758 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6759 | * handover quickly by sending a Handover Failure message. */ |
| 6760 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6761 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6762 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6763 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6764 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6765 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6766 | |
| 6767 | /* 2.b */ |
| 6768 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6769 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6770 | |
| 6771 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6772 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6773 | } |
| 6774 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6775 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 6776 | f_tc_ho_neighbor_config_start(); |
| 6777 | |
| 6778 | /* |
| 6779 | * bts 0 ARFCN 871 BSIC 10 |
| 6780 | * bts 1 ARFCN 871 BSIC 11 |
| 6781 | * bts 2 ARFCN 871 BSIC 12 |
| 6782 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6783 | */ |
| 6784 | |
| 6785 | 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] | 6786 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6787 | f_sleep(0.5); |
| 6788 | |
| 6789 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6790 | "handover any to arfcn 871 bsic 11", |
| 6791 | false); |
| 6792 | 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", |
| 6793 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6794 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6795 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6796 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 6797 | var MSC_ConnHdlr vc_conn; |
| 6798 | f_init(3, true, guard_timeout := 50.0); |
| 6799 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6800 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6801 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 6802 | vc_conn.done; |
| 6803 | |
| 6804 | /* f_tc_ho_neighbor_config_start() */ |
| 6805 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6806 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6807 | |
| 6808 | /* 3.a */ |
| 6809 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6810 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6811 | |
| 6812 | /* 3.b */ |
| 6813 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6814 | * handover quickly by sending a Handover Failure message. */ |
| 6815 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6816 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6817 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6818 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6819 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 6820 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6821 | |
| 6822 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6823 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6824 | } |
| 6825 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6826 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 6827 | f_tc_ho_neighbor_config_start(); |
| 6828 | |
| 6829 | /* |
| 6830 | * bts 0 ARFCN 871 BSIC 10 |
| 6831 | * bts 1 ARFCN 871 BSIC 11 |
| 6832 | * bts 2 ARFCN 871 BSIC 12 |
| 6833 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6834 | */ |
| 6835 | |
| 6836 | 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] | 6837 | 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] | 6838 | f_sleep(0.5); |
| 6839 | |
| 6840 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6841 | "handover any to arfcn 871 bsic 11", |
| 6842 | false); |
| 6843 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6844 | "handover any to arfcn 871 bsic 12", |
| 6845 | false); |
| 6846 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 6847 | "handover any to arfcn 123 bsic 45", |
| 6848 | true, true); |
| 6849 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6850 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 6851 | var MSC_ConnHdlr vc_conn; |
| 6852 | f_init(3, true, guard_timeout := 50.0); |
| 6853 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6854 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6855 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 6856 | vc_conn.done; |
| 6857 | |
| 6858 | /* f_tc_ho_neighbor_config_start() */ |
| 6859 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6860 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6861 | |
| 6862 | /* 4.a */ |
| 6863 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6864 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6865 | |
| 6866 | /* 4.b */ |
| 6867 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6868 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6869 | |
| 6870 | /* 4.c */ |
| 6871 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6872 | * handover quickly by timing out after the Handover Required message */ |
| 6873 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6874 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6875 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6876 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6877 | |
| 6878 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6879 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6880 | } |
| 6881 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6882 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 6883 | f_tc_ho_neighbor_config_start(); |
| 6884 | |
| 6885 | /* |
| 6886 | * bts 0 ARFCN 871 BSIC 10 |
| 6887 | * bts 1 ARFCN 871 BSIC 11 |
| 6888 | * bts 2 ARFCN 871 BSIC 12 |
| 6889 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6890 | */ |
| 6891 | |
| 6892 | 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] | 6893 | 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] | 6894 | f_sleep(0.5); |
| 6895 | |
| 6896 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 6897 | "handover any to arfcn 871 bsic 12", |
| 6898 | true, true); |
| 6899 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6900 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 6901 | var MSC_ConnHdlr vc_conn; |
| 6902 | f_init(3, true); |
| 6903 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6904 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6905 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 6906 | vc_conn.done; |
| 6907 | |
| 6908 | /* f_tc_ho_neighbor_config_start() */ |
| 6909 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6910 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6911 | |
| 6912 | /* 5 */ |
| 6913 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6914 | * handover quickly by timing out after the Handover Required message */ |
| 6915 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6916 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6917 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6918 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6919 | |
| 6920 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6921 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6922 | } |
| 6923 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6924 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 6925 | f_tc_ho_neighbor_config_start(); |
| 6926 | |
| 6927 | /* |
| 6928 | * bts 0 ARFCN 871 BSIC 10 |
| 6929 | * bts 1 ARFCN 871 BSIC 11 |
| 6930 | * bts 2 ARFCN 871 BSIC 12 |
| 6931 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6932 | */ |
| 6933 | |
| 6934 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 6935 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6936 | 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] | 6937 | f_sleep(0.5); |
| 6938 | |
| 6939 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 6940 | "handover any to arfcn 871 bsic 12", |
| 6941 | false); |
| 6942 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6943 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 6944 | var MSC_ConnHdlr vc_conn; |
| 6945 | f_init(3, true); |
| 6946 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6947 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6948 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 6949 | vc_conn.done; |
| 6950 | |
| 6951 | /* f_tc_ho_neighbor_config_start() */ |
| 6952 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6953 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6954 | |
| 6955 | /* 6.a */ |
| 6956 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6957 | * handover quickly by timing out after the Handover Required message */ |
| 6958 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6959 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6960 | |
| 6961 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6962 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6963 | } |
| 6964 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6965 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 6966 | f_tc_ho_neighbor_config_start(); |
| 6967 | |
| 6968 | /* |
| 6969 | * bts 0 ARFCN 871 BSIC 10 |
| 6970 | * bts 1 ARFCN 871 BSIC 11 |
| 6971 | * bts 2 ARFCN 871 BSIC 12 |
| 6972 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6973 | */ |
| 6974 | |
| 6975 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 6976 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6977 | 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] | 6978 | f_sleep(0.5); |
| 6979 | |
| 6980 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 6981 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6982 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6983 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 6984 | "handover any to arfcn 123 bsic 45", |
| 6985 | true, true); |
| 6986 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6987 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 6988 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 6989 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6990 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6991 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6992 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 6993 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6994 | |
| 6995 | /* f_tc_ho_neighbor_config_start() */ |
| 6996 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6997 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6998 | |
| 6999 | /* 7.a */ |
| 7000 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7001 | * handover quickly by sending a Handover Failure message. */ |
| 7002 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7003 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7004 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7005 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7006 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 7007 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7008 | |
| 7009 | /* 7.b */ |
| 7010 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7011 | * handover quickly by timing out after the Handover Required message */ |
| 7012 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7013 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7014 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7015 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7016 | |
| 7017 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7018 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7019 | } |
| 7020 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7021 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7022 | * BSSMAP Reset just because of that. */ |
| 7023 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 7024 | var default d; |
| 7025 | var integer i; |
| 7026 | var DchanTuple dt; |
| 7027 | |
| 7028 | f_init(); |
| 7029 | |
| 7030 | /* Wait for initial BSSMAP Reset to pass */ |
| 7031 | f_sleep(4.0); |
| 7032 | |
| 7033 | d := activate(no_bssmap_reset()); |
| 7034 | |
| 7035 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7036 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7037 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 7038 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7039 | /* Since we're doing a lot of runs, give each one a fresh |
| 7040 | * T_guard from the top. */ |
| 7041 | T_guard.start; |
| 7042 | |
| 7043 | /* Setup a BSSAP connection and clear it right away. This is |
| 7044 | * the MSC telling the BSC about a planned release, it's not an |
| 7045 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 7046 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7047 | |
| 7048 | /* MSC disconnects (RLSD). */ |
| 7049 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 7050 | } |
| 7051 | |
| 7052 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7053 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7054 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7055 | f_sleep(4.0); |
| 7056 | |
| 7057 | deactivate(d); |
| 7058 | f_shutdown_helper(); |
| 7059 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 7060 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7061 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7062 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 7063 | * the MSC. */ |
| 7064 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 7065 | var default d; |
| 7066 | var integer i; |
| 7067 | var DchanTuple dt; |
| 7068 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7069 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 7070 | var BssmapCause cause := enum2int(cause_val); |
| 7071 | |
| 7072 | f_init(); |
| 7073 | |
| 7074 | /* Wait for initial BSSMAP Reset to pass */ |
| 7075 | f_sleep(4.0); |
| 7076 | |
| 7077 | d := activate(no_bssmap_reset()); |
| 7078 | |
| 7079 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7080 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7081 | * Let's do it some more times for good measure. */ |
| 7082 | for (i := 0; i < 8; i := i+1) { |
| 7083 | /* Since we're doing a lot of runs, give each one a fresh |
| 7084 | * T_guard from the top. */ |
| 7085 | T_guard.start; |
| 7086 | |
| 7087 | /* Setup a BSSAP connection and clear it right away. This is |
| 7088 | * the MSC telling the BSC about a planned release, it's not an |
| 7089 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 7090 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7091 | |
| 7092 | /* Instruct BSC to clear channel */ |
| 7093 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7094 | |
| 7095 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 7096 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7097 | } |
| 7098 | |
| 7099 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7100 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7101 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7102 | f_sleep(4.0); |
| 7103 | |
| 7104 | deactivate(d); |
| 7105 | f_shutdown_helper(); |
| 7106 | } |
| 7107 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7108 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7109 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 7110 | * Release Ind on RSL. */ |
| 7111 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 7112 | var default d; |
| 7113 | var integer i; |
| 7114 | var DchanTuple dt; |
| 7115 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7116 | var integer j; |
| 7117 | |
| 7118 | f_init(); |
| 7119 | |
| 7120 | /* Wait for initial BSSMAP Reset to pass */ |
| 7121 | f_sleep(4.0); |
| 7122 | |
| 7123 | d := activate(no_bssmap_reset()); |
| 7124 | |
| 7125 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7126 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7127 | * Let's do it some more times for good measure. */ |
| 7128 | for (i := 0; i < 8; i := i+1) { |
| 7129 | /* Since we're doing a lot of runs, give each one a fresh |
| 7130 | * T_guard from the top. */ |
| 7131 | T_guard.start; |
| 7132 | |
| 7133 | /* Setup a BSSAP connection and clear it right away. This is |
| 7134 | * the MSC telling the BSC about a planned release, it's not an |
| 7135 | * erratic loss of a connection. */ |
| 7136 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 7137 | |
| 7138 | /* simulate RLL REL IND */ |
| 7139 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 7140 | |
| 7141 | /* expect Clear Request on MSC side */ |
| 7142 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 7143 | |
| 7144 | /* Instruct BSC to clear channel */ |
| 7145 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 7146 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7147 | |
| 7148 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 7149 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7150 | } |
| 7151 | |
| 7152 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7153 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7154 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7155 | f_sleep(4.0); |
| 7156 | |
| 7157 | deactivate(d); |
| 7158 | f_shutdown_helper(); |
| 7159 | } |
| 7160 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7161 | /*********************************************************************** |
| 7162 | * IPA style dynamic PDCH |
| 7163 | ***********************************************************************/ |
| 7164 | |
| 7165 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7166 | template (omit) RSL_Cause nack := omit) |
| 7167 | runs on test_CT { |
| 7168 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7169 | var RSL_Message rsl_unused; |
| 7170 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7171 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 7172 | /* expect the BSC to issue the related RSL command */ |
| 7173 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7174 | if (istemplatekind(nack, "omit")) { |
| 7175 | /* respond with a related acknowledgement */ |
| 7176 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7177 | } else { |
| 7178 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 7179 | } |
| 7180 | } |
| 7181 | |
| 7182 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7183 | template (omit) RSL_Cause nack := omit) |
| 7184 | runs on test_CT { |
| 7185 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7186 | var RSL_Message rsl_unused; |
| 7187 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7188 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 7189 | /* expect the BSC to issue the related RSL command */ |
| 7190 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 7191 | if (istemplatekind(nack, "omit")) { |
| 7192 | /* respond with a related acknowledgement */ |
| 7193 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 7194 | } else { |
| 7195 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 7196 | } |
| 7197 | } |
| 7198 | |
| 7199 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 7200 | runs on test_CT return charstring { |
| 7201 | var charstring cmd, resp; |
| 7202 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 7203 | 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] | 7204 | } |
| 7205 | |
| 7206 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7207 | template charstring exp) |
| 7208 | runs on test_CT { |
| 7209 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 7210 | if (not match(mode, exp)) { |
| 7211 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 7212 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7213 | } |
| 7214 | } |
| 7215 | |
| 7216 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 7217 | runs on test_CT { |
| 7218 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 7219 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 7220 | f_vty_transceive(BSCVTY, "end"); |
| 7221 | } |
| 7222 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7223 | |
| 7224 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 7225 | var integer i; |
| 7226 | for (i := 0; i < 8; i := i + 1) { |
| 7227 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 7228 | } |
| 7229 | } |
| 7230 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7231 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 7232 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 7233 | private const charstring PDCH_MODE := "PDCH mode"; |
| 7234 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7235 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7236 | |
| 7237 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 7238 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 7239 | var RSL_Message rsl_unused; |
| 7240 | |
| 7241 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7242 | f_init_vty(); |
| 7243 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7244 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7245 | |
| 7246 | f_init(1, false); |
| 7247 | f_sleep(1.0); |
| 7248 | |
| 7249 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7250 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7251 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7252 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7253 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7254 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7255 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7256 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7257 | 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] | 7258 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7259 | |
| 7260 | /* De-activate it via VTY */ |
| 7261 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7262 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7263 | 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] | 7264 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7265 | |
| 7266 | /* re-activate it via VTY */ |
| 7267 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 7268 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7269 | 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] | 7270 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7271 | |
| 7272 | /* and finally de-activate it again */ |
| 7273 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7274 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7275 | 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] | 7276 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7277 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7278 | /* clean up config */ |
| 7279 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7280 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7281 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7282 | } |
| 7283 | |
| 7284 | /* Test IPA PDCH activation NACK */ |
| 7285 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 7286 | var RSL_Message rsl_unused; |
| 7287 | |
| 7288 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7289 | f_init_vty(); |
| 7290 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7291 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7292 | |
| 7293 | f_init(1, false); |
| 7294 | f_sleep(1.0); |
| 7295 | |
| 7296 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7297 | |
| 7298 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7299 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7300 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7301 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7302 | f_sleep(1.0); |
| 7303 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7304 | |
| 7305 | /* De-activate it via VTY */ |
| 7306 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7307 | f_sleep(1.0); |
| 7308 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7309 | |
| 7310 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 7311 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 7312 | f_sleep(1.0); |
| 7313 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7314 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7315 | /* clean up config */ |
| 7316 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7317 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7318 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7319 | } |
| 7320 | |
| 7321 | |
| 7322 | /*********************************************************************** |
| 7323 | * Osmocom style dynamic PDCH |
| 7324 | ***********************************************************************/ |
| 7325 | |
| 7326 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7327 | template (omit) RSL_Cause nack := omit) |
| 7328 | runs on test_CT { |
| 7329 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7330 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7331 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7332 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7333 | /* expect the BSC to issue the related RSL command */ |
| 7334 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 7335 | if (istemplatekind(nack, "omit")) { |
| 7336 | /* respond with a related acknowledgement */ |
| 7337 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7338 | } else { |
| 7339 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 7340 | } |
| 7341 | } |
| 7342 | |
| 7343 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7344 | template (omit) RSL_Cause nack := omit) |
| 7345 | runs on test_CT { |
| 7346 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7347 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7348 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7349 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7350 | /* expect the BSC to issue the related RSL command */ |
| 7351 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 7352 | if (istemplatekind(nack, "omit")) { |
| 7353 | /* respond with a related acknowledgement */ |
| 7354 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 7355 | } else { |
| 7356 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 7357 | } |
| 7358 | } |
| 7359 | |
| 7360 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 7361 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 7362 | var RSL_Message rsl_unused; |
| 7363 | |
| 7364 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7365 | f_init_vty(); |
| 7366 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7367 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7368 | |
| 7369 | f_init(1, false); |
| 7370 | f_sleep(1.0); |
| 7371 | |
| 7372 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7373 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7374 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7375 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7376 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7377 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7378 | |
| 7379 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7380 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7381 | 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] | 7382 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7383 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7384 | /* clean up config */ |
| 7385 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7386 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7387 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7388 | } |
| 7389 | |
| 7390 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 7391 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 7392 | var RSL_Message rsl_unused; |
| 7393 | |
| 7394 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7395 | f_init_vty(); |
| 7396 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7397 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7398 | |
| 7399 | f_init(1, false); |
| 7400 | f_sleep(1.0); |
| 7401 | |
| 7402 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7403 | |
| 7404 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7405 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7406 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7407 | |
| 7408 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 7409 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7410 | f_sleep(1.0); |
| 7411 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7412 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7413 | /* clean up config */ |
| 7414 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7415 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7416 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7417 | } |
| 7418 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7419 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 7420 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 7421 | var RSL_Message rsl_unused, rsl_msg; |
| 7422 | var DchanTuple dt; |
| 7423 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7424 | |
| 7425 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7426 | f_init_vty(); |
| 7427 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7428 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7429 | |
| 7430 | f_init(1, false); |
| 7431 | f_sleep(1.0); |
| 7432 | |
| 7433 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7434 | |
| 7435 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7436 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7437 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7438 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7439 | |
| 7440 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7441 | f_sleep(1.0); |
| 7442 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7443 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7444 | |
| 7445 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7446 | * on CCCH+SDCCH4+CBCH) */ |
| 7447 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7448 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7449 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7450 | } |
| 7451 | |
| 7452 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7453 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7454 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7455 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7456 | |
| 7457 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7458 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7459 | |
| 7460 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7461 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7462 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7463 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7464 | |
| 7465 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7466 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7467 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7468 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7469 | |
| 7470 | /* Instruct BSC to clear channel */ |
| 7471 | var BssmapCause cause := 0; |
| 7472 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7473 | f_exp_chan_rel_and_clear(dt, 0); |
| 7474 | |
| 7475 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7476 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7477 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7478 | f_sleep(1.0); |
| 7479 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7480 | |
| 7481 | /* clean up config */ |
| 7482 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7483 | |
| 7484 | f_shutdown_helper(); |
| 7485 | } |
| 7486 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7487 | /* Validate all 8 subslots of a dynamics TS configured as SDCCH8 are used */ |
| 7488 | testcase TC_dyn_ts_sdcch8_all_subslots_used() runs on test_CT { |
| 7489 | var ASP_RSL_Unitdata rsl_ud; |
| 7490 | var integer i; |
| 7491 | var integer chreq_total, chreq_nochan; |
| 7492 | |
| 7493 | f_init_vty(); |
| 7494 | for (i := 1; i < 8; i := i + 1) { |
| 7495 | if (i == 2) { |
| 7496 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7497 | } else { |
| 7498 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7499 | } |
| 7500 | } |
| 7501 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7502 | |
| 7503 | f_init(1); |
| 7504 | |
| 7505 | /* The dyn TS want to activate PDCH mode, ACK that. */ |
| 7506 | var RslChannelNr chan_nr; |
| 7507 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7508 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7509 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7510 | |
| 7511 | f_sleep(1.0); |
| 7512 | |
| 7513 | /* Exhaust all dedicated SDCCH lchans. |
| 7514 | /* GSM 44.018 Table 9.1.8.2: |
| 7515 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 7516 | */ |
| 7517 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
| 7518 | f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 7519 | } |
| 7520 | |
| 7521 | /* Only the dyn TS is still available. Its first lchan gets converted to SDCCH8 */ |
| 7522 | f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 7523 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 7524 | for (i := 0; i < 7; i := i+1) { |
| 7525 | f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 7526 | } |
| 7527 | |
| 7528 | /* clean up config */ |
| 7529 | f_ts_reset_chcomb(0); |
| 7530 | |
| 7531 | f_shutdown_helper(); |
| 7532 | } |
| 7533 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7534 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 7535 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 7536 | it as TCH directly instead. SYS#5309. */ |
| 7537 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 7538 | var RSL_Message rsl_unused, rsl_msg; |
| 7539 | var DchanTuple dt; |
| 7540 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7541 | var integer i; |
| 7542 | |
| 7543 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7544 | f_init_vty(); |
| 7545 | for (i := 1; i < 8; i := i + 1) { |
| 7546 | if (i == 6) { |
| 7547 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7548 | } else { |
| 7549 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7550 | } |
| 7551 | } |
| 7552 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7553 | |
| 7554 | f_init(1, false); |
| 7555 | f_sleep(1.0); |
| 7556 | |
| 7557 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7558 | |
| 7559 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7560 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7561 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7562 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7563 | |
| 7564 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7565 | f_sleep(1.0); |
| 7566 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7567 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7568 | |
| 7569 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7570 | * on CCCH+SDCCH4+CBCH) */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7571 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7572 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7573 | dt := f_est_dchan(ra, i, '00010203040506'O); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7574 | } |
| 7575 | |
| 7576 | /* Now the dyn ts is selected. First PDCH is released, then TCH chan is activated */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7577 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int(ra) + i, 1), 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7578 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7579 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7580 | |
| 7581 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7582 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7583 | |
| 7584 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7585 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7586 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7587 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7588 | |
| 7589 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7590 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7591 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7592 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7593 | |
| 7594 | /* Instruct BSC to clear channel */ |
| 7595 | var BssmapCause cause := 0; |
| 7596 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7597 | f_exp_chan_rel_and_clear(dt, 0); |
| 7598 | |
| 7599 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7600 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7601 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7602 | f_sleep(1.0); |
| 7603 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7604 | |
| 7605 | /* clean up config */ |
| 7606 | f_ts_reset_chcomb(0); |
| 7607 | /* TODO: clean up other channels? */ |
| 7608 | |
| 7609 | f_shutdown_helper(); |
| 7610 | } |
| 7611 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7612 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 7613 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 7614 | var RSL_Message rsl_unused, rsl_msg; |
| 7615 | var DchanTuple dt; |
| 7616 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7617 | var GsmRrMessage rr; |
| 7618 | |
| 7619 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7620 | f_init_vty(); |
| 7621 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7622 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7623 | |
| 7624 | f_init(1, false); |
| 7625 | f_sleep(1.0); |
| 7626 | |
| 7627 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7628 | |
| 7629 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7630 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7631 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7632 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7633 | |
| 7634 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7635 | f_sleep(1.0); |
| 7636 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7637 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7638 | |
| 7639 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7640 | * on CCCH+SDCCH4+CBCH) */ |
| 7641 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7642 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7643 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7644 | } |
| 7645 | |
| 7646 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7647 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7648 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7649 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7650 | |
| 7651 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7652 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7653 | |
| 7654 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7655 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7656 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7657 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 7658 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 7659 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 7660 | } |
| 7661 | |
| 7662 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 7663 | |
| 7664 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7665 | /* rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7666 | * f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7667 | * f_sleep(1.0); |
| 7668 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 7669 | */ |
| 7670 | |
| 7671 | /* clean up config */ |
| 7672 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7673 | |
| 7674 | f_shutdown_helper(); |
| 7675 | } |
| 7676 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7677 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 7678 | 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] | 7679 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7680 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7681 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7682 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7683 | } |
| 7684 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7685 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 7686 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 7687 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 7688 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7689 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7690 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7691 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7692 | } |
| 7693 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7694 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 7695 | the BTS does autonomous MS power control loop */ |
| 7696 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 7697 | var MSC_ConnHdlr vc_conn; |
| 7698 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7699 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 7700 | pars.exp_ms_power_params := true; |
| 7701 | |
| 7702 | f_init(1, true); |
| 7703 | f_sleep(1.0); |
| 7704 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 7705 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7706 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7707 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7708 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 7709 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 7710 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 7711 | f_init(1); |
| 7712 | |
| 7713 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 7714 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 7715 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 7716 | |
| 7717 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
| 7718 | var template RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
| 7719 | chan_nr := t_RslChanNr_BCCH(0), |
| 7720 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 7721 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
| 7722 | var RSL_Message unused := f_exp_ipa_rx(0, tr_rsl_pdu); |
| 7723 | |
| 7724 | /* Additionally verify the applied value over the CTRL interface */ |
| 7725 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 7726 | if (cred != int2str(red)) { |
| 7727 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 7728 | cred, " (expected ", red, ")"); |
| 7729 | } |
| 7730 | } |
| 7731 | |
| 7732 | f_shutdown_helper(); |
| 7733 | } |
| 7734 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7735 | /*********************************************************************** |
| 7736 | * MSC Pooling |
| 7737 | ***********************************************************************/ |
| 7738 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7739 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 7740 | ts_MI_TMSI_LV(tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v, nri_bitlen := nri_bitlen)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7741 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7742 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7743 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7744 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7745 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7746 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 7747 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7748 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7749 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 7750 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7751 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7752 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7753 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7754 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7755 | break; |
| 7756 | } |
| 7757 | } |
| 7758 | } |
| 7759 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7760 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
| 7761 | template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7762 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7763 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7764 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 7765 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7766 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7767 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7768 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7769 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7770 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7771 | } |
| 7772 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7773 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7774 | /* Also drop the SCCP connection */ |
| 7775 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7776 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7777 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7778 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7779 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7780 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7781 | } |
| 7782 | } |
| 7783 | } |
| 7784 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7785 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 7786 | 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] | 7787 | runs on MSC_ConnHdlr { |
| 7788 | timer T := 10.0; |
| 7789 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 7790 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7791 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7792 | f_create_bssmap_exp(l3_enc); |
| 7793 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7794 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 7795 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7796 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 7797 | */ |
| 7798 | var RSL_Message rx_rsl; |
| 7799 | var GsmRrMessage rr; |
| 7800 | |
| 7801 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7802 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7803 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7804 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7805 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 7806 | */ |
| 7807 | timer Tt := 10.0; |
| 7808 | |
| 7809 | /* request a channel to be established */ |
| 7810 | Tt.start; |
| 7811 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7812 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7813 | Tt.stop; |
| 7814 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7815 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7816 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 7817 | mtc.stop; |
| 7818 | } |
| 7819 | [] Tt.timeout { |
| 7820 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 7821 | mtc.stop; |
| 7822 | } |
| 7823 | } |
| 7824 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 7825 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7826 | rsl_pt.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7827 | |
| 7828 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7829 | if (expect_bssmap_l3) { |
| 7830 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 7831 | var template PDU_BSSAP exp_l3_compl; |
| 7832 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 7833 | if (g_pars.aoip == false) { |
| 7834 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 7835 | } else { |
| 7836 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 7837 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7838 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7839 | var PDU_BSSAP bssap; |
| 7840 | T.start; |
| 7841 | alt { |
| 7842 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 7843 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 7844 | log("rx exp_l3_compl = ", bssap); |
| 7845 | } |
| 7846 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 7847 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 7848 | } |
| 7849 | [] T.timeout { |
| 7850 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 7851 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7852 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7853 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7854 | /* start ciphering, if requested */ |
| 7855 | if (ispresent(g_pars.encr)) { |
| 7856 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7857 | f_cipher_mode(g_pars.encr, rsl_pt := rsl_pt, rsl_proc_pt := rsl_proc_pt); |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7858 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7859 | } |
| 7860 | |
| 7861 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7862 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7863 | } |
| 7864 | setverdict(pass); |
| 7865 | f_sleep(1.0); |
| 7866 | } |
| 7867 | |
| 7868 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 7869 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7870 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7871 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7872 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7873 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7874 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7875 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7876 | } |
| 7877 | } |
| 7878 | |
| 7879 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 7880 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 7881 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7882 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 7883 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 7884 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 7885 | f_perform_compl_l3(RSL, RSL_PROC, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7886 | } |
| 7887 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 7888 | |
| 7889 | f_init(1, true); |
| 7890 | f_sleep(1.0); |
| 7891 | var MSC_ConnHdlr vc_conn; |
| 7892 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7893 | |
| 7894 | f_ctrs_msc_init(); |
| 7895 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7896 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 7897 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7898 | |
| 7899 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7900 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7901 | } |
| 7902 | |
| 7903 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 7904 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7905 | * just as well using only RSL. */ |
| 7906 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 7907 | |
| 7908 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7909 | f_sleep(1.0); |
| 7910 | |
| 7911 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7912 | * would be randomly affected by which other tests ran before this. */ |
| 7913 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7914 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7915 | f_ctrs_msc_init(); |
| 7916 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7917 | var MSC_ConnHdlr vc_conn1; |
| 7918 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7919 | pars1.mscpool.rsl_idx := 0; |
| 7920 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7921 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7922 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7923 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7924 | |
| 7925 | var MSC_ConnHdlr vc_conn2; |
| 7926 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7927 | pars2.mscpool.rsl_idx := 1; |
| 7928 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7929 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7930 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7931 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7932 | |
| 7933 | /* Test round-robin wrap to the first MSC */ |
| 7934 | var MSC_ConnHdlr vc_conn3; |
| 7935 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7936 | pars3.mscpool.rsl_idx := 2; |
| 7937 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7938 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7939 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7940 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7941 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7942 | } |
| 7943 | |
| 7944 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 7945 | * (configured in osmo-bsc.cfg). */ |
| 7946 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7947 | * just as well using only RSL. */ |
| 7948 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 7949 | |
| 7950 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7951 | f_sleep(1.0); |
| 7952 | |
| 7953 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7954 | * would be randomly affected by which other tests ran before this. */ |
| 7955 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7956 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7957 | f_ctrs_msc_init(); |
| 7958 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7959 | var MSC_ConnHdlr vc_conn1; |
| 7960 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7961 | pars1.mscpool.rsl_idx := 0; |
| 7962 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7963 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7964 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7965 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7966 | |
| 7967 | var MSC_ConnHdlr vc_conn2; |
| 7968 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7969 | pars2.mscpool.rsl_idx := 1; |
| 7970 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7971 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7972 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7973 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7974 | |
| 7975 | /* Test round-robin wrap to the first MSC */ |
| 7976 | var MSC_ConnHdlr vc_conn3; |
| 7977 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7978 | pars3.mscpool.rsl_idx := 2; |
| 7979 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7980 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7981 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7982 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7983 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7984 | } |
| 7985 | |
| 7986 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 7987 | * (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 |
| 7988 | * NULL-NRI setting is stronger than that. */ |
| 7989 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7990 | * just as well using only RSL. */ |
| 7991 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 7992 | |
| 7993 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7994 | f_sleep(1.0); |
| 7995 | |
| 7996 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7997 | * would be randomly affected by which other tests ran before this. */ |
| 7998 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7999 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8000 | f_ctrs_msc_init(); |
| 8001 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8002 | var MSC_ConnHdlr vc_conn1; |
| 8003 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8004 | pars1.mscpool.rsl_idx := 0; |
| 8005 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8006 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8007 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8008 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8009 | |
| 8010 | var MSC_ConnHdlr vc_conn2; |
| 8011 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8012 | pars2.mscpool.rsl_idx := 1; |
| 8013 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8014 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8015 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8016 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8017 | |
| 8018 | /* Test round-robin wrap to the first MSC */ |
| 8019 | var MSC_ConnHdlr vc_conn3; |
| 8020 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8021 | pars3.mscpool.rsl_idx := 2; |
| 8022 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8023 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8024 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8025 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8026 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8027 | } |
| 8028 | |
| 8029 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 8030 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 8031 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8032 | * just as well using only RSL. */ |
| 8033 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 8034 | |
| 8035 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8036 | f_sleep(1.0); |
| 8037 | |
| 8038 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8039 | * would be randomly affected by which other tests ran before this. */ |
| 8040 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8041 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8042 | f_ctrs_msc_init(); |
| 8043 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8044 | var MSC_ConnHdlr vc_conn1; |
| 8045 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8046 | pars1.mscpool.rsl_idx := 0; |
| 8047 | /* An NRI that is not assigned to any MSC */ |
| 8048 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 8049 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8050 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8051 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8052 | |
| 8053 | var MSC_ConnHdlr vc_conn2; |
| 8054 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8055 | pars2.mscpool.rsl_idx := 1; |
| 8056 | /* An NRI that is not assigned to any MSC */ |
| 8057 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 8058 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8059 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8060 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8061 | |
| 8062 | /* Test round-robin wrap to the first MSC */ |
| 8063 | var MSC_ConnHdlr vc_conn3; |
| 8064 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8065 | pars3.mscpool.rsl_idx := 2; |
| 8066 | /* An NRI that is not assigned to any MSC */ |
| 8067 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 8068 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8069 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8070 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8071 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8072 | } |
| 8073 | |
| 8074 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 8075 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 8076 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8077 | * just as well using only RSL. */ |
| 8078 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 8079 | |
| 8080 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8081 | f_sleep(1.0); |
| 8082 | |
| 8083 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8084 | * would be randomly affected by which other tests ran before this. */ |
| 8085 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8086 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8087 | f_ctrs_msc_init(); |
| 8088 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8089 | var MSC_ConnHdlr vc_conn1; |
| 8090 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8091 | pars1.mscpool.rsl_idx := 0; |
| 8092 | /* An NRI that is assigned to an unconnected MSC */ |
| 8093 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 8094 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8095 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8096 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8097 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8098 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8099 | |
| 8100 | var MSC_ConnHdlr vc_conn2; |
| 8101 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8102 | pars2.mscpool.rsl_idx := 1; |
| 8103 | /* An NRI that is assigned to an unconnected MSC */ |
| 8104 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 8105 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8106 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8107 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8108 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 8109 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8110 | |
| 8111 | /* Test round-robin wrap to the first MSC */ |
| 8112 | var MSC_ConnHdlr vc_conn3; |
| 8113 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8114 | pars3.mscpool.rsl_idx := 2; |
| 8115 | /* An NRI that is assigned to an unconnected MSC */ |
| 8116 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 8117 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8118 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8119 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8120 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8121 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8122 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8123 | } |
| 8124 | |
| 8125 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 8126 | * osmo-bsc.cfg). */ |
| 8127 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8128 | * just as well using only RSL. */ |
| 8129 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 8130 | |
| 8131 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8132 | f_sleep(1.0); |
| 8133 | |
| 8134 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 8135 | * this is not using round-robin. */ |
| 8136 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8137 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8138 | f_ctrs_msc_init(); |
| 8139 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8140 | var MSC_ConnHdlr vc_conn1; |
| 8141 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8142 | pars1.mscpool.rsl_idx := 0; |
| 8143 | /* An NRI of the second MSC's range (256-511) */ |
| 8144 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 8145 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8146 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8147 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8148 | |
| 8149 | var MSC_ConnHdlr vc_conn2; |
| 8150 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8151 | pars2.mscpool.rsl_idx := 1; |
| 8152 | /* An NRI of the second MSC's range (256-511) */ |
| 8153 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 8154 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8155 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8156 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8157 | |
| 8158 | var MSC_ConnHdlr vc_conn3; |
| 8159 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8160 | pars3.mscpool.rsl_idx := 2; |
| 8161 | /* An NRI of the second MSC's range (256-511) */ |
| 8162 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 8163 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8164 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8165 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8166 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8167 | } |
| 8168 | |
| 8169 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 8170 | * while a round-robin remains unaffected by that. */ |
| 8171 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8172 | * just as well using only RSL. */ |
| 8173 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 8174 | |
| 8175 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8176 | f_sleep(1.0); |
| 8177 | |
| 8178 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 8179 | * this is not using round-robin. */ |
| 8180 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 8181 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8182 | f_ctrs_msc_init(); |
| 8183 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8184 | var MSC_ConnHdlr vc_conn1; |
| 8185 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8186 | pars1.mscpool.rsl_idx := 0; |
| 8187 | /* An NRI of the third MSC's range (512-767) */ |
| 8188 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 8189 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8190 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8191 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8192 | |
| 8193 | var MSC_ConnHdlr vc_conn2; |
| 8194 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8195 | pars2.mscpool.rsl_idx := 1; |
| 8196 | /* An NRI of the third MSC's range (512-767) */ |
| 8197 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 8198 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8199 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8200 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8201 | |
| 8202 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 8203 | var MSC_ConnHdlr vc_conn3; |
| 8204 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8205 | pars3.mscpool.rsl_idx := 2; |
| 8206 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 8207 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8208 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8209 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8210 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8211 | } |
| 8212 | |
| 8213 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 8214 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8215 | * just as well using only RSL. */ |
| 8216 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 8217 | |
| 8218 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8219 | f_sleep(1.0); |
| 8220 | |
| 8221 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 8222 | * instead, and hits msc 0. */ |
| 8223 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8224 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8225 | f_ctrs_msc_init(); |
| 8226 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8227 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 8228 | var MSC_ConnHdlr vc_conn1; |
| 8229 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8230 | pars1.mscpool.rsl_idx := 0; |
| 8231 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 8232 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8233 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8234 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8235 | |
| 8236 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 8237 | var MSC_ConnHdlr vc_conn2; |
| 8238 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8239 | pars2.mscpool.rsl_idx := 1; |
| 8240 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 8241 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8242 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8243 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8244 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8245 | } |
| 8246 | |
| 8247 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 8248 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 8249 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 8250 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 8251 | //cid_list := { cIl_allInBSS := ''O }; |
| 8252 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 8253 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 8254 | var BSSAP_N_UNITDATA_req paging; |
| 8255 | var hexstring imsi := '001010000000123'H; |
| 8256 | |
| 8257 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8258 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8259 | 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] | 8260 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 8261 | BSSAP.send(paging); |
| 8262 | |
| 8263 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 8264 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 8265 | * channel number is picked here. */ |
| 8266 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 8267 | f_rslem_register(0, new_chan_nr); |
| 8268 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 8269 | f_rslem_unregister(0, new_chan_nr); |
| 8270 | |
| 8271 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 8272 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8273 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8274 | f_sleep(1.0); |
| 8275 | } |
| 8276 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 8277 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 8278 | f_sleep(1.0); |
| 8279 | |
| 8280 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 8281 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 8282 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 8283 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8284 | f_ctrs_msc_init(); |
| 8285 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8286 | var MSC_ConnHdlr vc_conn1; |
| 8287 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8288 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8289 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8290 | 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] | 8291 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 8292 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8293 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8294 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8295 | } |
| 8296 | |
| 8297 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 8298 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 8299 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 8300 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 8301 | //cid_list := { cIl_allInBSS := ''O }; |
| 8302 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 8303 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 8304 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 8305 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8306 | var BSSAP_N_UNITDATA_req paging; |
| 8307 | |
| 8308 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8309 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8310 | 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] | 8311 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 8312 | BSSAP.send(paging); |
| 8313 | |
| 8314 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 8315 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 8316 | * channel number is picked here. */ |
| 8317 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 8318 | f_rslem_register(0, new_chan_nr); |
| 8319 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 8320 | f_rslem_unregister(0, new_chan_nr); |
| 8321 | |
| 8322 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 8323 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 8324 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8325 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8326 | f_sleep(1.0); |
| 8327 | } |
| 8328 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 8329 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 8330 | f_sleep(1.0); |
| 8331 | |
| 8332 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 8333 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 8334 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 8335 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8336 | f_ctrs_msc_init(); |
| 8337 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8338 | var MSC_ConnHdlr vc_conn1; |
| 8339 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8340 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8341 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8342 | 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] | 8343 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 8344 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8345 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8346 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8347 | } |
| 8348 | |
| 8349 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 8350 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8351 | * just as well using only RSL. */ |
| 8352 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 8353 | |
| 8354 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8355 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8356 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8357 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8358 | |
| 8359 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8360 | * would be randomly affected by which other tests ran before this. */ |
| 8361 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8362 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8363 | f_ctrs_msc_init(); |
| 8364 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8365 | var MSC_ConnHdlr vc_conn1; |
| 8366 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8367 | pars1.mscpool.rsl_idx := 0; |
| 8368 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 8369 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8370 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8371 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8372 | |
| 8373 | var MSC_ConnHdlr vc_conn2; |
| 8374 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8375 | pars2.mscpool.rsl_idx := 1; |
| 8376 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8377 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8378 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8379 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8380 | |
| 8381 | var MSC_ConnHdlr vc_conn3; |
| 8382 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8383 | pars3.mscpool.rsl_idx := 2; |
| 8384 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8385 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8386 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8387 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8388 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8389 | } |
| 8390 | |
| 8391 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 8392 | * TMSI NRI. */ |
| 8393 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 8394 | |
| 8395 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8396 | f_sleep(1.0); |
| 8397 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8398 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8399 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 8400 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8401 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8402 | * would be randomly affected by which other tests ran before this. */ |
| 8403 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8404 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8405 | f_ctrs_msc_init(); |
| 8406 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8407 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 8408 | var MSC_ConnHdlr vc_conn1; |
| 8409 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8410 | pars1.mscpool.rsl_idx := 0; |
| 8411 | /* An NRI of the second MSC's range (256-511) */ |
| 8412 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 8413 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8414 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8415 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8416 | |
| 8417 | var MSC_ConnHdlr vc_conn2; |
| 8418 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8419 | pars2.mscpool.rsl_idx := 1; |
| 8420 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8421 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8422 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8423 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8424 | |
| 8425 | var MSC_ConnHdlr vc_conn3; |
| 8426 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8427 | pars3.mscpool.rsl_idx := 2; |
| 8428 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8429 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8430 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8431 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8432 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8433 | } |
| 8434 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8435 | /* Allow/Deny emergency calls globally via VTY */ |
| 8436 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 8437 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 8438 | if (allow) { |
| 8439 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 8440 | } else { |
| 8441 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 8442 | } |
| 8443 | f_vty_transceive(BSCVTY, "exit"); |
| 8444 | f_vty_transceive(BSCVTY, "exit"); |
| 8445 | } |
| 8446 | |
| 8447 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 8448 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 8449 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8450 | if (allow) { |
| 8451 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 8452 | } else { |
| 8453 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 8454 | } |
| 8455 | f_vty_transceive(BSCVTY, "exit"); |
| 8456 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 8457 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8458 | } |
| 8459 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 8460 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 8461 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 8462 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8463 | if (allow) { |
| 8464 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 8465 | } else { |
| 8466 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 8467 | } |
| 8468 | f_vty_transceive(BSCVTY, "exit"); |
| 8469 | f_vty_transceive(BSCVTY, "exit"); |
| 8470 | f_vty_transceive(BSCVTY, "exit"); |
| 8471 | } |
| 8472 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 8473 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 8474 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 8475 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8476 | if (allow) { |
| 8477 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 8478 | } else { |
| 8479 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 8480 | } |
| 8481 | f_vty_transceive(BSCVTY, "exit"); |
| 8482 | f_vty_transceive(BSCVTY, "exit"); |
| 8483 | f_vty_transceive(BSCVTY, "exit"); |
| 8484 | } |
| 8485 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8486 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 8487 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 8488 | var PDU_ML3_MS_NW emerg_setup; |
| 8489 | var octetstring emerg_setup_enc; |
| 8490 | var RSL_Message emerg_setup_data_ind; |
| 8491 | |
| 8492 | f_establish_fully(omit, omit); |
| 8493 | |
| 8494 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 8495 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 8496 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 8497 | |
| 8498 | RSL.send(emerg_setup_data_ind); |
| 8499 | } |
| 8500 | |
| 8501 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 8502 | * CALLS are permitted by the BSC config. */ |
| 8503 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 8504 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8505 | var PDU_ML3_MS_NW emerg_setup; |
| 8506 | timer T := 3.0; |
| 8507 | |
| 8508 | f_assignment_emerg_setup() |
| 8509 | |
| 8510 | T.start; |
| 8511 | alt { |
| 8512 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 8513 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 8514 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 8515 | setverdict(fail, "no emergency setup"); |
| 8516 | } |
| 8517 | } |
| 8518 | [] BSSAP.receive { |
| 8519 | setverdict(fail, "unexpected BSSAP message!"); |
| 8520 | } |
| 8521 | [] T.timeout { |
| 8522 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 8523 | } |
| 8524 | } |
| 8525 | |
| 8526 | setverdict(pass); |
| 8527 | } |
| 8528 | |
| 8529 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 8530 | * forbidden by the BSC config. */ |
| 8531 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 8532 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8533 | timer T := 3.0; |
| 8534 | |
| 8535 | f_assignment_emerg_setup() |
| 8536 | |
| 8537 | T.start; |
| 8538 | alt { |
| 8539 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8540 | setverdict(pass); |
| 8541 | } |
| 8542 | [] RSL.receive { |
| 8543 | setverdict(fail, "unexpected RSL message!"); |
| 8544 | } |
| 8545 | [] T.timeout { |
| 8546 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 8547 | } |
| 8548 | } |
| 8549 | } |
| 8550 | |
| 8551 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 8552 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 8553 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8554 | var MSC_ConnHdlr vc_conn; |
| 8555 | |
| 8556 | f_init(1, true); |
| 8557 | f_sleep(1.0); |
| 8558 | |
| 8559 | f_vty_allow_emerg_msc(true); |
| 8560 | f_vty_allow_emerg_bts(true, 0); |
| 8561 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 8562 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8563 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8564 | } |
| 8565 | |
| 8566 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 8567 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 8568 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8569 | var MSC_ConnHdlr vc_conn; |
| 8570 | |
| 8571 | f_init(1, true); |
| 8572 | f_sleep(1.0); |
| 8573 | |
| 8574 | f_vty_allow_emerg_msc(false); |
| 8575 | f_vty_allow_emerg_bts(true, 0); |
| 8576 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8577 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8578 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8579 | } |
| 8580 | |
| 8581 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 8582 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 8583 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8584 | var MSC_ConnHdlr vc_conn; |
| 8585 | |
| 8586 | /* Note: This simulates a spec violation by the MS, correct MS |
| 8587 | * implementations would not try to establish an emergency call because |
| 8588 | * the system information tells in advance that emergency calls are |
| 8589 | * not forbidden */ |
| 8590 | |
| 8591 | f_init(1, true); |
| 8592 | f_sleep(1.0); |
| 8593 | |
| 8594 | f_vty_allow_emerg_msc(true); |
| 8595 | f_vty_allow_emerg_bts(false, 0); |
| 8596 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8597 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8598 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8599 | } |
| 8600 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8601 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 8602 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 8603 | * emergency call */ |
| 8604 | testcase TC_emerg_premption() runs on test_CT { |
| 8605 | var ASP_RSL_Unitdata rsl_ud; |
| 8606 | var integer i; |
| 8607 | var integer chreq_total, chreq_nochan; |
| 8608 | var RSL_Message rx_rsl; |
| 8609 | var RslChannelNr chan_nr; |
| 8610 | |
| 8611 | f_init(1); |
| 8612 | f_sleep(1.0); |
| 8613 | |
| 8614 | f_vty_allow_emerg_msc(true); |
| 8615 | f_vty_allow_emerg_bts(true, 0); |
| 8616 | |
| 8617 | /* Fill up all channels on the BTS */ |
| 8618 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 8619 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 8620 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 8621 | chan_nr := f_chreq_act_ack('33'O, i); |
| 8622 | } |
| 8623 | IPA_RSL[0].clear; |
| 8624 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 8625 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 8626 | |
| 8627 | /* Send Channel request for emegergency call */ |
| 8628 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 8629 | |
| 8630 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 8631 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 8632 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 8633 | |
| 8634 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 8635 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8636 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 8637 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 8638 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 8639 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8640 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8641 | } |
| 8642 | |
| 8643 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 8644 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8645 | private type record FHParamsTs { |
| 8646 | boolean enabled, |
| 8647 | uint6_t hsn, |
| 8648 | uint6_t maio, |
| 8649 | ArfcnList ma |
| 8650 | }; |
| 8651 | |
| 8652 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8653 | private type record FHParamsTrx { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8654 | GsmBandArfcn arfcn, |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8655 | FHParamsTs ts[8] |
| 8656 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8657 | |
| 8658 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 8659 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 8660 | runs on test_CT return FHParamsTrx { |
| 8661 | var FHParamsTrx fhp; |
| 8662 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8663 | /* Generate a random ARFCN in the range of 0 - 3. This ARFCN will |
| 8664 | * fall in the GSM900 band. */ |
| 8665 | fhp.arfcn.arfcn := f_rnd_int(3); |
| 8666 | fhp.arfcn.pcs := false; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8667 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8668 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 8669 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8670 | fhp.ts[tn].enabled := false; |
| 8671 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8672 | continue; |
| 8673 | } |
| 8674 | |
| 8675 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8676 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 8677 | fhp.ts[tn].maio := f_rnd_int(64); |
| 8678 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8679 | |
| 8680 | /* Random Mobile Allocation (hopping channels) */ |
| 8681 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 8682 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 8683 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8684 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8685 | } |
| 8686 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8687 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8688 | } |
| 8689 | |
| 8690 | log("f_TC_fh_params_gen(): ", fhp); |
| 8691 | return fhp; |
| 8692 | } |
| 8693 | |
| 8694 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 8695 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 8696 | { |
| 8697 | var template (present) ChannelDescription tr_cd; |
| 8698 | var template (present) MaioHsn tr_maio_hsn; |
| 8699 | var uint3_t tn := cd.chan_nr.tn; |
| 8700 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8701 | if (fhp.ts[tn].enabled) { |
| 8702 | 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] | 8703 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 8704 | } else { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8705 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8706 | } |
| 8707 | |
| 8708 | if (not match(cd, tr_cd)) { |
| 8709 | setverdict(fail, "Channel Description IE does not match: ", |
| 8710 | cd, " vs expected ", tr_cd); |
| 8711 | } |
| 8712 | } |
| 8713 | |
| 8714 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 8715 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8716 | in MobileAllocationLV ma) |
| 8717 | { |
| 8718 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 8719 | |
| 8720 | if (not match(ma, tr_ma)) { |
| 8721 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 8722 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 8723 | } else { |
| 8724 | setverdict(pass); |
| 8725 | } |
| 8726 | } |
| 8727 | |
| 8728 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8729 | in MobileAllocationLV ma) |
| 8730 | return template MobileAllocationLV { |
| 8731 | /* 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] | 8732 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8733 | return { len := 0, ma := ''B }; |
| 8734 | } |
| 8735 | |
| 8736 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 8737 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 8738 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8739 | |
| 8740 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8741 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 8742 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 8743 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8744 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8745 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8746 | } |
| 8747 | } |
| 8748 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8749 | /* Take ARFCN of the TRX itself into account */ |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8750 | full_mask[fhp.arfcn.arfcn] := '1'B; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8751 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8752 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8753 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8754 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8755 | } |
| 8756 | |
| 8757 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8758 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8759 | if (full_mask[i] != '1'B) |
| 8760 | { continue; } |
| 8761 | |
| 8762 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 8763 | if (slot_mask[i] == '1'B) { |
| 8764 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8765 | } else { |
| 8766 | ma_mask := ma_mask & '0'B; |
| 8767 | } |
| 8768 | } |
| 8769 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8770 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 8771 | if (full_mask[0] == '1'B) { |
| 8772 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 8773 | if (slot_mask[0] == '1'B) { |
| 8774 | ma_mask := ma_mask & '1'B; |
| 8775 | } else { |
| 8776 | ma_mask := ma_mask & '0'B; |
| 8777 | } |
| 8778 | } |
| 8779 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8780 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 8781 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8782 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 8783 | |
| 8784 | return { len := ma_mask_len, ma := ma_mask }; |
| 8785 | } |
| 8786 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8787 | /* Configure the appropriate band for a given arfcn, exc */ |
| 8788 | private function f_TC_set_band_by_arfcn(integer bts_nr, GsmBandArfcn arfcn) runs on test_CT |
| 8789 | { |
| 8790 | var charstring band; |
| 8791 | var GsmBandArfcn arfcn_ := valueof(ts_GsmBandArfcn(arfcn.arfcn, arfcn.pcs, false)); |
| 8792 | |
| 8793 | select (arfcn_) { |
| 8794 | case (tr_GsmBandArfcn((259..293), false, ?)) { band := "GSM450"; } |
| 8795 | case (tr_GsmBandArfcn((306..340), false, ?)) { band := "GSM480"; } |
| 8796 | case (tr_GsmBandArfcn((438..511), false, ?)) { band := "GSM750"; } |
| 8797 | case (tr_GsmBandArfcn((128..251), false, ?)) { band := "GSM850"; } |
| 8798 | case (tr_GsmBandArfcn((0..124), false, ?)) { band := "GSM900"; } |
| 8799 | case (tr_GsmBandArfcn((955..1023), false, ?)) { band := "GSM900"; } |
| 8800 | case (tr_GsmBandArfcn((512..885), false, ?)) { band := "DCS1800"; } |
| 8801 | case (tr_GsmBandArfcn((512..810), true, ?)) { band := "PCS1900"; } |
| 8802 | case else { return; } |
| 8803 | } |
| 8804 | |
| 8805 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8806 | f_vty_transceive(BSCVTY, "band " & band); |
| 8807 | f_vty_transceive(BSCVTY, "end"); |
| 8808 | } |
| 8809 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8810 | /* Configure the hopping parameters in accordance with the given record */ |
| 8811 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 8812 | uint8_t bts_nr := 0, |
| 8813 | uint8_t trx_nr := 0) |
| 8814 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8815 | |
| 8816 | f_TC_set_band_by_arfcn(bts_nr, fhp.arfcn); |
| 8817 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8818 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8819 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8820 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8821 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8822 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8823 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8824 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8825 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8826 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8827 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8828 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8829 | continue; |
| 8830 | } |
| 8831 | |
| 8832 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8833 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 8834 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8835 | |
| 8836 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8837 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8838 | 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] | 8839 | } |
| 8840 | |
| 8841 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 8842 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8843 | } |
| 8844 | |
| 8845 | f_vty_transceive(BSCVTY, "end"); |
| 8846 | } |
| 8847 | |
| 8848 | /* Disable frequency hopping on all timeslots */ |
| 8849 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 8850 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8851 | uint8_t trx_nr := 0, |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8852 | GsmBandArfcn arfcn := {pcs := false, arfcn := 871}) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8853 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8854 | |
| 8855 | f_TC_set_band_by_arfcn(bts_nr, arfcn); |
| 8856 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8857 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8858 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8859 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8860 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8861 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8862 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8863 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8864 | |
| 8865 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8866 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8867 | 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] | 8868 | } |
| 8869 | |
| 8870 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8871 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8872 | } |
| 8873 | |
| 8874 | f_vty_transceive(BSCVTY, "end"); |
| 8875 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8876 | } |
| 8877 | |
| 8878 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 8879 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 8880 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 8881 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8882 | var RSL_Message rsl_msg; |
| 8883 | var RSL_IE_Body ie; |
| 8884 | |
| 8885 | f_init_vty(); |
| 8886 | |
| 8887 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8888 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8889 | |
| 8890 | f_init(1); |
| 8891 | |
| 8892 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8893 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8894 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8895 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8896 | |
| 8897 | /* Make sure that Channel Identification IE is present */ |
| 8898 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 8899 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 8900 | continue; |
| 8901 | } |
| 8902 | |
| 8903 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8904 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 8905 | |
| 8906 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 8907 | if (ie.chan_ident.ma.v.len != 0) { |
| 8908 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 8909 | ie.chan_ident.ma, ", despite it shall be"); |
| 8910 | continue; |
| 8911 | } |
| 8912 | } |
| 8913 | |
| 8914 | /* Disable frequency hopping */ |
| 8915 | f_TC_fh_params_unset(fhp); |
| 8916 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8917 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8918 | } |
| 8919 | |
| 8920 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 8921 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 8922 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8923 | var RSL_Message rsl_msg; |
| 8924 | var RSL_IE_Body ie; |
| 8925 | |
| 8926 | f_init_vty(); |
| 8927 | |
| 8928 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8929 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8930 | |
| 8931 | f_init(1); |
| 8932 | |
| 8933 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8934 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8935 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8936 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8937 | |
| 8938 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8939 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 8940 | |
| 8941 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 8942 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 8943 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 8944 | continue; |
| 8945 | } |
| 8946 | |
| 8947 | /* Decode the actual Immediate Assignment message */ |
| 8948 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 8949 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 8950 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 8951 | continue; |
| 8952 | } |
| 8953 | |
| 8954 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8955 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 8956 | |
| 8957 | /* Make sure that the Mobile Allocation IE matches */ |
| 8958 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 8959 | rr_msg.payload.imm_ass.mobile_allocation); |
| 8960 | } |
| 8961 | |
| 8962 | /* Disable frequency hopping */ |
| 8963 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8964 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8965 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8966 | } |
| 8967 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8968 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 8969 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 8970 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8971 | var RSL_Message rsl_msg; |
| 8972 | var RSL_IE_Body ie; |
| 8973 | |
| 8974 | f_init_vty(); |
| 8975 | |
| 8976 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8977 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8978 | |
| 8979 | f_init(1); |
| 8980 | |
| 8981 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 8982 | vc_MGCP.stop; |
| 8983 | |
| 8984 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 8985 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 8986 | |
| 8987 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 8988 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 8989 | for (var integer i := 0; i < 3; i := i + 1) { |
| 8990 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 8991 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8992 | |
| 8993 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 8994 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 8995 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8996 | |
| 8997 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 8998 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8999 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 9000 | |
| 9001 | /* Make sure that L3 Information IE is present */ |
| 9002 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 9003 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 9004 | continue; |
| 9005 | } |
| 9006 | |
| 9007 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 9008 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 9009 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 9010 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 9011 | continue; |
| 9012 | } |
| 9013 | |
| 9014 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9015 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 9016 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9017 | |
| 9018 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 9019 | 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] | 9020 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9021 | continue; |
| 9022 | } |
| 9023 | |
| 9024 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 9025 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 9026 | if (chan_desc.h and ma_present) { |
| 9027 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9028 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 9029 | } else if (chan_desc.h and not ma_present) { |
| 9030 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9031 | continue; |
| 9032 | } else if (not chan_desc.h and ma_present) { |
| 9033 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 9034 | continue; |
| 9035 | } |
| 9036 | } |
| 9037 | |
| 9038 | /* Give the IUT some time to release all channels */ |
| 9039 | f_sleep(3.0); |
| 9040 | |
| 9041 | /* Disable frequency hopping */ |
| 9042 | f_TC_fh_params_unset(fhp); |
| 9043 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9044 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9045 | } |
| 9046 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9047 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 9048 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 9049 | runs on test_CT { |
| 9050 | var RSL_Message rsl_msg; |
| 9051 | var RSL_IE_Body ie; |
| 9052 | var DchanTuple dt; |
| 9053 | |
| 9054 | /* Establish a dedicated channel, so we can trigger handover */ |
| 9055 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
Vadim Yanitskiy | c18ff47 | 2021-11-18 20:15:37 +0300 | [diff] [blame] | 9056 | f_sleep(0.5); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9057 | |
| 9058 | /* Trigger handover from BTS0 to BTS1 */ |
| 9059 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 9060 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 9061 | |
| 9062 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 9063 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9064 | |
| 9065 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 9066 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 9067 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 9068 | |
| 9069 | /* Make sure that L3 Information IE is present */ |
| 9070 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 9071 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 9072 | return; |
| 9073 | } |
| 9074 | |
| 9075 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 9076 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 9077 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 9078 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 9079 | return; |
| 9080 | } |
| 9081 | |
| 9082 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 9083 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 9084 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 9085 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 9086 | return; |
| 9087 | } |
| 9088 | |
| 9089 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9090 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9091 | |
| 9092 | /* Make sure that Cell Channel Description IE is present */ |
| 9093 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 9094 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 9095 | return; |
| 9096 | } |
| 9097 | |
| 9098 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 9099 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 9100 | if (ma_present) { |
| 9101 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9102 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 9103 | } else { |
| 9104 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9105 | return; |
| 9106 | } |
| 9107 | } |
| 9108 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 9109 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9110 | |
| 9111 | f_init_vty(); |
| 9112 | |
| 9113 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 9114 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 9115 | |
| 9116 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9117 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 9118 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9119 | |
| 9120 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9121 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 9122 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9123 | |
| 9124 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 9125 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 9126 | |
| 9127 | f_init(2); |
| 9128 | |
| 9129 | f_TC_fh_params_handover_cmd(fhp); |
| 9130 | |
| 9131 | /* Disable frequency hopping on BTS1 */ |
| 9132 | f_TC_fh_params_unset(fhp, 1); |
| 9133 | |
| 9134 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 9135 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 9136 | |
| 9137 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9138 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 9139 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9140 | |
| 9141 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9142 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 9143 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9144 | |
| 9145 | f_shutdown_helper(); |
| 9146 | } |
| 9147 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9148 | /* Verify the hopping parameters in System Information Type 4 */ |
| 9149 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 9150 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 9151 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9152 | timer T := 5.0; |
| 9153 | |
| 9154 | f_init_vty(); |
| 9155 | |
| 9156 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 9157 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 9158 | |
| 9159 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9160 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 9161 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9162 | |
| 9163 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9164 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 9165 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9166 | |
| 9167 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9168 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9169 | |
| 9170 | f_init(1); |
| 9171 | |
| 9172 | T.start; |
| 9173 | alt { |
| 9174 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 9175 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 9176 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 9177 | |
| 9178 | /* Make sure that what we decoded is System Information Type 4 */ |
| 9179 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 9180 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 9181 | repeat; |
| 9182 | } |
| 9183 | |
| 9184 | /* Make sure that CBCH Channel Description IE is present */ |
| 9185 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 9186 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 9187 | break; |
| 9188 | } |
| 9189 | |
| 9190 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 9191 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 9192 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9193 | |
| 9194 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 9195 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 9196 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 9197 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9198 | break; |
| 9199 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 9200 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9201 | si.payload.si4.cbch_mobile_alloc.v); |
| 9202 | } |
| 9203 | } |
| 9204 | [] IPA_RSL[0].receive { repeat; } |
| 9205 | [] T.timeout { |
| 9206 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 9207 | } |
| 9208 | } |
| 9209 | |
| 9210 | /* Disable frequency hopping */ |
| 9211 | f_TC_fh_params_unset(fhp); |
| 9212 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 9213 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9214 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 9215 | |
| 9216 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 9217 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9218 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9219 | |
| 9220 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9221 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 9222 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9223 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9224 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9225 | } |
| 9226 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9227 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 9228 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 9229 | |
| 9230 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 9231 | template (present) BSSLAP_PDU expect_bsslap) |
| 9232 | { |
| 9233 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 9234 | if (not match(bsslap, expect_bsslap)) { |
| 9235 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 9236 | log("GOT BSSLAP: ", bsslap); |
| 9237 | setverdict(fail, "BSSLAP is not as expected"); |
| 9238 | mtc.stop; |
| 9239 | } |
| 9240 | setverdict(pass); |
| 9241 | } |
| 9242 | |
| 9243 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 9244 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 9245 | |
| 9246 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 9247 | var PDU_BSSAP_LE rx_bsslap; |
| 9248 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 9249 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 9250 | } |
| 9251 | |
| 9252 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9253 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 9254 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 9255 | f_sleep(1.0); |
| 9256 | |
| 9257 | f_establish_fully(omit, omit); |
| 9258 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9259 | |
| 9260 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9261 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9262 | |
| 9263 | var PDU_BSSAP_LE plr; |
| 9264 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9265 | |
| 9266 | if (not do_ta_request) { |
| 9267 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 9268 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 9269 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 9270 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 9271 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 9272 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 9273 | mtc.stop; |
| 9274 | } |
| 9275 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 9276 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 9277 | if (not match(bsslap, expect_ta_layer3)) { |
| 9278 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 9279 | log("GOT BSSLAP: ", bsslap); |
| 9280 | setverdict(fail, "BSSLAP is not as expected"); |
| 9281 | mtc.stop; |
| 9282 | } |
| 9283 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 9284 | * has no need to request the TA from the BSC and directly responds. */ |
| 9285 | } else { |
| 9286 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9287 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9288 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9289 | } |
| 9290 | |
| 9291 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9292 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9293 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9294 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9295 | |
| 9296 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 9297 | f_mo_l3_transceive(); |
| 9298 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9299 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9300 | |
| 9301 | f_sleep(2.0); |
| 9302 | setverdict(pass); |
| 9303 | } |
| 9304 | |
| 9305 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9306 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 9307 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 9308 | f_lcs_loc_req_for_active_ms(false); |
| 9309 | } |
| 9310 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 9311 | var MSC_ConnHdlr vc_conn; |
| 9312 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9313 | |
| 9314 | f_init(1, true); |
| 9315 | f_sleep(1.0); |
| 9316 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 9317 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9318 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9319 | } |
| 9320 | |
| 9321 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9322 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 9323 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 9324 | f_lcs_loc_req_for_active_ms(true); |
| 9325 | } |
| 9326 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 9327 | var MSC_ConnHdlr vc_conn; |
| 9328 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9329 | |
| 9330 | f_init(1, true); |
| 9331 | f_sleep(1.0); |
| 9332 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 9333 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9334 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9335 | } |
| 9336 | |
| 9337 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 9338 | * conn without an active lchan. */ |
| 9339 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 9340 | { |
| 9341 | var BssmapCause cause := 0; |
| 9342 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9343 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 9344 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9345 | |
| 9346 | timer no_more_bssap := 5.0; |
| 9347 | no_more_bssap.start; |
| 9348 | alt { |
| 9349 | [] no_more_bssap.timeout { break; } |
| 9350 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 9351 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 9352 | mtc.stop; |
| 9353 | } |
| 9354 | } |
| 9355 | setverdict(pass); |
| 9356 | } |
| 9357 | |
| 9358 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 9359 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 9360 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 9361 | { |
| 9362 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 9363 | |
| 9364 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 9365 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 9366 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 9367 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9368 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9369 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 9370 | |
| 9371 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 9372 | f_clear_A_conn(); |
| 9373 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9374 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9375 | } |
| 9376 | |
| 9377 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9378 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 9379 | */ |
| 9380 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 9381 | f_sleep(1.0); |
| 9382 | |
| 9383 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9384 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9385 | |
| 9386 | /* Register to receive the Paging Command */ |
| 9387 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9388 | g_chan_nr := new_chan_nr; |
| 9389 | f_rslem_register(0, g_chan_nr); |
| 9390 | |
| 9391 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9392 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9393 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9394 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9395 | |
| 9396 | var PDU_BSSAP_LE plr; |
| 9397 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9398 | |
| 9399 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9400 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9401 | |
| 9402 | /* OsmoBSC needs to Page */ |
| 9403 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 9404 | f_logp(BSCVTY, "got Paging Command"); |
| 9405 | |
| 9406 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 9407 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9408 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 9409 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9410 | |
| 9411 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 9412 | |
| 9413 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9414 | |
| 9415 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9416 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9417 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9418 | |
| 9419 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9420 | |
| 9421 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 9422 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 9423 | f_verify_active_A_conn_and_clear(); |
| 9424 | |
| 9425 | f_sleep(2.0); |
| 9426 | setverdict(pass); |
| 9427 | } |
| 9428 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 9429 | var MSC_ConnHdlr vc_conn; |
| 9430 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9431 | |
| 9432 | f_init(1, true); |
| 9433 | f_sleep(1.0); |
| 9434 | |
| 9435 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9436 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9437 | |
| 9438 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 9439 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9440 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9441 | } |
| 9442 | |
| 9443 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 9444 | */ |
| 9445 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 9446 | f_sleep(1.0); |
| 9447 | |
| 9448 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9449 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9450 | |
| 9451 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 9452 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9453 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 9454 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 9455 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9456 | |
| 9457 | /* BSC tells MSC about failure */ |
| 9458 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9459 | locationEstimate := omit, positioningData := omit, |
| 9460 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 9461 | |
| 9462 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9463 | f_verify_active_A_conn_and_clear(); |
| 9464 | |
| 9465 | f_sleep(2.0); |
| 9466 | setverdict(pass); |
| 9467 | } |
| 9468 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 9469 | var MSC_ConnHdlr vc_conn; |
| 9470 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9471 | |
| 9472 | f_init(1, true); |
| 9473 | f_sleep(1.0); |
| 9474 | |
| 9475 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9476 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9477 | |
| 9478 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 9479 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9480 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9481 | } |
| 9482 | |
| 9483 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9484 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 9485 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 9486 | f_sleep(1.0); |
| 9487 | |
| 9488 | f_establish_fully(omit, omit); |
| 9489 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9490 | |
| 9491 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9492 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9493 | |
| 9494 | var PDU_BSSAP_LE plr; |
| 9495 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9496 | |
| 9497 | if (do_ta) { |
| 9498 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9499 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9500 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9501 | } |
| 9502 | |
| 9503 | /* SMLC fails to respond, BSC runs into timeout */ |
| 9504 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 9505 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9506 | |
| 9507 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9508 | locationEstimate := omit, positioningData := omit, |
| 9509 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 9510 | |
| 9511 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9512 | f_verify_active_A_conn_and_clear(); |
| 9513 | |
| 9514 | f_sleep(2.0); |
| 9515 | setverdict(pass); |
| 9516 | } |
| 9517 | |
| 9518 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9519 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 9520 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 9521 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 9522 | } |
| 9523 | |
| 9524 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 9525 | var MSC_ConnHdlr vc_conn; |
| 9526 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9527 | |
| 9528 | f_init(1, true); |
| 9529 | f_sleep(1.0); |
| 9530 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 9531 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9532 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9533 | } |
| 9534 | |
| 9535 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9536 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 9537 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 9538 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 9539 | } |
| 9540 | |
| 9541 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 9542 | var MSC_ConnHdlr vc_conn; |
| 9543 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9544 | |
| 9545 | f_init(1, true); |
| 9546 | f_sleep(1.0); |
| 9547 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 9548 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9549 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9550 | } |
| 9551 | |
| 9552 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 9553 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 9554 | f_sleep(1.0); |
| 9555 | |
| 9556 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9557 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9558 | |
| 9559 | /* Register to receive the Paging Command */ |
| 9560 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9561 | g_chan_nr := new_chan_nr; |
| 9562 | f_rslem_register(0, g_chan_nr); |
| 9563 | |
| 9564 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9565 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9566 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9567 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9568 | |
| 9569 | var PDU_BSSAP_LE plr; |
| 9570 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9571 | |
| 9572 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9573 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9574 | |
| 9575 | /* OsmoBSC needs to Page */ |
| 9576 | var PDU_BSSAP_LE rx_bsslap; |
| 9577 | alt { |
| 9578 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 9579 | f_logp(BSCVTY, "got Paging Command"); |
| 9580 | repeat; |
| 9581 | } |
| 9582 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9583 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 9584 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 9585 | } |
| 9586 | } |
| 9587 | |
| 9588 | /* SMLC responds with failure */ |
| 9589 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9590 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9591 | |
| 9592 | /* BSC tells MSC about failure */ |
| 9593 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9594 | locationEstimate := omit, positioningData := omit, |
| 9595 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 9596 | |
| 9597 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9598 | f_verify_active_A_conn_and_clear(); |
| 9599 | |
| 9600 | f_sleep(2.0); |
| 9601 | setverdict(pass); |
| 9602 | } |
| 9603 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 9604 | var MSC_ConnHdlr vc_conn; |
| 9605 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9606 | |
| 9607 | f_init(1, true); |
| 9608 | f_sleep(1.0); |
| 9609 | |
| 9610 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9611 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9612 | |
| 9613 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 9614 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9615 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9616 | } |
| 9617 | |
| 9618 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 9619 | * over. */ |
| 9620 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9621 | f_sleep(1.0); |
| 9622 | |
| 9623 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9624 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9625 | |
| 9626 | /* Register to receive the Paging Command */ |
| 9627 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9628 | g_chan_nr := new_chan_nr; |
| 9629 | f_rslem_register(0, g_chan_nr); |
| 9630 | |
| 9631 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9632 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9633 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9634 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9635 | |
| 9636 | var PDU_BSSAP_LE plr; |
| 9637 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9638 | |
| 9639 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 9640 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9641 | f_perform_compl_l3(RSL, RSL_PROC, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9642 | do_clear := false, expect_bssmap_l3 := true); |
| 9643 | |
| 9644 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9645 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9646 | |
| 9647 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 9648 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9649 | |
| 9650 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9651 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9652 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9653 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9654 | |
| 9655 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 9656 | f_mo_l3_transceive(); |
| 9657 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9658 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9659 | |
| 9660 | f_sleep(2.0); |
| 9661 | setverdict(pass); |
| 9662 | } |
| 9663 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 9664 | var MSC_ConnHdlr vc_conn; |
| 9665 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9666 | |
| 9667 | f_init(1, true); |
| 9668 | f_sleep(1.0); |
| 9669 | |
| 9670 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9671 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9672 | |
| 9673 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 9674 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9675 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9676 | } |
| 9677 | |
| 9678 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 9679 | * the new lchan after handover. */ |
| 9680 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9681 | f_sleep(1.0); |
| 9682 | |
| 9683 | f_establish_fully(omit, omit); |
| 9684 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9685 | |
| 9686 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9687 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9688 | |
| 9689 | var PDU_BSSAP_LE plr; |
| 9690 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9691 | |
| 9692 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 9693 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 9694 | |
| 9695 | var HandoverState hs := { |
| 9696 | rr_ho_cmpl_seen := false, |
| 9697 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 9698 | old_chan_nr := -, |
| 9699 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9700 | }; |
| 9701 | /* issue hand-over command on VTY */ |
| 9702 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 9703 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 9704 | f_rslem_suspend(RSL1_PROC); |
| 9705 | |
| 9706 | /* From the MGW perspective, a handover is is characterized by |
| 9707 | * performing one MDCX operation with the MGW. So we expect to see |
| 9708 | * one more MDCX during handover. */ |
| 9709 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 9710 | |
| 9711 | alt { |
| 9712 | [] as_handover(hs); |
| 9713 | } |
| 9714 | |
| 9715 | var PDU_BSSAP_LE rx_bsslap; |
| 9716 | |
| 9717 | interleave { |
| 9718 | /* Expect the BSC to inform the MSC about the handover */ |
| 9719 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 9720 | |
| 9721 | /* Expect the BSC to inform the SMLC about the handover */ |
| 9722 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9723 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 9724 | } |
| 9725 | } |
| 9726 | |
| 9727 | /* SMLC now responds with geo information data. */ |
| 9728 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9729 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9730 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9731 | |
| 9732 | /* lchan still active */ |
| 9733 | f_mo_l3_transceive(RSL1); |
| 9734 | |
| 9735 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9736 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9737 | |
| 9738 | f_sleep(2.0); |
| 9739 | setverdict(pass); |
| 9740 | } |
| 9741 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 9742 | var MSC_ConnHdlr vc_conn; |
| 9743 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9744 | |
| 9745 | f_init(2, true); |
| 9746 | f_sleep(1.0); |
| 9747 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 9748 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9749 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9750 | } |
| 9751 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9752 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 9753 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 9754 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9755 | |
| 9756 | /* Also disable attach for the single connected MSC */ |
| 9757 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 9758 | |
| 9759 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000100001'H)), '00F110'O) )); |
| 9760 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 9761 | |
| 9762 | /* No MSC is found, expecting a proper release on RSL */ |
| 9763 | interleave { |
| 9764 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 9765 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 9766 | } |
| 9767 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9768 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 9769 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9770 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9771 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 9772 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9773 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9774 | } |
| 9775 | } |
| 9776 | setverdict(pass); |
| 9777 | } |
| 9778 | testcase TC_no_msc() runs on test_CT { |
| 9779 | |
| 9780 | f_init(1, true); |
| 9781 | f_sleep(1.0); |
| 9782 | var MSC_ConnHdlr vc_conn; |
| 9783 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9784 | |
| 9785 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 9786 | |
| 9787 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 9788 | vc_conn.done; |
| 9789 | |
| 9790 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 9791 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9792 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9793 | } |
| 9794 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 9795 | /* Dyn PDCH todo: |
| 9796 | * activate OSMO as TCH/F |
| 9797 | * activate OSMO as TCH/H |
| 9798 | * does the BSC-located PCU socket get the updated INFO? |
| 9799 | * what if no PCU is connected at the time? |
| 9800 | * is the info correct on delayed PCU (re)connect? |
| 9801 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 9802 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9803 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 9804 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 9805 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 9806 | |
| 9807 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 9808 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9809 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 9810 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 9811 | g_pars.ass_codec_list.codecElements[0]; |
| 9812 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 9813 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 9814 | g_pars.expect_mr_s0_s7; |
| 9815 | } |
| 9816 | } |
| 9817 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 9818 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 9819 | log("expecting ASS COMPL like this: ", exp_compl); |
| 9820 | |
| 9821 | f_establish_fully(ass_cmd, exp_compl); |
| 9822 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 9823 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 modify vamos tsc 2 3"); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9824 | |
| 9825 | var RSL_Message rsl; |
| 9826 | |
| 9827 | timer T := 5.0; |
| 9828 | T.start; |
| 9829 | alt { |
| 9830 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 9831 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 9832 | log("Rx L3 from net: ", l3); |
| 9833 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 9834 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9835 | mtc.stop; |
| 9836 | } |
| 9837 | } |
| 9838 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 9839 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9840 | mtc.stop; |
| 9841 | } |
| 9842 | [] T.timeout { |
| 9843 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 9844 | setverdict(pass); |
| 9845 | } |
| 9846 | } |
| 9847 | T.stop; |
| 9848 | } |
| 9849 | |
| 9850 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 9851 | * osmo-bsc. */ |
| 9852 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 9853 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9854 | var MSC_ConnHdlr vc_conn; |
| 9855 | |
| 9856 | f_init(1, true); |
| 9857 | f_sleep(1.0); |
| 9858 | |
| 9859 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9860 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 9861 | vc_conn.done; |
| 9862 | f_shutdown_helper(); |
| 9863 | } |
| 9864 | |
| 9865 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 9866 | */ |
| 9867 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 9868 | f_init_vty(); |
| 9869 | |
| 9870 | f_init(1, false); |
| 9871 | f_sleep(1.0); |
| 9872 | |
| 9873 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 9874 | |
| 9875 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9876 | timer T := 5.0; |
| 9877 | |
| 9878 | T.start; |
| 9879 | alt { |
| 9880 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 9881 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 9882 | T.stop; |
| 9883 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 9884 | mtc.stop; |
| 9885 | } |
| 9886 | repeat; |
| 9887 | } |
| 9888 | [] T.timeout { |
| 9889 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 9890 | setverdict(pass); |
| 9891 | } |
| 9892 | } |
| 9893 | } |
| 9894 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9895 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 9896 | /* First fully set up a speech lchan */ |
| 9897 | f_TC_assignment_codec(id); |
| 9898 | |
| 9899 | /* Trigger re-assignment to another lchan */ |
| 9900 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 9901 | |
| 9902 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 9903 | * one MDCX on MGCP. */ |
| 9904 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 9905 | |
| 9906 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 9907 | * as the old lchan used. */ |
| 9908 | g_media.bts.ipa_crcx_seen := false; |
| 9909 | g_media.bts.ipa_mdcx_seen := false; |
| 9910 | |
| 9911 | /* Send different BTS side RTP port number for the new lchan */ |
| 9912 | g_media.bts.bts.port_nr := 4223; |
| 9913 | |
| 9914 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 9915 | |
| 9916 | /* Trigger re-assignment. */ |
| 9917 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 9918 | |
| 9919 | timer T := 5.0; |
| 9920 | T.start; |
| 9921 | alt { |
| 9922 | [] as_assignment(assignment_st); |
| 9923 | [] as_Media(); |
| 9924 | [] T.timeout { |
| 9925 | break; |
| 9926 | } |
| 9927 | } |
| 9928 | |
| 9929 | if (not assignment_st.assignment_done) { |
| 9930 | setverdict(fail, "Assignment did not complete"); |
| 9931 | mtc.stop; |
| 9932 | } |
| 9933 | |
| 9934 | f_check_mgcp_expectations() |
| 9935 | setverdict(pass); |
| 9936 | |
| 9937 | f_sleep(2.0); |
| 9938 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 9939 | |
| 9940 | /* Instruct BSC to clear channel */ |
| 9941 | var BssmapCause cause := 0; |
| 9942 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9943 | interleave { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9944 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 9945 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9946 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9947 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9948 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9949 | } |
| 9950 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 9951 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9952 | } |
| 9953 | } |
Neels Hofmeyr | 40a45d1 | 2021-09-23 22:57:12 +0200 | [diff] [blame] | 9954 | f_expect_dlcx_conns(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9955 | |
| 9956 | f_sleep(0.5); |
| 9957 | } |
| 9958 | |
| 9959 | testcase TC_reassignment_fr() runs on test_CT { |
| 9960 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9961 | var MSC_ConnHdlr vc_conn; |
| 9962 | |
| 9963 | f_init(1, true); |
| 9964 | f_sleep(1.0); |
| 9965 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 9966 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9967 | |
| 9968 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9969 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 9970 | vc_conn.done; |
| 9971 | |
| 9972 | /* from f_establish_fully() */ |
| 9973 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9974 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9975 | /* from re-assignment */ |
| 9976 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9977 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9978 | f_ctrs_bsc_and_bts_verify(); |
| 9979 | f_shutdown_helper(); |
| 9980 | } |
| 9981 | |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9982 | const charstring REEST_LOST_CONNECTION := "REEST_LOST_CONNECTION"; |
| 9983 | const charstring REEST_CLEAR := "REEST_CLEAR"; |
| 9984 | const charstring REEST_CLEAR_DONE := "REEST_CLEAR_DONE"; |
| 9985 | |
| 9986 | /* CM Re-Establishment, 3GPP TS 24.008 4.5.1.6. |
| 9987 | * The MS <-> BTS loses radio connection, MS shows up on second BTS and asks for CM Re-Establishment. |
| 9988 | * BSC should establish a separate A conn for the same MS, the original A conn is then cleared by |
| 9989 | * the MSC as the CM Re-Establishment is handled. |
| 9990 | * |
| 9991 | * MS bts0 bts1 bsc msc test-component |
| 9992 | * |<----->|<----------------->|<-0-->| _1 Establish channel on bts 0 |
| 9993 | * | | _1 wait a bit, to settle down |
| 9994 | * |<-x x--| | _1 "lose connection" |
| 9995 | * | | REEST_LOST_CONNECTION |
| 9996 | * |----------------->|------->|--1-->| _2 new A-conn: Chan Rqd, Imm Ass, Compl L3 with CM Re-Establishment Req |
| 9997 | * | | REEST_CLEAR |
| 9998 | * | |<-0---| _1 Clear Command on first A-conn |
| 9999 | * | |--0-->| _1 Clear Complete |
| 10000 | * | |<----------------->| | _1 Release first channel |
| 10001 | * | | REEST_CLEAR_DONE |
| 10002 | * |<-----------------|<-------|<-1---| _2 Chan Activ, Assignment Command |
| 10003 | * |<-----------------|<-------|<-1---| _2 Clear Command, Release |
| 10004 | * |
| 10005 | */ |
| 10006 | private function f_tc_cm_reestablishment_1(charstring id) runs on MSC_ConnHdlr { |
| 10007 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 10008 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10009 | |
| 10010 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10011 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10012 | |
| 10013 | f_establish_fully(ass_cmd, exp_compl); |
| 10014 | |
| 10015 | /* The original channel loses connection, MS attemts CM Re-Establishment on another cell, see |
| 10016 | * f_tc_cm_reestablishment_2(). This established channel stays active until MSC sends a Clear Command. The time |
| 10017 | * when exactly that happens is determined by f_tc_cm_reestablishment_2(). */ |
| 10018 | f_sleep(2.0); |
| 10019 | COORD.send(REEST_LOST_CONNECTION); |
| 10020 | |
| 10021 | alt { |
| 10022 | [] COORD.receive(REEST_CLEAR); |
| 10023 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 10024 | setverdict(fail, "Unexpected channel release"); |
| 10025 | mtc.stop; |
| 10026 | } |
| 10027 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 10028 | setverdict(fail, "Unexpected channel release"); |
| 10029 | mtc.stop; |
| 10030 | } |
| 10031 | } |
| 10032 | f_perform_clear() |
| 10033 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 969abd0 | 2021-09-23 22:24:08 +0200 | [diff] [blame] | 10034 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10035 | COORD.send(REEST_CLEAR_DONE); |
| 10036 | } |
| 10037 | |
| 10038 | private function f_tc_cm_reestablishment_2(charstring id) runs on MSC_ConnHdlr { |
| 10039 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 10040 | |
| 10041 | /* The MS lost the connection on the first channel, now establishes another one */ |
| 10042 | COORD.receive(REEST_LOST_CONNECTION); |
| 10043 | |
| 10044 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 10045 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REESTABL_REQ(mi)); |
| 10046 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 10047 | |
| 10048 | f_create_bssmap_exp(l3_enc); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10049 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10050 | BSSAP.receive(tr_BSSMAP_ComplL3(l3_enc)); |
| 10051 | |
| 10052 | /* MSC got the CM Re-Establishment request and first off clears the previous conn. */ |
| 10053 | COORD.send(REEST_CLEAR); |
| 10054 | COORD.receive(REEST_CLEAR_DONE); |
| 10055 | |
| 10056 | f_sleep(2.0); |
| 10057 | |
| 10058 | /* Answer the CM Re-Establishment with an Assignment Command. */ |
| 10059 | var template PDU_BSSAP expect_assignment_compl := f_gen_exp_compl(); |
| 10060 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10061 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10062 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10063 | |
| 10064 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
| 10065 | st.voice_call := true; |
| 10066 | st.is_assignment := true; |
| 10067 | |
| 10068 | var ExpectCriteria mgcpcrit := { |
| 10069 | connid := omit, |
| 10070 | endpoint := omit, |
| 10071 | transid := omit |
| 10072 | }; |
| 10073 | f_create_mgcp_expect(mgcpcrit); |
| 10074 | |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10075 | f_rslem_dchan_queue_enable(RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10076 | |
| 10077 | BSSAP.send(ass_cmd); |
| 10078 | |
| 10079 | var PDU_BSSAP bssap; |
| 10080 | |
| 10081 | alt { |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10082 | [] as_assignment(st, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
| 10083 | [] as_Media_ipacc(RSL1, RSL2); |
| 10084 | [] as_Media_mgw(); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10085 | [st.assignment_done] BSSAP.receive(expect_assignment_compl) { |
| 10086 | break; |
| 10087 | } |
| 10088 | } |
| 10089 | |
| 10090 | f_sleep(3.0); |
| 10091 | |
| 10092 | f_logp(BSCVTY, "f_tc_cm_reestablishment_2 clearing"); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10093 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10094 | f_expect_dlcx_conns(); |
| 10095 | } |
| 10096 | |
| 10097 | testcase TC_cm_reestablishment() runs on test_CT { |
| 10098 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 10099 | var MSC_ConnHdlr vc_conn1; |
| 10100 | |
| 10101 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 10102 | var MSC_ConnHdlr vc_conn2; |
| 10103 | pars2.imsi := pars1.imsi; |
| 10104 | pars2.media_nr := 2; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 10105 | pars2.expect_tsc := BTS_TSC[1]; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10106 | |
| 10107 | f_init(2, true, guard_timeout := 40.0); |
| 10108 | f_sleep(1.0); |
| 10109 | |
| 10110 | vc_conn1 := f_start_handler_create(pars1); |
| 10111 | vc_conn2 := f_start_handler_create(pars2); |
| 10112 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 10113 | f_start_handler_run(vc_conn1, refers(f_tc_cm_reestablishment_1), pars1); |
| 10114 | f_start_handler_run(vc_conn2, refers(f_tc_cm_reestablishment_2), pars2); |
| 10115 | vc_conn1.done; |
| 10116 | vc_conn2.done; |
| 10117 | |
| 10118 | f_shutdown_helper(); |
| 10119 | } |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10120 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10121 | function f_exp_ipa_rx_nonfatal(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, |
| 10122 | IpaStreamId sid := IPAC_PROTO_RSL_TRX0, boolean ignore_other_rx := true) |
| 10123 | runs on test_CT return template (omit) RSL_Message { |
| 10124 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10125 | timer T := t_secs; |
| 10126 | |
| 10127 | T.start; |
| 10128 | alt { |
| 10129 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
| 10130 | T.stop; |
| 10131 | } |
| 10132 | [ignore_other_rx] IPA_RSL[bts_nr].receive { repeat; } |
| 10133 | [not ignore_other_rx] IPA_RSL[bts_nr].receive { |
| 10134 | log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx); |
| 10135 | T.stop; |
| 10136 | return omit; |
| 10137 | } |
| 10138 | [] T.timeout { |
| 10139 | return omit; |
| 10140 | } |
| 10141 | } |
| 10142 | return rx_rsl_ud.rsl; |
| 10143 | } |
| 10144 | |
| 10145 | private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") { |
| 10146 | f_vty_enter_cfg_bts(pt, bts_nr); |
| 10147 | f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting); |
| 10148 | f_vty_transceive(pt, "exit"); |
| 10149 | f_vty_transceive(pt, "exit"); |
| 10150 | f_vty_transceive(pt, "exit"); |
| 10151 | } |
| 10152 | |
| 10153 | private function f_verify_imm_ass(RSL_Message imm_ass, template uint8_t ra := ?, template GsmFrameNumber fn := ?, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10154 | template RslChannelNr chan_nr := ?, |
| 10155 | template (present) uint12_t arfcn := ?, |
| 10156 | template (present) uint3_t tsc := ?) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10157 | { |
| 10158 | var RSL_IE_Body full_imm_ass_info; |
| 10159 | if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) { |
| 10160 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 10161 | mtc.stop; |
| 10162 | } |
| 10163 | |
| 10164 | var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload); |
| 10165 | var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra, |
| 10166 | fn := fn, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10167 | ch_desc := tr_ChanDescH0(chan_nr, arfcn, tsc), |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10168 | page_mode := ?); |
| 10169 | if (not match(rr_imm_ass, expect_imm_ass)) { |
| 10170 | log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass); |
| 10171 | setverdict(fail, "Failed to match Immediate Assignment"); |
| 10172 | mtc.stop; |
| 10173 | } |
| 10174 | } |
| 10175 | |
| 10176 | testcase TC_imm_ass_post_chan_ack() runs on test_CT { |
| 10177 | var RSL_Message chan_act; |
| 10178 | var RSL_Message imm_ass; |
| 10179 | |
| 10180 | f_init(1, false); |
| 10181 | f_sleep(1.0); |
| 10182 | |
| 10183 | /* (should be the default anyway, just to make things clear) */ |
| 10184 | f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack"); |
| 10185 | |
| 10186 | /* RA containing reason=LU */ |
| 10187 | var GsmFrameNumber fn := 2342; |
| 10188 | var uint8_t ra := 2; |
| 10189 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10190 | |
| 10191 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10192 | |
| 10193 | /* First send the Chan Act ACK */ |
| 10194 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10195 | var RSL_IE_Body chan_ident_ie; |
| 10196 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10197 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10198 | mtc.stop; |
| 10199 | } |
| 10200 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10201 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10)); |
| 10202 | |
| 10203 | /* Then expect the Immediate Assignment, after we ACKed the chan act */ |
| 10204 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10205 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10206 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10207 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10208 | |
| 10209 | /* Check that the lchan is working */ |
| 10210 | var octetstring l3 := '00010203040506'O; |
| 10211 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10212 | |
| 10213 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10214 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10215 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10216 | |
| 10217 | f_sleep(1.0); |
| 10218 | f_shutdown_helper(); |
| 10219 | } |
| 10220 | |
| 10221 | testcase TC_imm_ass_pre_chan_ack() runs on test_CT { |
| 10222 | var RSL_Message chan_act; |
| 10223 | var RSL_Message imm_ass; |
| 10224 | |
| 10225 | f_init(1, false); |
| 10226 | f_sleep(1.0); |
| 10227 | |
| 10228 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 10229 | |
| 10230 | /* RA containing reason=LU */ |
| 10231 | var GsmFrameNumber fn := 2342; |
| 10232 | var uint8_t ra := 2; |
| 10233 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10234 | |
| 10235 | /* (set bts 0 cfg back to default) */ |
| 10236 | f_vty_set_imm_ass(BSCVTY); |
| 10237 | |
| 10238 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10239 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10240 | var RSL_IE_Body chan_ident_ie; |
| 10241 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10242 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10243 | mtc.stop; |
| 10244 | } |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10245 | |
| 10246 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10247 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10248 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10249 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10250 | |
| 10251 | /* Only now send the Chan Act ACK */ |
| 10252 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10253 | |
| 10254 | /* Check that the lchan is working */ |
| 10255 | var octetstring l3 := '00010203040506'O; |
| 10256 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10257 | |
| 10258 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10259 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10260 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10261 | |
| 10262 | f_sleep(1.0); |
| 10263 | f_shutdown_helper(); |
| 10264 | } |
| 10265 | |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10266 | testcase TC_imm_ass_pre_ts_ack() runs on test_CT { |
| 10267 | var RSL_Message chan_act; |
| 10268 | var RSL_Message imm_ass; |
| 10269 | |
| 10270 | f_init(1, false); |
| 10271 | f_sleep(1.0); |
| 10272 | |
| 10273 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 10274 | |
| 10275 | /* RA containing reason=LU */ |
| 10276 | var GsmFrameNumber fn := 2342; |
| 10277 | var uint8_t ra := 2; |
| 10278 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10279 | |
| 10280 | /* (set bts 0 cfg back to default) */ |
| 10281 | f_vty_set_imm_ass(BSCVTY); |
| 10282 | |
| 10283 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10284 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
| 10285 | var RSL_IE_Body chan_ident_ie; |
| 10286 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10287 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10288 | mtc.stop; |
| 10289 | } |
| 10290 | |
| 10291 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10292 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10293 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10294 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
| 10295 | |
| 10296 | /* Only now send the Chan Act ACK */ |
| 10297 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10298 | |
| 10299 | /* Check that the lchan is working */ |
| 10300 | var octetstring l3 := '00010203040506'O; |
| 10301 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10302 | |
| 10303 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10304 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10305 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10306 | |
| 10307 | f_sleep(1.0); |
| 10308 | f_shutdown_helper(); |
| 10309 | } |
| 10310 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10311 | testcase TC_imm_ass_pre_chan_ack_dyn_ts() runs on test_CT { |
| 10312 | /* change Timeslot 6 before f_init() starts RSL */ |
| 10313 | f_init_vty(); |
| 10314 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 10315 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10316 | |
| 10317 | f_init(1, false); |
| 10318 | f_sleep(1.0); |
| 10319 | |
| 10320 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 10321 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10322 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10323 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10324 | |
| 10325 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10326 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10327 | |
| 10328 | /* block all static timeslots so that the dyn TS will be used */ |
| 10329 | f_disable_all_tch_f(); |
| 10330 | f_disable_all_tch_h(); |
| 10331 | f_disable_all_sdcch(); |
| 10332 | |
| 10333 | var RSL_Message chan_act; |
| 10334 | var RSL_Message imm_ass; |
| 10335 | |
| 10336 | f_init(1, false); |
| 10337 | f_sleep(1.0); |
| 10338 | |
| 10339 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 10340 | |
| 10341 | /* RA containing reason=LU */ |
| 10342 | var GsmFrameNumber fn := 2342; |
| 10343 | var uint8_t ra := 2; |
| 10344 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10345 | |
| 10346 | /* (set bts 0 cfg back to default) */ |
| 10347 | f_vty_set_imm_ass(BSCVTY); |
| 10348 | |
| 10349 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10350 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10351 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10352 | |
| 10353 | /* Now activation as SDCCH8 */ |
| 10354 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 10355 | |
| 10356 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10357 | var RSL_IE_Body chan_ident_ie; |
| 10358 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10359 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10360 | mtc.stop; |
| 10361 | } |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10362 | |
| 10363 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10364 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10365 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10366 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10367 | |
| 10368 | /* Only now send the Chan Act ACK */ |
| 10369 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10370 | |
| 10371 | /* Check that the lchan is working */ |
| 10372 | var octetstring l3 := '00010203040506'O; |
| 10373 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10374 | |
| 10375 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10376 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10377 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10378 | |
| 10379 | f_sleep(1.0); |
| 10380 | f_shutdown_helper(); |
| 10381 | } |
| 10382 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10383 | testcase TC_imm_ass_pre_ts_ack_dyn_ts() runs on test_CT { |
| 10384 | /* change Timeslot 6 before f_init() starts RSL */ |
| 10385 | f_init_vty(); |
| 10386 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 10387 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10388 | |
| 10389 | f_init(1, false); |
| 10390 | f_sleep(1.0); |
| 10391 | |
| 10392 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 10393 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10394 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10395 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10396 | |
| 10397 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10398 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10399 | |
| 10400 | /* block all static timeslots so that the dyn TS will be used */ |
| 10401 | f_disable_all_tch_f(); |
| 10402 | f_disable_all_tch_h(); |
| 10403 | f_disable_all_sdcch(); |
| 10404 | |
| 10405 | var RSL_Message chan_act; |
| 10406 | var RSL_Message imm_ass; |
| 10407 | |
| 10408 | f_init(1, false); |
| 10409 | f_sleep(1.0); |
| 10410 | |
| 10411 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 10412 | |
| 10413 | /* RA containing reason=LU */ |
| 10414 | var GsmFrameNumber fn := 2342; |
| 10415 | var uint8_t ra := 2; |
| 10416 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10417 | |
| 10418 | /* (set bts 0 cfg back to default) */ |
| 10419 | f_vty_set_imm_ass(BSCVTY); |
| 10420 | |
| 10421 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10422 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10423 | |
| 10424 | /* And already the Immediate Assignment even before the PDCH Deact ACK */ |
| 10425 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10426 | |
| 10427 | /* continue the Osmo style PDCH Deact (usual chan rel) */ |
| 10428 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10429 | |
| 10430 | /* Now activation as SDCCH8 */ |
| 10431 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 10432 | |
| 10433 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10434 | var RSL_IE_Body chan_ident_ie; |
| 10435 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10436 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10437 | mtc.stop; |
| 10438 | } |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10439 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10440 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10441 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10442 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10443 | |
| 10444 | /* Check that the lchan is working */ |
| 10445 | var octetstring l3 := '00010203040506'O; |
| 10446 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10447 | |
| 10448 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10449 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10450 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10451 | |
| 10452 | f_sleep(1.0); |
| 10453 | f_shutdown_helper(); |
| 10454 | } |
| 10455 | |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 10456 | /* GET and SET the bts.N.trx.M.rf_locked CTRL variable */ |
| 10457 | testcase TC_ctrl_trx_rf_locked() runs on test_CT { |
| 10458 | var MSC_ConnHdlr vc_conn; |
| 10459 | |
| 10460 | f_init(nr_bts := 2, handler_mode := true, nr_msc := 1); |
| 10461 | f_sleep(1.0); |
| 10462 | |
| 10463 | /* BTS 0, 1, 2 are OML unlocked, only BTS 0, 1 are actually connected to RSL. */ |
| 10464 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10465 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10466 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10467 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10468 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10469 | |
| 10470 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock BTS 1 TRX 0"); |
| 10471 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10472 | /* give it a moment to settle the FSM status */ |
| 10473 | f_sleep(1.0); |
| 10474 | |
| 10475 | /* Now BTS 1 TRX 0 should reflect "locked". Note the RF policy stays "on", because this is still handled |
| 10476 | * globally in osmo-bsc. Probably after sending "rf_locked 1" for a TRX, that TRX should reflect an RF policy |
| 10477 | * of "off"? But that's for a future patch if at all. */ |
| 10478 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10479 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10480 | "1,0,operational,locked,on,rsl-up;" & |
| 10481 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10482 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10483 | |
| 10484 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock the already locked TRX, nothing should change"); |
| 10485 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10486 | f_sleep(1.0); |
| 10487 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10488 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10489 | "1,0,operational,locked,on,rsl-up;" & |
| 10490 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10491 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10492 | |
| 10493 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock BTS 1 TRX 0"); |
| 10494 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "0"); |
| 10495 | f_sleep(1.0); |
| 10496 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10497 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10498 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10499 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10500 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10501 | |
| 10502 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an already unlocked TRX, nothing should change"); |
| 10503 | f_ctrl_set(IPA_CTRL, "bts.0.trx.0.rf_locked", "0"); |
| 10504 | f_sleep(1.0); |
| 10505 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10506 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10507 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10508 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10509 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10510 | |
| 10511 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an inoperational TRX"); |
| 10512 | f_ctrl_set(IPA_CTRL, "bts.3.trx.0.rf_locked", "0"); |
| 10513 | f_sleep(1.0); |
| 10514 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10515 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10516 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10517 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10518 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10519 | |
| 10520 | f_shutdown_helper(); |
| 10521 | } |
| 10522 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10523 | const CounterNameVals counternames_cm_serv_rej := { |
| 10524 | { "cm_serv_rej", 0 }, |
| 10525 | { "cm_serv_rej:imsi_unknown_in_hlr", 0 }, |
| 10526 | { "cm_serv_rej:illegal_ms", 0 }, |
| 10527 | { "cm_serv_rej:imsi_unknown_in_vlr", 0 }, |
| 10528 | { "cm_serv_rej:imei_not_accepted", 0 }, |
| 10529 | { "cm_serv_rej:illegal_me", 0 }, |
| 10530 | { "cm_serv_rej:plmn_not_allowed", 0 }, |
| 10531 | { "cm_serv_rej:loc_not_allowed", 0 }, |
| 10532 | { "cm_serv_rej:roaming_not_allowed", 0 }, |
| 10533 | { "cm_serv_rej:network_failure", 0 }, |
| 10534 | { "cm_serv_rej:synch_failure", 0 }, |
| 10535 | { "cm_serv_rej:congestion", 0 }, |
| 10536 | { "cm_serv_rej:srv_opt_not_supported", 0 }, |
| 10537 | { "cm_serv_rej:rqd_srv_opt_not_supported", 0 }, |
| 10538 | { "cm_serv_rej:srv_opt_tmp_out_of_order", 0 }, |
| 10539 | { "cm_serv_rej:call_can_not_be_identified", 0 }, |
| 10540 | { "cm_serv_rej:incorrect_message", 0 }, |
| 10541 | { "cm_serv_rej:invalid_mandantory_inf", 0 }, |
| 10542 | { "cm_serv_rej:msg_type_not_implemented", 0 }, |
| 10543 | { "cm_serv_rej:msg_type_not_compatible", 0 }, |
| 10544 | { "cm_serv_rej:inf_eleme_not_implemented", 0 }, |
| 10545 | { "cm_serv_rej:condtional_ie_error", 0 }, |
| 10546 | { "cm_serv_rej:msg_not_compatible", 0 }, |
| 10547 | { "cm_serv_rej:protocol_error", 0 }, |
| 10548 | { "cm_serv_rej:retry_in_new_cell", 0 } |
| 10549 | }; |
| 10550 | |
| 10551 | private function f_TC_cm_serv_rej(charstring id) runs on MSC_ConnHdlr |
| 10552 | { |
| 10553 | f_create_chan_and_exp(); |
Vadim Yanitskiy | a7fc5a6 | 2021-12-04 20:10:08 +0300 | [diff] [blame] | 10554 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10555 | BSSAP.send(ts_PDU_DTAP_MT(ts_CM_SERV_REJ('02'O), '00'O)); |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 10556 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10557 | } |
| 10558 | testcase TC_cm_serv_rej() runs on test_CT { |
| 10559 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10560 | var MSC_ConnHdlr vc_conn; |
| 10561 | |
| 10562 | f_init(1, true); |
| 10563 | f_sleep(1.0); |
| 10564 | |
| 10565 | f_ctrs_bts_init(1, counternames_cm_serv_rej); |
| 10566 | |
| 10567 | vc_conn := f_start_handler(refers(f_TC_cm_serv_rej), pars); |
| 10568 | vc_conn.done; |
| 10569 | |
| 10570 | f_ctrs_bts_add(0, "cm_serv_rej", 1); |
| 10571 | f_ctrs_bts_add(0, "cm_serv_rej:imsi_unknown_in_hlr", 1); |
| 10572 | f_ctrs_bts_verify(); |
| 10573 | |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 10574 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10575 | f_shutdown_helper(); |
| 10576 | } |
| 10577 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10578 | /* Reproduce a segfault happening when the SDCCH (primary) lchan is lost in-between a TCH Channel Activ and its Channel |
| 10579 | * Activ Ack (SYS#5627). */ |
| 10580 | private function f_TC_lost_sdcch_during_assignment(charstring id) runs on MSC_ConnHdlr { |
| 10581 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Vadim Yanitskiy | f0310e3 | 2021-10-26 00:30:59 +0300 | [diff] [blame] | 10582 | |
| 10583 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10584 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10585 | |
| 10586 | var BSSMAP_FIELD_CodecType codecType; |
| 10587 | codecType := valueof(ass_cmd.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType); |
| 10588 | |
| 10589 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 10590 | |
| 10591 | /* First establish a signalling lchan */ |
| 10592 | f_create_chan_and_exp(); |
| 10593 | f_rslem_dchan_queue_enable(); |
| 10594 | |
| 10595 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10596 | |
| 10597 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 10598 | activate(as_Media_mgw()); |
| 10599 | |
| 10600 | var RslChannelNr chan_nr := { u := { ch0 := RSL_CHAN_NR_Bm_ACCH }, tn := 1 }; |
| 10601 | f_rslem_register(0, chan_nr); |
| 10602 | |
| 10603 | f_rslem_set_auto_chan_act_ack(RSL_PROC, false); |
| 10604 | BSSAP.send(ass_cmd); |
| 10605 | |
| 10606 | |
| 10607 | /* Wait for the Channel Activ for the TCH channel */ |
| 10608 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10609 | RSL.receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), sid := ?)) -> value rx_rsl_ud; |
| 10610 | |
| 10611 | /* make the original SDCCH disappear */ |
| 10612 | RSL.send(ts_RSL_REL_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 10613 | |
| 10614 | /* and ACK the TCH channel activation. This caused a segfault up to OsmoBSC 1.7.0 (SYS#5627) */ |
| 10615 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_ACK(chan_nr, 23), rx_rsl_ud.streamId)); |
| 10616 | |
| 10617 | interleave { |
| 10618 | [] BSSAP.receive(tr_BSSMAP_AssignmentFail); |
| 10619 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 10620 | } |
| 10621 | |
| 10622 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 10623 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 10624 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 10625 | |
| 10626 | var MgcpCommand mgcp; |
| 10627 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 10628 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 10629 | }; |
| 10630 | |
| 10631 | f_sleep(0.5); |
| 10632 | } |
| 10633 | testcase TC_lost_sdcch_during_assignment() runs on test_CT { |
| 10634 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10635 | var MSC_ConnHdlr vc_conn; |
| 10636 | |
| 10637 | f_init(1, true); |
| 10638 | f_sleep(1.0); |
| 10639 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10640 | vc_conn := f_start_handler(refers(f_TC_lost_sdcch_during_assignment), pars); |
| 10641 | vc_conn.done; |
| 10642 | |
| 10643 | f_shutdown_helper(); |
| 10644 | } |
| 10645 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 10646 | const CounterNameVals counternames_bsc_bts_all_available_allocated := { |
| 10647 | { "all_allocated:sdcch", 0 }, |
| 10648 | { "all_allocated:static_sdcch", 0 }, |
| 10649 | { "all_allocated:tch", 0 }, |
| 10650 | { "all_allocated:static_tch", 0 } |
| 10651 | } |
| 10652 | |
| 10653 | private function f_all_allocated_expect_counter_change(charstring_list expect_changed) runs on test_CT |
| 10654 | { |
| 10655 | /* Make sure counters settle first */ |
| 10656 | f_sleep(1.0); |
| 10657 | |
| 10658 | /* Take a baseline of counters */ |
| 10659 | f_ctrs_bsc_and_bts_init(1, counternames_bsc_bts_all_available_allocated); |
| 10660 | |
| 10661 | /* Elapse some time so that we see changes in counters, hopefully where expected */ |
| 10662 | f_sleep(2.0); |
| 10663 | |
| 10664 | /* Get new counters */ |
| 10665 | var charstring_list all_changed := {}; |
| 10666 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 10667 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bts", g_ctr_bts); |
| 10668 | |
| 10669 | /* Compare with expectations */ |
| 10670 | var charstring_list all_expect_changed := {}; |
| 10671 | for (var integer i := 0; i < lengthof(expect_changed); i := i + 1) { |
| 10672 | all_expect_changed := all_expect_changed & { "bsc.0." & expect_changed[i], "bts.0." & expect_changed[i] }; |
| 10673 | } |
| 10674 | f_counter_name_vals_expect_changed_list(all_changed, all_expect_changed); |
| 10675 | } |
| 10676 | |
| 10677 | testcase TC_ratectr_all_available_allocated() runs on test_CT { |
| 10678 | var ASP_RSL_Unitdata rsl_ud; |
| 10679 | var integer i; |
| 10680 | var integer chreq_total, chreq_nochan; |
| 10681 | |
| 10682 | f_init(1); |
| 10683 | f_sleep(1.0); |
| 10684 | |
| 10685 | /* Exhaust all dedicated SDCCH lchans. |
| 10686 | /* GSM 44.018 Table 9.1.8.2: |
| 10687 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 10688 | */ |
| 10689 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
| 10690 | f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 10691 | } |
| 10692 | |
| 10693 | /* Since only bts 0 is connected, expecting all_allocated to become true for both bts 0 and the "global" bsc |
| 10694 | * level. |
| 10695 | * All SDCCH are now occupied. */ |
| 10696 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 10697 | |
| 10698 | /* Also fill up all remaining (TCH) channels */ |
| 10699 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS; i := i+1) { |
| 10700 | f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 10701 | } |
| 10702 | |
| 10703 | /* All TCH are now also occupied */ |
| 10704 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 10705 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 10706 | |
| 10707 | f_shutdown_helper(); |
| 10708 | } |
| 10709 | |
| 10710 | testcase TC_ratectr_all_available_allocated_dyn() runs on test_CT { |
| 10711 | var ASP_RSL_Unitdata rsl_ud; |
| 10712 | var integer i; |
| 10713 | var integer chreq_total, chreq_nochan; |
| 10714 | |
| 10715 | f_init_vty(); |
| 10716 | f_ts_set_chcomb(0, 0, 2, "TCH/F_TCH/H_PDCH"); |
| 10717 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10718 | /* Now we have 3 TCH/F, 1 OSMO_DYN, 1 TCH/H */ |
| 10719 | |
| 10720 | f_init(1, guard_timeout := 60.0); |
| 10721 | f_sleep(1.0); |
| 10722 | |
| 10723 | /* The dyn TS wants to activate PDCH mode, ACK that. */ |
| 10724 | var RslChannelNr chan_nr; |
| 10725 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10726 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 10727 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 10728 | |
| 10729 | /* Exhaust all dedicated SDCCH lchans. |
| 10730 | /* GSM 44.018 Table 9.1.8.2: |
| 10731 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 10732 | */ |
| 10733 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
| 10734 | f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 10735 | } |
| 10736 | |
| 10737 | /* The static SDCCH should now be occupied, while still 3x8 dynamic SDCCH potentially remain. So only |
| 10738 | * all_allocated:static_sdcch is counted, all_allocated:sdcch remains zero. */ |
| 10739 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch"}); |
| 10740 | |
| 10741 | /* Request more SDCCH, hence convert the first dyn TS to SDCCH8. |
| 10742 | * Will release them later, so remember all the DchanTuples. */ |
| 10743 | var DchanTuples dyn_sddch := {}; |
| 10744 | dyn_sddch := dyn_sddch & { f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
| 10745 | |
| 10746 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 10747 | for (i := 0; i < 7; i := i+1) { |
| 10748 | dyn_sddch := dyn_sddch & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
| 10749 | } |
| 10750 | |
| 10751 | /* Now all dynamic SDCCH are also occupied, so for the first time all_allocated:sdcch will trigger... */ |
| 10752 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 10753 | |
| 10754 | /* occupy the remaining TCH, three TCH/F and two TCH/H lchans */ |
| 10755 | for (i := 0; i < 5; i := i+1) { |
| 10756 | f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O); |
| 10757 | } |
| 10758 | |
| 10759 | /* All TCH lchans are now also occupied, both static and dynamic */ |
| 10760 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 10761 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 10762 | |
| 10763 | /* Starting to release the dyn TS: as soon as the first SDCCH gets released, all_allocated:sdcch stops |
| 10764 | * incrementing. */ |
| 10765 | var BssmapCause cause := 0; |
| 10766 | var DchanTuple dt := dyn_sddch[0]; |
| 10767 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 10768 | f_exp_chan_rel_and_clear(dt, 0); |
| 10769 | |
| 10770 | /* one dyn TS SDCCH is free again, so only the static_sdcch should increment. For tch, both static and dynamic |
| 10771 | * count as occupied, so those still both increment. */ |
| 10772 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", |
| 10773 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 10774 | |
| 10775 | /* Release the remaining SDCCH of the dyn TS, so it becomes available as TCH again */ |
| 10776 | for (i := 1; i < lengthof(dyn_sddch); i := i+1) { |
| 10777 | dt := dyn_sddch[i]; |
| 10778 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 10779 | f_exp_chan_rel_and_clear(dt, 0); |
| 10780 | } |
| 10781 | |
| 10782 | /* All SDCCH on the dyn TS are released, the dyn TS wants to activate PDCH again */ |
| 10783 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10784 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 10785 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 10786 | |
| 10787 | /* Now all channels are occupied except the dyn TS, so expecting only the static counters to increment */ |
| 10788 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", "all_allocated:static_tch"}); |
| 10789 | |
| 10790 | /* clean up config */ |
| 10791 | f_ts_reset_chcomb(0); |
| 10792 | |
| 10793 | f_shutdown_helper(); |
| 10794 | } |
| 10795 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 10796 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10797 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10798 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 10799 | execute( TC_ctrl_msc0_connection_status() ); |
Neels Hofmeyr | f65ce87 | 2021-09-23 18:40:10 +0200 | [diff] [blame] | 10800 | /* In SCCPlite tests, only one MSC is configured. These tests assume that three MSCs are configured, so only run |
| 10801 | * these in the AoIP test suite. */ |
| 10802 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10803 | execute( TC_stat_num_msc_connected_1() ); |
| 10804 | execute( TC_stat_num_msc_connected_2() ); |
| 10805 | execute( TC_stat_num_msc_connected_3() ); |
| 10806 | } |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 10807 | execute( TC_stat_num_bts_connected_1() ); |
| 10808 | execute( TC_stat_num_bts_connected_2() ); |
| 10809 | execute( TC_stat_num_bts_connected_3() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 10810 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10811 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 10812 | execute( TC_ctrl_location() ); |
| 10813 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10814 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 10815 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 10816 | execute( TC_si2quater_2_earfcns() ); |
| 10817 | execute( TC_si2quater_3_earfcns() ); |
| 10818 | execute( TC_si2quater_4_earfcns() ); |
| 10819 | execute( TC_si2quater_5_earfcns() ); |
| 10820 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 10821 | execute( TC_si2quater_12_earfcns() ); |
| 10822 | execute( TC_si2quater_23_earfcns() ); |
| 10823 | execute( TC_si2quater_32_earfcns() ); |
| 10824 | execute( TC_si2quater_33_earfcns() ); |
| 10825 | execute( TC_si2quater_42_earfcns() ); |
| 10826 | execute( TC_si2quater_48_earfcns() ); |
| 10827 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 10828 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 10829 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 10830 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10831 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10832 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10833 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10834 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 10835 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 10836 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10837 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 10838 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 10839 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 10840 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 10841 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10842 | execute( TC_chan_rel_rll_rel_ind() ); |
| 10843 | execute( TC_chan_rel_conn_fail() ); |
| 10844 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 10845 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 10846 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 10847 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 10848 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 10849 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 10850 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 10851 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 10852 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 10853 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 10854 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10855 | |
| 10856 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 10857 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10858 | execute( TC_assignment_csd() ); |
| 10859 | execute( TC_assignment_ctm() ); |
| 10860 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 10861 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10862 | execute( TC_assignment_aoip_tla_v6() ); |
| 10863 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10864 | execute( TC_assignment_fr_a5_0() ); |
| 10865 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10866 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 10867 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 10868 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10869 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 10870 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 10871 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 10872 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 10873 | execute( TC_ciph_mode_a5_0() ); |
| 10874 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 10875 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 10876 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 10877 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 10878 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 10879 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10880 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 10881 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10882 | execute( TC_assignment_codec_hr() ); |
| 10883 | execute( TC_assignment_codec_efr() ); |
| 10884 | execute( TC_assignment_codec_amr_f() ); |
| 10885 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10886 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10887 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10888 | execute( TC_assignment_codec_amr_f_S1() ); |
| 10889 | execute( TC_assignment_codec_amr_h_S1() ); |
| 10890 | execute( TC_assignment_codec_amr_f_S124() ); |
| 10891 | execute( TC_assignment_codec_amr_h_S124() ); |
| 10892 | execute( TC_assignment_codec_amr_f_S0() ); |
| 10893 | execute( TC_assignment_codec_amr_f_S02() ); |
| 10894 | execute( TC_assignment_codec_amr_f_S024() ); |
| 10895 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 10896 | execute( TC_assignment_codec_amr_h_S0() ); |
| 10897 | execute( TC_assignment_codec_amr_h_S02() ); |
| 10898 | execute( TC_assignment_codec_amr_h_S024() ); |
| 10899 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 10900 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 10901 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 10902 | execute( TC_assignment_codec_amr_f_zero() ); |
| 10903 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 10904 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 10905 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 10906 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 10907 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 10908 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 10909 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10910 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10911 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10912 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 10913 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 10914 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 10915 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 10916 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 10917 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 10918 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 10919 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 10920 | execute( TC_assignment_codec_req_hr_fr() ); |
| 10921 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 10922 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 10923 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 10924 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10925 | |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 10926 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 10927 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10928 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 10929 | execute( TC_rll_est_ind_inact_lchan() ); |
| 10930 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 10931 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 10932 | execute( TC_rll_est_ind_inval_sacch() ); |
| 10933 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 10934 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 10935 | execute( TC_tch_dlci_link_id_sapi() ); |
| 10936 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 10937 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 10938 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 10939 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 10940 | execute( TC_rll_timeout_sapi_n_reject() ); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 10941 | execute( TC_rll_sapi_n_reject_dlci_cc() ); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 10942 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10943 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 10944 | execute( TC_paging_imsi_nochan() ); |
| 10945 | execute( TC_paging_tmsi_nochan() ); |
| 10946 | execute( TC_paging_tmsi_any() ); |
| 10947 | execute( TC_paging_tmsi_sdcch() ); |
| 10948 | execute( TC_paging_tmsi_tch_f() ); |
| 10949 | execute( TC_paging_tmsi_tch_hf() ); |
| 10950 | execute( TC_paging_imsi_nochan_cgi() ); |
| 10951 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 10952 | execute( TC_paging_imsi_nochan_ci() ); |
| 10953 | execute( TC_paging_imsi_nochan_lai() ); |
| 10954 | execute( TC_paging_imsi_nochan_lac() ); |
| 10955 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 10956 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 10957 | execute( TC_paging_imsi_nochan_rnc() ); |
| 10958 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 10959 | execute( TC_paging_imsi_nochan_lacs() ); |
| 10960 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 10961 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 10962 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 10963 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 10964 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 10965 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 10966 | |
| 10967 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 10968 | execute( TC_rsl_unknown_unit_id() ); |
| 10969 | |
| 10970 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10971 | |
| 10972 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 10973 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10974 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 10975 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 10976 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 10977 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 10978 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10979 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 10980 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 10981 | execute( TC_ho_int_a5_0() ); |
| 10982 | execute( TC_ho_int_a5_1() ); |
| 10983 | execute( TC_ho_int_a5_3() ); |
| 10984 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 10985 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10986 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 10987 | /* TC_ho_out_of_this_bsc is run last, see comment below */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 10988 | execute( TC_ho_out_fail_no_msc_response() ); |
| 10989 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 10990 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10991 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10992 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 10993 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 10994 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 10995 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 10996 | execute( TC_ho_into_this_bsc_a5_4() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 10997 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10998 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 10999 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 11000 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 11001 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 11002 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 11003 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 11004 | execute( TC_ho_in_fail_msc_clears() ); |
| 11005 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 11006 | execute( TC_ho_in_fail_no_detect() ); |
| 11007 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 11008 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 11009 | execute( TC_ho_neighbor_config_1() ); |
| 11010 | execute( TC_ho_neighbor_config_2() ); |
| 11011 | execute( TC_ho_neighbor_config_3() ); |
| 11012 | execute( TC_ho_neighbor_config_4() ); |
| 11013 | execute( TC_ho_neighbor_config_5() ); |
| 11014 | execute( TC_ho_neighbor_config_6() ); |
| 11015 | execute( TC_ho_neighbor_config_7() ); |
| 11016 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 11017 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 11018 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 11019 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 11020 | |
| 11021 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 11022 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 11023 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 11024 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | 37a4c15 | 2021-11-16 19:02:23 +0100 | [diff] [blame] | 11025 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 11026 | execute( TC_dyn_ts_sdcch8_all_subslots_used() ); |
| 11027 | execute( TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 11028 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11029 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 11030 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 11031 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 11032 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 11033 | /* Power control related */ |
| 11034 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 11035 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 11036 | |
| 11037 | /* MSC pooling */ |
| 11038 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 11039 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 11040 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 11041 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 11042 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 11043 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 11044 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 11045 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 11046 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 11047 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 11048 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 11049 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 11050 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 11051 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 11052 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 11053 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 11054 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 11055 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 11056 | } |
| 11057 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11058 | execute( TC_early_conn_fail() ); |
| 11059 | execute( TC_late_conn_fail() ); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 11060 | execute( TC_stats_conn_fail() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11061 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 11062 | /* Emergency call handling (deny / allow) */ |
| 11063 | execute( TC_assignment_emerg_setup_allow() ); |
| 11064 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 11065 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 11066 | execute( TC_emerg_premption() ); |
| 11067 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 11068 | /* Frequency hopping parameters handling */ |
| 11069 | execute( TC_fh_params_chan_activ() ); |
| 11070 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 11071 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 11072 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 11073 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 11074 | |
| 11075 | if (mp_enable_lcs_tests) { |
| 11076 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 11077 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 11078 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 11079 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 11080 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 11081 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 11082 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 11083 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 11084 | execute( TC_ho_during_lcs_loc_req() ); |
| 11085 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 11086 | |
| 11087 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 11088 | |
| 11089 | execute( TC_refuse_chan_act_to_vamos() ); |
| 11090 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11091 | |
| 11092 | execute( TC_reassignment_fr() ); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11093 | |
| 11094 | execute( TC_cm_reestablishment() ); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11095 | |
| 11096 | execute( TC_imm_ass_post_chan_ack() ); |
| 11097 | execute( TC_imm_ass_pre_chan_ack() ); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11098 | execute( TC_imm_ass_pre_ts_ack() ); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11099 | execute( TC_imm_ass_pre_chan_ack_dyn_ts() ); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11100 | execute( TC_imm_ass_pre_ts_ack_dyn_ts() ); |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11101 | |
| 11102 | execute( TC_ctrl_trx_rf_locked() ); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11103 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11104 | execute( TC_ratectr_all_available_allocated() ); |
| 11105 | execute( TC_ratectr_all_available_allocated_dyn() ); |
| 11106 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11107 | execute( TC_cm_serv_rej() ); |
| 11108 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11109 | execute( TC_lost_sdcch_during_assignment() ); |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 11110 | |
| 11111 | /* Run TC_ho_out_of_this_bsc last, because it may trigger a segfault before osmo-bsc's patch |
| 11112 | * with change-id I5a3345ab0005a73597f5c27207480912a2f5aae6 */ |
| 11113 | execute( TC_ho_out_of_this_bsc() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 11114 | } |
| 11115 | |
| 11116 | } |