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 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 23 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 24 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 25 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 26 | import from IPL4asp_Types all; |
| 27 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 28 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 29 | import from RAN_Adapter all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 30 | import from BSSAP_CodecPort all; |
| 31 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 32 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 33 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 34 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 35 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 36 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 37 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 38 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 39 | import from MGCP_Templates all; |
| 40 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 41 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 42 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 43 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 44 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 45 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 46 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 47 | import from Osmocom_VTY_Functions all; |
| 48 | import from TELNETasp_PortType all; |
| 49 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 50 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 51 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 52 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 53 | import from L3_Templates all; |
| 54 | import from GSM_RR_Types all; |
| 55 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 56 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 57 | import from BSSMAP_Templates all; |
| 58 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 59 | import from SCCPasp_Types all; |
| 60 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 61 | const integer NUM_BTS := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 62 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 63 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 64 | /* 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] | 65 | const integer NUM_TCHH_PER_BTS := 2; |
| 66 | const integer NUM_TCHF_PER_BTS := 4; |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 67 | const integer NUM_SDCCH_PER_BTS := 4; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 68 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 69 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 70 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 71 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 72 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 73 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 74 | } |
| 75 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 76 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 77 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 78 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 79 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 80 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 81 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 82 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 83 | 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] | 84 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 85 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 86 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 87 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 88 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 89 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 90 | var RAN_Adapter g_bssap; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 91 | /* for old legacy-tests only */ |
| 92 | port BSSAP_CODEC_PT BSSAP; |
| 93 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 94 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 95 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 96 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 97 | /* Osmux is enabled through VTY */ |
| 98 | var boolean g_osmux_enabled := false; |
| 99 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 100 | /*Configure T(tias) over VTY, seconds */ |
| 101 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 102 | /*Configure T(tiar) over VTY, seconds */ |
| 103 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 104 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 105 | /* global test case guard timer */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 106 | timer T_guard := 30.0; |
| 107 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 111 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 112 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 113 | /* port number to which to establish the IPA OML connections */ |
| 114 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 115 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 116 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 117 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 118 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 119 | /* IP address at which the test binds */ |
| 120 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 121 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 122 | RAN_Configuration mp_bssap_cfg := { |
Harald Welte | 7ef51aa | 2018-04-16 19:16:01 +0200 | [diff] [blame] | 123 | transport := BSSAP_TRANSPORT_AoIP, |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 124 | sccp_service_type := "mtp3_itu", |
| 125 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 126 | own_pc := 185, |
| 127 | own_ssn := 254, |
| 128 | peer_pc := 187, |
| 129 | peer_ssn := 254, |
Philipp Maier | 38d6894 | 2018-03-29 15:38:09 +0200 | [diff] [blame] | 130 | sio := '83'O, |
| 131 | rctx := 0 |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 132 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 133 | |
| 134 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 135 | unconditionally once new version of osmo-bsc is released (current |
| 136 | version: 1.4.1) */ |
| 137 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 138 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 139 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 140 | } |
| 141 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 142 | private function f_gen_test_hdlr_pars() return TestHdlrParams { |
| 143 | |
| 144 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 145 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 146 | pars.aoip := true; |
| 147 | } else { |
| 148 | pars.aoip := false; |
| 149 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 150 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 151 | |
| 152 | return pars; |
| 153 | } |
| 154 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 155 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 156 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 157 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 158 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 159 | } |
| 160 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 161 | private function f_legacy_bssap_reset() runs on test_CT { |
| 162 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 163 | timer T := 5.0; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 164 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 165 | T.start; |
| 166 | alt { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 167 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 168 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 169 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 170 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 171 | log("Respoding to inbound RESET with RESET-ACK"); |
| 172 | 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] | 173 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 174 | repeat; |
| 175 | } |
| 176 | [] BSSAP.receive { repeat; } |
| 177 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 178 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 179 | } |
| 180 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 181 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 182 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 183 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 184 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 185 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 186 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 187 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 188 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 189 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 190 | } |
| 191 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 192 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 193 | * \param clnt IPA_Client for which to establish |
| 194 | * \param bsc_host IP address / hostname of the BSC |
| 195 | * \param bsc_port TCP port number of the BSC |
| 196 | * \param i number identifying this BTS |
| 197 | * \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] | 198 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 199 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 200 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 201 | timer T := 10.0; |
| 202 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 203 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 204 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 205 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 206 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 207 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 208 | if (handler_mode) { |
| 209 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 210 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 211 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 212 | |
| 213 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 214 | if (handler_mode) { |
| 215 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 216 | } else { |
| 217 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 218 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 219 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 220 | 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] | 221 | if (handler_mode) { |
| 222 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 223 | return; |
| 224 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 225 | |
| 226 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 227 | T.start; |
| 228 | alt { |
| 229 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 230 | T.stop; |
| 231 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 232 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 233 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 234 | [] IPA_RSL[i].receive { repeat } |
| 235 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 236 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 237 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 242 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 243 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 244 | return; |
| 245 | } |
| 246 | clnt.vc_IPA.stop; |
| 247 | if (isbound(clnt.vc_RSL)) { |
| 248 | clnt.vc_RSL.stop; |
| 249 | } |
| 250 | } |
| 251 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 252 | /* 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] | 253 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 254 | timer T := secs_max; |
| 255 | T.start; |
| 256 | while (true) { |
| 257 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 258 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 259 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 260 | * until all MO's are initialized */ |
| 261 | T.start(1.0); |
| 262 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 263 | return; |
| 264 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 265 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 266 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 267 | 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] | 268 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 273 | /* 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] | 274 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 275 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 276 | [] T_guard.timeout { |
| 277 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 278 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 279 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 280 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 281 | [] 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] | 282 | 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] | 283 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 284 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 285 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 286 | } |
| 287 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 288 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 289 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 290 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 291 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 295 | function f_init_mgcp(charstring id) runs on test_CT { |
| 296 | id := id & "-MGCP"; |
| 297 | |
| 298 | var MGCPOps ops := { |
| 299 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 300 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 301 | }; |
| 302 | var MGCP_conn_parameters mgcp_pars := { |
| 303 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 304 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 305 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 306 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 307 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 308 | the on with MGCP over IPA forwarded from MSC one) */ |
| 309 | multi_conn_mode := (mp_bssap_cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 310 | }; |
| 311 | |
| 312 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 313 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 314 | } |
| 315 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 316 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 317 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 318 | * OsmuxCID IE. |
| 319 | */ |
| 320 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 321 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 322 | if (allow) { |
| 323 | f_vty_transceive(BSCVTY, "osmux on"); |
| 324 | } else { |
| 325 | f_vty_transceive(BSCVTY, "osmux off"); |
| 326 | } |
| 327 | f_vty_transceive(BSCVTY, "exit"); |
| 328 | f_vty_transceive(BSCVTY, "exit"); |
| 329 | g_osmux_enabled := allow; |
| 330 | } |
| 331 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 332 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 333 | if (BSCVTY.checkstate("Mapped")) { |
| 334 | /* skip initialization if already executed once */ |
| 335 | return; |
| 336 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 337 | map(self:BSCVTY, system:BSCVTY); |
| 338 | f_vty_set_prompts(BSCVTY); |
| 339 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 340 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 341 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 342 | } |
| 343 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 344 | /* global initialization function |
| 345 | * \param nr_bts Number of BTSs we should start/bring up |
| 346 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 347 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false) runs on test_CT { |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 348 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 349 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 350 | if (g_initialized) { |
| 351 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 352 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 353 | g_initialized := true; |
| 354 | |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 355 | T_guard.start; |
| 356 | activate(as_Tguard()); |
| 357 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 358 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 359 | if (mp_enable_osmux_test) { |
| 360 | f_vty_allow_osmux(allow_osmux); |
| 361 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 362 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 363 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 364 | * MSC-side BSSAP emulation */ |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 365 | if (handler_mode) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 366 | var RanOps ranops := MSC_RanOps; |
| 367 | ranops.use_osmux := g_osmux_enabled; |
| 368 | f_ran_adapter_init(g_bssap, mp_bssap_cfg, "VirtMSC", ranops); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 369 | connect(self:SCCPLITE_IPA_CTRL, g_bssap.vc_RAN:CTRL_CLIENT); |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 370 | f_ran_adapter_start(g_bssap); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 371 | } else { |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 372 | f_ran_adapter_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 373 | connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT); |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 374 | f_ran_adapter_start(g_bssap); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 375 | f_legacy_bssap_reset(); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 376 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 377 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 378 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 379 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 380 | f_init_mgcp("VirtMSC"); |
| 381 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 382 | for (i := 0; i < nr_bts; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 383 | /* wait until osmo-bts-omldummy has respawned */ |
| 384 | f_wait_oml(i, "degraded", 5.0); |
| 385 | /* start RSL connection */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 386 | f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i, handler_mode); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 387 | /* wait until BSC tells us "connected" */ |
| 388 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 389 | } |
| 390 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 391 | } |
| 392 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 393 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 394 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 395 | runs on test_CT return RSL_Message { |
| 396 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 397 | timer T := t_secs; |
| 398 | |
| 399 | T.start; |
| 400 | alt { |
| 401 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 402 | T.stop; |
| 403 | } |
| 404 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 405 | [] T.timeout { |
| 406 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 407 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 408 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 409 | } |
| 410 | return rx_rsl_ud.rsl; |
| 411 | } |
| 412 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 413 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 414 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 415 | runs on test_CT { |
| 416 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 417 | } |
| 418 | |
| 419 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 420 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 421 | testcase TC_chan_act_noreply() runs on test_CT { |
| 422 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 423 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 424 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 425 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 426 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 427 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 428 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 429 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 430 | } |
| 431 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 432 | /* verify if the "chreq:total" counter increments as expected */ |
| 433 | testcase TC_chan_act_counter() runs on test_CT { |
| 434 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 435 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 436 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 437 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 438 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 439 | |
| 440 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 441 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 442 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 443 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 444 | |
| 445 | setverdict(pass); |
| 446 | } |
| 447 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 448 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 449 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 450 | var RSL_Message rx_rsl; |
| 451 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 452 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 453 | |
| 454 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 455 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 456 | |
| 457 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 458 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 459 | |
| 460 | setverdict(pass); |
| 461 | } |
| 462 | |
| 463 | /* Test behavior if MSC never answers to CR */ |
| 464 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 465 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 466 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 467 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 468 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 469 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 470 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 471 | |
| 472 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 473 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 474 | |
| 475 | var octetstring l3 := '00010203040506'O |
| 476 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 477 | |
| 478 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 479 | |
| 480 | /* 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] | 481 | /* 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] | 482 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 483 | setverdict(pass); |
| 484 | } |
| 485 | |
| 486 | /* Test behavior if MSC answers with CREF to CR */ |
| 487 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 488 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 489 | var RSL_Message rx_rsl; |
| 490 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 491 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 492 | |
| 493 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 494 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 495 | |
| 496 | var octetstring l3 := '00010203040506'O |
| 497 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 498 | |
| 499 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 500 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 501 | |
| 502 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 503 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 504 | setverdict(pass); |
| 505 | } |
| 506 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 507 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 508 | testcase TC_chan_act_nack() runs on test_CT { |
| 509 | var RSL_Message rx_rsl; |
| 510 | var integer chact_nack; |
| 511 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 512 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 513 | |
| 514 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 515 | |
| 516 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 517 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 518 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 519 | |
| 520 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 521 | |
| 522 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 523 | f_sleep(0.5); |
| 524 | |
| 525 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 526 | |
| 527 | setverdict(pass); |
| 528 | } |
| 529 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 530 | /* Test for channel exhaustion due to RACH overload */ |
| 531 | testcase TC_chan_exhaustion() runs on test_CT { |
| 532 | var ASP_RSL_Unitdata rsl_ud; |
| 533 | var integer i; |
| 534 | var integer chreq_total, chreq_nochan; |
| 535 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 536 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 537 | |
| 538 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 539 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 540 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 541 | /* GSM 04.08 Table 9.9a: |
| 542 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 543 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 544 | 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] | 545 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | IPA_RSL[0].clear; |
| 549 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 550 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 551 | 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] | 552 | |
| 553 | /* now expect additional channel activations to fail */ |
| 554 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 555 | |
| 556 | alt { |
| 557 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 558 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 559 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 560 | } |
| 561 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 562 | var GsmRrMessage rr; |
| 563 | /* match on IMM ASS REJ */ |
| 564 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 565 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 566 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 567 | 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] | 568 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 569 | chreq_nochan+1); |
| 570 | setverdict(pass); |
| 571 | } else { |
| 572 | repeat; |
| 573 | } |
| 574 | } |
| 575 | [] IPA_RSL[0].receive { repeat; } |
| 576 | } |
| 577 | } |
| 578 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 579 | /* Test channel deactivation due to silence from MS */ |
| 580 | testcase TC_chan_deact_silence() runs on test_CT { |
| 581 | var RslChannelNr chan_nr; |
| 582 | |
| 583 | f_init(1); |
| 584 | |
| 585 | /* Request for a dedicated channel */ |
| 586 | chan_nr := f_chreq_act_ack('23'O); |
| 587 | |
| 588 | /* Wait some time until the channel is released */ |
| 589 | f_sleep(2.0); |
| 590 | |
| 591 | /* Expect CHANnel RELease */ |
| 592 | alt { |
| 593 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 594 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 595 | log("Received CHANnel RELease"); |
| 596 | setverdict(pass); |
| 597 | } |
| 598 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 599 | tr_RSL_IMM_ASSIGN(?))) { |
| 600 | /* See OS#3709, OsmoBSC should not send Immediate |
| 601 | * Assignment Reject since a dedicated channel was |
| 602 | * already allocated, and Immediate Assignment was |
| 603 | * already sent. */ |
| 604 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 605 | } |
| 606 | [] IPA_RSL[0].receive { |
| 607 | setverdict(fail, "Unexpected RSL message!"); |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 612 | /*********************************************************************** |
| 613 | * Assignment Testing |
| 614 | ***********************************************************************/ |
| 615 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 616 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 617 | * except for the inter-BSC handover, MT side) */ |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 618 | testcase TC_outbound_connect() runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 619 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 620 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 621 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 622 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 623 | setverdict(pass); |
| 624 | } |
| 625 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 626 | /* Test behavior if MSC answers with CREF to CR */ |
| 627 | testcase TC_assignment_cic_only() runs on test_CT { |
| 628 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 629 | var RSL_Message rx_rsl; |
| 630 | var DchanTuple dt; |
| 631 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 632 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 633 | |
| 634 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 635 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 636 | /* send assignment without AoIP IEs */ |
| 637 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 638 | } else { |
| 639 | /* Send assignmetn without CIC in IPA case */ |
| 640 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 641 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 642 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 643 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 644 | alt { |
| 645 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 646 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 647 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 648 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 649 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 650 | setverdict(pass); |
| 651 | } |
| 652 | [] BSSAP.receive { repeat; } |
| 653 | } |
| 654 | } |
| 655 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 656 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 657 | function f_gen_ass_req(boolean osmux_enabled := false) return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 658 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 659 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 660 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 661 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 662 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 663 | if (osmux_enabled) { |
| 664 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 665 | } else { |
| 666 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 667 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 668 | } else { |
| 669 | 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] | 670 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 671 | } |
| 672 | return ass_cmd; |
| 673 | } |
| 674 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 675 | function f_gen_handover_req() return PDU_BSSAP { |
| 676 | var PDU_BSSAP ho_req; |
| 677 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 678 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 679 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 680 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 681 | } else { |
| 682 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 683 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 684 | } |
| 685 | return ho_req; |
| 686 | } |
| 687 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 688 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 689 | function f_gen_exp_compl(boolean expect_osmux := false) return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 690 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 691 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 692 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 693 | if (expect_osmux) { |
| 694 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 695 | } else { |
| 696 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 697 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 698 | } else { |
| 699 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 700 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 701 | } |
| 702 | return exp_compl; |
| 703 | } |
| 704 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 705 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 706 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 707 | runs on test_CT { |
| 708 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 709 | var RSL_Message rx_rsl; |
| 710 | var DchanTuple dt; |
| 711 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 712 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 713 | |
| 714 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 715 | /* send assignment without AoIP IEs */ |
| 716 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 717 | alt { |
| 718 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 719 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 720 | setverdict(pass); |
| 721 | } else { |
| 722 | setverdict(fail, fail_text); |
| 723 | } |
| 724 | } |
| 725 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 726 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 727 | setverdict(pass); |
| 728 | } else { |
| 729 | setverdict(fail, fail_text); |
| 730 | } |
| 731 | } |
| 732 | [] BSSAP.receive { repeat; } |
| 733 | } |
| 734 | } |
| 735 | testcase TC_assignment_csd() runs on test_CT { |
| 736 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 737 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 738 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 739 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 740 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 741 | } |
| 742 | |
| 743 | testcase TC_assignment_ctm() runs on test_CT { |
| 744 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 745 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 746 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 747 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 748 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 749 | } |
| 750 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 751 | type record DchanTuple { |
| 752 | integer sccp_conn_id, |
| 753 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 754 | } |
| 755 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 756 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 757 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 758 | runs on test_CT return RslChannelNr { |
| 759 | var RSL_Message rx_rsl; |
| 760 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 761 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 762 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 763 | 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] | 764 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 765 | return chan_nr; |
| 766 | } |
| 767 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 768 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 769 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 770 | runs on test_CT return DchanTuple { |
| 771 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 772 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 773 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 774 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 775 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 776 | |
| 777 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 778 | |
| 779 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 780 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 781 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 782 | |
| 783 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 784 | } |
| 785 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 786 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 787 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 788 | var RSL_Message rx_rsl; |
| 789 | /* expect BSC to disable the channel */ |
| 790 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 791 | /* respond with CHAN REL ACK */ |
| 792 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 793 | |
| 794 | /* expect Clear Complete from BSC */ |
| 795 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 796 | |
| 797 | /* MSC disconnects as instructed. */ |
| 798 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 799 | } |
| 800 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 801 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 802 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 803 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 804 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 805 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 806 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 807 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 808 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 809 | |
| 810 | /* simulate RLL REL IND */ |
| 811 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 812 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 813 | /* expect Clear Request on MSC side */ |
| 814 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 815 | |
| 816 | /* Instruct BSC to clear channel */ |
| 817 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 818 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 819 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 820 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 821 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 822 | |
| 823 | /* wait for SCCP emulation to do its job */ |
| 824 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 825 | |
| 826 | setverdict(pass); |
| 827 | } |
| 828 | |
| 829 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 830 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 831 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 832 | var DchanTuple dt; |
| 833 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 834 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 835 | |
| 836 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 837 | |
| 838 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 839 | 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] | 840 | /* TODO: different cause values? */ |
| 841 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 842 | /* expect Clear Request from BSC */ |
| 843 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 844 | |
| 845 | /* Instruct BSC to clear channel */ |
| 846 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 847 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 848 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 849 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 850 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 851 | |
| 852 | /* wait for SCCP emulation to do its job */ |
| 853 | f_sleep(1.0); |
| 854 | |
| 855 | setverdict(pass); |
| 856 | } |
| 857 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 858 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 859 | /* See also https://www.osmocom.org/issues/3182 */ |
| 860 | testcase TC_early_conn_fail() runs on test_CT { |
| 861 | var RSL_Message rx_rsl; |
| 862 | var DchanTuple dt; |
| 863 | |
| 864 | f_init(1); |
| 865 | |
| 866 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
| 867 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23); |
| 868 | |
| 869 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 870 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 871 | |
| 872 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 873 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 874 | |
| 875 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 876 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 877 | |
| 878 | setverdict(pass); |
| 879 | } |
| 880 | |
| 881 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 882 | /* See also https://www.osmocom.org/issues/3182 */ |
| 883 | testcase TC_late_conn_fail() runs on test_CT { |
| 884 | var RSL_Message rx_rsl; |
| 885 | var DchanTuple dt; |
| 886 | |
| 887 | f_init(1); |
| 888 | |
| 889 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 890 | |
| 891 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 892 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 893 | |
| 894 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 895 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 896 | |
| 897 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 898 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 899 | |
| 900 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 901 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 902 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 903 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 904 | |
| 905 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 906 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 907 | |
| 908 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 909 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 910 | |
| 911 | setverdict(pass); |
| 912 | } |
| 913 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 914 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 915 | boolean expect_deact_sacch := true, |
| 916 | boolean expect_rr_chan_rel := true, |
| 917 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 918 | boolean handle_rll_rel := true, |
| 919 | boolean is_csfb := false |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 920 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 921 | |
| 922 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 923 | var boolean got_deact_sacch := false; |
| 924 | var boolean got_rr_chan_rel := false; |
| 925 | var boolean got_rll_rel_req := false; |
| 926 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 927 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 928 | alt { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 929 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 930 | tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 931 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 932 | repeat; |
| 933 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 934 | [is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CSFB))) { |
| 935 | got_rr_chan_rel := true; |
| 936 | repeat; |
| 937 | } |
| 938 | [not is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 939 | got_rr_chan_rel := true; |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 940 | repeat; |
| 941 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 942 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 943 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 944 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 945 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 946 | if (handle_rll_rel) { |
| 947 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 948 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 949 | repeat; |
| 950 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 951 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 952 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 953 | /* respond with CHAN REL ACK */ |
| 954 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 955 | } |
| 956 | /* ignore any user data */ |
| 957 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 958 | repeat; |
| 959 | } |
| 960 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 961 | |
| 962 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 963 | " got_rll_rel_req=", got_rll_rel_req); |
| 964 | |
| 965 | if (expect_deact_sacch != got_deact_sacch) { |
| 966 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 967 | } |
| 968 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 969 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 970 | } |
| 971 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 972 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 973 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 974 | } |
| 975 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 976 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 977 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 978 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 979 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 980 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 981 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 982 | |
| 983 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 984 | |
| 985 | /* Instruct BSC to clear channel */ |
| 986 | var BssmapCause cause := 0; |
| 987 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 988 | |
| 989 | /* expect Clear Complete from BSC on A */ |
| 990 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 991 | /* release the SCCP connection */ |
| 992 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 993 | } |
| 994 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 995 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 996 | setverdict(pass); |
| 997 | } |
| 998 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 999 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1000 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1001 | var BSSAP_N_DATA_ind rx_di; |
| 1002 | var DchanTuple dt; |
| 1003 | |
| 1004 | f_init(1); |
| 1005 | |
| 1006 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1007 | |
| 1008 | /* Instruct BSC to clear channel */ |
| 1009 | var BssmapCause cause := 0; |
| 1010 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1011 | |
| 1012 | /* expect Clear Complete from BSC on A */ |
| 1013 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1014 | /* release the SCCP connection */ |
| 1015 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1016 | } |
| 1017 | |
| 1018 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
| 1019 | setverdict(pass); |
| 1020 | } |
| 1021 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1022 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1023 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1024 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1025 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1026 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1027 | |
| 1028 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1029 | |
| 1030 | /* release the SCCP connection */ |
| 1031 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1032 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1033 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1034 | setverdict(pass); |
| 1035 | } |
| 1036 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1037 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1038 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1039 | var DchanTuple dt; |
| 1040 | |
| 1041 | f_init(1); |
| 1042 | |
| 1043 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1044 | |
| 1045 | /* release the SCCP connection */ |
| 1046 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1047 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1048 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1049 | setverdict(pass); |
| 1050 | } |
| 1051 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1052 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1053 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1054 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1055 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1056 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1057 | |
| 1058 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1059 | |
| 1060 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1061 | IPA_RSL[0].clear; |
| 1062 | |
| 1063 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1064 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1065 | interleave { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1066 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1067 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1068 | } |
| 1069 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1070 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1071 | setverdict(pass); |
| 1072 | } |
| 1073 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1074 | /* Verify T(iar) triggers and releases the channel */ |
| 1075 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1076 | var DchanTuple dt; |
| 1077 | |
| 1078 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1079 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1080 | T(iar) >= T(ias)*2 */ |
| 1081 | g_bsc_sccp_timer_ias := 2; |
| 1082 | g_bsc_sccp_timer_iar := 5; |
| 1083 | |
| 1084 | f_init(1); |
| 1085 | |
| 1086 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1087 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 1088 | setverdict(pass); |
| 1089 | } |
| 1090 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1091 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1092 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1093 | timer T := 2.0; |
| 1094 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1095 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1096 | |
| 1097 | var octetstring l3 := '00010203040506'O; |
| 1098 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1099 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1100 | |
| 1101 | T.start; |
| 1102 | alt { |
| 1103 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1104 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1105 | } |
| 1106 | [] BSSAP.receive {} |
| 1107 | [] IPA_RSL[0].receive {} |
| 1108 | [] T.timeout {} |
| 1109 | } |
| 1110 | |
| 1111 | setverdict(pass); |
| 1112 | } |
| 1113 | |
| 1114 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1115 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1116 | var RslChannelNr chan_nr; |
| 1117 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1118 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1119 | |
| 1120 | chan_nr := f_chreq_act_ack() |
| 1121 | |
| 1122 | var octetstring l3 := '00010203040506'O; |
| 1123 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1124 | |
| 1125 | timer T := 2.0; |
| 1126 | T.start; |
| 1127 | alt { |
| 1128 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1129 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1130 | } |
| 1131 | [] BSSAP.receive { repeat; } |
| 1132 | [] IPA_RSL[0].receive { repeat; } |
| 1133 | [] T.timeout {} |
| 1134 | } |
| 1135 | |
| 1136 | setverdict(pass); |
| 1137 | } |
| 1138 | |
| 1139 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1140 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 1141 | timer T := 2.0; |
| 1142 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1143 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1144 | |
| 1145 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1146 | |
| 1147 | var octetstring l3 := '00010203040506'O; |
| 1148 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 1149 | |
| 1150 | T.start; |
| 1151 | alt { |
| 1152 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1153 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 1154 | } |
| 1155 | [] BSSAP.receive { repeat; } |
| 1156 | [] IPA_RSL[0].receive { repeat; } |
| 1157 | [] T.timeout {} |
| 1158 | } |
| 1159 | |
| 1160 | setverdict(pass); |
| 1161 | } |
| 1162 | |
| 1163 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 1164 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 1165 | timer T := 2.0; |
| 1166 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1167 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1168 | |
| 1169 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1170 | |
| 1171 | var octetstring l3 := '00010203040506'O; |
| 1172 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 1173 | |
| 1174 | T.start; |
| 1175 | alt { |
| 1176 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1177 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 1178 | } |
| 1179 | [] BSSAP.receive { repeat; } |
| 1180 | [] IPA_RSL[0].receive { repeat; } |
| 1181 | [] T.timeout {} |
| 1182 | } |
| 1183 | |
| 1184 | setverdict(pass); |
| 1185 | } |
| 1186 | |
| 1187 | |
| 1188 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1189 | |
| 1190 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 1191 | var charstring ctrl_resp; |
| 1192 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1193 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1194 | |
| 1195 | /* See https://osmocom.org/issues/2729 */ |
| 1196 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 1197 | setverdict(pass); |
| 1198 | } |
| 1199 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1200 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 1201 | var charstring ctrl_resp; |
| 1202 | |
| 1203 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1204 | |
| 1205 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 1206 | setverdict(pass); |
| 1207 | } |
| 1208 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1209 | testcase TC_ctrl() runs on test_CT { |
| 1210 | var charstring ctrl_resp; |
| 1211 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1212 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1213 | |
| 1214 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 1215 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 1216 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 1217 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 1218 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1219 | |
| 1220 | var integer bts_nr := 0; |
| 1221 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 1222 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 1223 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 1224 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 1225 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 1226 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 1227 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 1228 | |
| 1229 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 1230 | f_sleep(2.0); |
| 1231 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 1232 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 1233 | } |
| 1234 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 1235 | |
| 1236 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 1237 | |
| 1238 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1239 | } |
| 1240 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 1241 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 1242 | "location-state" over the SCCPlite IPA conn */ |
| 1243 | testcase TC_ctrl_location() runs on test_CT { |
| 1244 | var MSC_ConnHdlr vc_conn; |
| 1245 | var integer bts_nr := 0; |
| 1246 | |
| 1247 | f_init(1, true); |
| 1248 | f_sleep(1.0); |
| 1249 | |
| 1250 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 1251 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 1252 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 1253 | |
| 1254 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 1255 | f_sleep(2.0); |
| 1256 | |
| 1257 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 1258 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 1259 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 1260 | |
| 1261 | /* should match the one from config */ |
| 1262 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 1263 | |
| 1264 | setverdict(pass); |
| 1265 | } |
| 1266 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1267 | function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1268 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, bssap)); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | /*********************************************************************** |
| 1273 | * Paging Testing |
| 1274 | ***********************************************************************/ |
| 1275 | |
| 1276 | type record Cell_Identity { |
| 1277 | GsmMcc mcc, |
| 1278 | GsmMnc mnc, |
| 1279 | GsmLac lac, |
| 1280 | GsmCellId ci |
| 1281 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 1282 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1283 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1284 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1285 | type set of integer BtsIdList; |
| 1286 | |
| 1287 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 1288 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 1289 | if (bts_id == bts_ids[j]) { |
| 1290 | return true; |
| 1291 | } |
| 1292 | } |
| 1293 | return false; |
| 1294 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1295 | |
| 1296 | /* core paging test helper function; used by most paging test cases */ |
| 1297 | private function f_pageing_helper(hexstring imsi, |
| 1298 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1299 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1300 | template RSL_ChanNeeded rsl_chneed := omit, |
| 1301 | template OCT4 tmsi := omit) runs on test_CT |
| 1302 | { |
| 1303 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 1304 | var MobileIdentity mi; |
| 1305 | var template octetstring id_enc; /* FIXME */ |
| 1306 | var RSL_Message rx_rsl; |
| 1307 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1308 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1309 | |
| 1310 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1311 | |
| 1312 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 1313 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1314 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1315 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1316 | |
| 1317 | if (isvalue(rsl_chneed)) { |
| 1318 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 1319 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 1320 | } else { |
| 1321 | bssmap_chneed := omit; |
| 1322 | } |
| 1323 | |
| 1324 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 1325 | |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 1326 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1327 | if (isvalue(tmsi)) { |
| 1328 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 1329 | } else { |
| 1330 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 1331 | } |
| 1332 | id_enc := enc_MobileIdentity(mi); |
| 1333 | */ |
| 1334 | id_enc := ?; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1335 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 1336 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc)); |
| 1337 | /* check channel type, paging group */ |
| 1338 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 1339 | setverdict(fail, "Paging for wrong paging group"); |
| 1340 | } |
| 1341 | if (ispresent(rsl_chneed) and |
| 1342 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 1343 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 1344 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1345 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 1346 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1347 | /* do a quick check on all not-included BTSs if they received paging */ |
| 1348 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1349 | timer T := 0.1; |
| 1350 | if (f_bts_in_list(i, bts_ids)) { |
| 1351 | continue; |
| 1352 | } |
| 1353 | T.start; |
| 1354 | alt { |
| 1355 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) { |
| 1356 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 1357 | } |
| 1358 | [] IPA_RSL[i].receive { repeat; } |
| 1359 | [] T.timeout { } |
| 1360 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1361 | } |
| 1362 | |
| 1363 | setverdict(pass); |
| 1364 | } |
| 1365 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1366 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1367 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1368 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 1369 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 1370 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1371 | /* PAGING by IMSI + TMSI */ |
| 1372 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 1373 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1374 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 1375 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1376 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1377 | } |
| 1378 | |
| 1379 | /* PAGING by IMSI + TMSI */ |
| 1380 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 1381 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1382 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1383 | 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] | 1384 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1385 | } |
| 1386 | |
| 1387 | /* Paging with different "channel needed' values */ |
| 1388 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 1389 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1390 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1391 | 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] | 1392 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1393 | } |
| 1394 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 1395 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1396 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1397 | 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] | 1398 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1399 | } |
| 1400 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 1401 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1402 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1403 | 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] | 1404 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1405 | } |
| 1406 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 1407 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1408 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1409 | 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] | 1410 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | /* Paging by CGI */ |
| 1414 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 1415 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1416 | 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] | 1417 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1418 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1419 | } |
| 1420 | |
| 1421 | /* Paging by LAC+CI */ |
| 1422 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 1423 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1424 | 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] | 1425 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1426 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1427 | } |
| 1428 | |
| 1429 | /* Paging by CI */ |
| 1430 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 1431 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1432 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1433 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1434 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1435 | } |
| 1436 | |
| 1437 | /* Paging by LAI */ |
| 1438 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 1439 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1440 | 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] | 1441 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1442 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1443 | } |
| 1444 | |
| 1445 | /* Paging by LAC */ |
| 1446 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 1447 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1448 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1449 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1450 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | /* Paging by "all in BSS" */ |
| 1454 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 1455 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1456 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1457 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1458 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1459 | } |
| 1460 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1461 | /* 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] | 1462 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 1463 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1464 | 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] | 1465 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1466 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1467 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1468 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1469 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1470 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 1471 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1472 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1473 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1474 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1475 | } |
| 1476 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1477 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1478 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 1479 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1480 | 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] | 1481 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1482 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1483 | } |
| 1484 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1485 | /* 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] | 1486 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 1487 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1488 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 1489 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1490 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1491 | } |
| 1492 | |
| 1493 | /* Paging on empty list: Verify none of them page */ |
| 1494 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 1495 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1496 | cid_list := { cIl_LAC := { } }; |
| 1497 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1498 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1499 | } |
| 1500 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1501 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 1502 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 1503 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1504 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 1505 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 1506 | f_shutdown_helper(); |
| 1507 | } |
| 1508 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1509 | /* Verify paging retransmission interval + count */ |
| 1510 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1511 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1512 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1513 | /* Verify PCH load */ |
| 1514 | testcase TC_paging_imsi_load() runs on test_CT { |
| 1515 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1516 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1517 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1518 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1519 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1520 | |
| 1521 | /* tell BSC there is no paging space anymore */ |
| 1522 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 1523 | f_sleep(0.2); |
| 1524 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1525 | |
| 1526 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 1527 | * there would be 8 retransmissions during 4 seconds */ |
| 1528 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1529 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1530 | alt { |
| 1531 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1532 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1533 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1534 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1535 | [] T_retrans.timeout { |
| 1536 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 1537 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 1538 | T_retrans.start; |
| 1539 | repeat; |
| 1540 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1541 | [] T.timeout { |
| 1542 | setverdict(pass); |
| 1543 | } |
| 1544 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1545 | |
| 1546 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1547 | } |
| 1548 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1549 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1550 | testcase TC_paging_counter() runs on test_CT { |
| 1551 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1552 | timer T := 4.0; |
| 1553 | var integer i; |
| 1554 | var integer paging_attempted_bsc; |
| 1555 | var integer paging_attempted_bts[NUM_BTS]; |
| 1556 | var integer paging_expired_bts[NUM_BTS]; |
| 1557 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 1558 | |
| 1559 | f_init(); |
| 1560 | |
| 1561 | /* read counters before paging */ |
| 1562 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 1563 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1564 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 1565 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 1566 | } |
| 1567 | |
| 1568 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 1569 | |
| 1570 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1571 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1572 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1573 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1574 | paging_attempted_bts[i]+1); |
| 1575 | } |
| 1576 | |
| 1577 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1578 | f_sleep(12.0); |
| 1579 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1580 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1581 | paging_expired_bts[i]+1); |
| 1582 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1583 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1584 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1585 | } |
| 1586 | |
| 1587 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1588 | /* Verify paging stops after A-RESET */ |
| 1589 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1590 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1591 | timer T := 3.0; |
| 1592 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1593 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1594 | |
| 1595 | /* Perform a BSSMAP Reset and wait for ACK */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1596 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1597 | alt { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1598 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1599 | [] BSSAP.receive { repeat; } |
| 1600 | } |
| 1601 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 1602 | /* Wait to avoid a possible race condition if a paging message is |
| 1603 | * received right before the reset ACK. */ |
| 1604 | f_sleep(0.2); |
| 1605 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1606 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 1607 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 1608 | IPA_RSL[i].clear; |
| 1609 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1610 | |
| 1611 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1612 | T.start; |
| 1613 | alt { |
| 1614 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1615 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1616 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1617 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1618 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1619 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1620 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1621 | } |
| 1622 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1623 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1624 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1625 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1626 | [] T.timeout { |
| 1627 | setverdict(pass); |
| 1628 | } |
| 1629 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1630 | |
| 1631 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1632 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1633 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1634 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 1635 | * paging response we can not know which MSC is in charge, so we will blindly |
| 1636 | * pick the first configured MSC. This behavior is required in order to make |
| 1637 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 1638 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 1639 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1640 | */ |
| 1641 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 1642 | |
| 1643 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1644 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1645 | |
| 1646 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1647 | var DchanTuple dt; |
| 1648 | 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] | 1649 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1650 | |
| 1651 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1652 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 1653 | |
| 1654 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 1655 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 1656 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1657 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1658 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 1659 | T.start; |
| 1660 | alt { |
| 1661 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 1662 | setverdict(pass); |
| 1663 | } |
| 1664 | [] BSSAP.receive { |
| 1665 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 1666 | } |
| 1667 | [] T.timeout { |
| 1668 | setverdict(fail, "Received nothing on A-Interface!"); |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | setverdict(pass); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1673 | } |
| 1674 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1675 | /* Test RSL link drop causes counter increment */ |
| 1676 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1677 | var integer rsl_fail; |
| 1678 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1679 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1680 | |
| 1681 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1682 | |
| 1683 | bts[0].rsl.vc_IPA.stop; |
| 1684 | |
| 1685 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1686 | |
| 1687 | setverdict(pass); |
| 1688 | } |
| 1689 | |
| 1690 | /* TODO: Test OML link drop causes counter increment */ |
| 1691 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1692 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 1693 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 1694 | timer T := 10.0; |
| 1695 | |
| 1696 | bts[0].rsl.id := "IPA-0-RSL"; |
| 1697 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 1698 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 1699 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 1700 | 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] | 1701 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1702 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 1703 | |
| 1704 | f_init_mgcp("VirtMSC"); |
| 1705 | |
| 1706 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 1707 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 1708 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 1709 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 1710 | |
| 1711 | /* wait for IPA OML link to connect and then disconnect */ |
| 1712 | T.start; |
| 1713 | alt { |
| 1714 | [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) { |
| 1715 | T.stop; |
| 1716 | return true; |
| 1717 | } |
| 1718 | [] IPA_RSL[0].receive { repeat } |
| 1719 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1720 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1721 | } |
| 1722 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1723 | return false; |
| 1724 | } |
| 1725 | |
| 1726 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1727 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 1728 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 1729 | setverdict(pass); |
| 1730 | } else { |
| 1731 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 1732 | } |
| 1733 | } |
| 1734 | |
| 1735 | |
| 1736 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1737 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 1738 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 1739 | setverdict(pass); |
| 1740 | } else { |
| 1741 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1746 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1747 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1748 | ***********************************************************************/ |
| 1749 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1750 | import from RAN_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1751 | import from RSL_Emulation all; |
| 1752 | import from MSC_ConnectionHandler all; |
| 1753 | |
| 1754 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 1755 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1756 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 1757 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn) runs on test_CT { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1758 | connect(vc_conn:RAN, g_bssap.vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1759 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1760 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 1761 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 1762 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 1763 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 1764 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 1765 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 1766 | if (isvalue(bts[2])) { |
| 1767 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 1768 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 1769 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1770 | connect(vc_conn:BSSAP, g_bssap.vc_RAN:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1771 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 1772 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1773 | } |
| 1774 | |
| 1775 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 1776 | runs on test_CT return MSC_ConnHdlr { |
| 1777 | var charstring id := testcasename(); |
| 1778 | var MSC_ConnHdlr vc_conn; |
| 1779 | vc_conn := MSC_ConnHdlr.create(id); |
| 1780 | f_connect_handler(vc_conn); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1781 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1782 | return vc_conn; |
| 1783 | } |
| 1784 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1785 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 1786 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 1787 | runs on MSC_ConnHdlr { |
| 1788 | if (isvalue(pars)) { |
| 1789 | g_pars := valueof(pars); |
| 1790 | } |
| 1791 | fn.apply(id); |
| 1792 | } |
| 1793 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1794 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 1795 | 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] | 1796 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1797 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1798 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1799 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 1800 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 1801 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 1802 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1803 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1804 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1805 | } |
| 1806 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 1807 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1808 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1809 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 1810 | |
| 1811 | f_init(1, true); |
| 1812 | f_sleep(1.0); |
| 1813 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1814 | vc_conn.done; |
| 1815 | } |
| 1816 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 1817 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1818 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1819 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 1820 | |
| 1821 | f_init(1, true); |
| 1822 | f_sleep(1.0); |
| 1823 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1824 | vc_conn.done; |
| 1825 | } |
| 1826 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 1827 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1828 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1829 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 1830 | |
| 1831 | f_init(1, true); |
| 1832 | f_sleep(1.0); |
| 1833 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1834 | vc_conn.done; |
| 1835 | } |
| 1836 | |
| 1837 | |
| 1838 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1839 | 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] | 1840 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1841 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1842 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1843 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1844 | 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] | 1845 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1846 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1847 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1848 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 1849 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1850 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1851 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1852 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1853 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1854 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1855 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1856 | vc_conn.done; |
| 1857 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1858 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1859 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1860 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1861 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1862 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1863 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1864 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1865 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 1866 | vc_conn.done; |
| 1867 | } |
| 1868 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 1869 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1870 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1871 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1872 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1873 | f_init(1, true); |
| 1874 | f_sleep(1.0); |
| 1875 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1876 | vc_conn.done; |
| 1877 | } |
| 1878 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1879 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 1880 | 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] | 1881 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1882 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1883 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1884 | const OCT8 kc := '0001020304050607'O; |
| 1885 | |
| 1886 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1887 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 1888 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1889 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1890 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1891 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 1892 | var MSC_ConnHdlr vc_conn; |
| 1893 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1894 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1895 | f_sleep(1.0); |
| 1896 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1897 | 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] | 1898 | vc_conn.done; |
| 1899 | } |
| 1900 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1901 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1902 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1903 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1904 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1905 | const OCT8 kc := '0001020304050607'O; |
| 1906 | const OCT16 kc128 := kc & kc; |
| 1907 | |
| 1908 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1909 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1910 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1911 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1912 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1913 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1914 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 1915 | var MSC_ConnHdlr vc_conn; |
| 1916 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1917 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1918 | f_sleep(1.0); |
| 1919 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1920 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1921 | vc_conn.done; |
| 1922 | } |
| 1923 | |
| 1924 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1925 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1926 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1927 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1928 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1929 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1930 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1931 | } |
| 1932 | |
| 1933 | testcase TC_assignment_sign() runs on test_CT { |
| 1934 | var MSC_ConnHdlr vc_conn; |
| 1935 | |
| 1936 | f_init(1, true); |
| 1937 | f_sleep(1.0); |
| 1938 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1939 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1940 | vc_conn.done; |
| 1941 | } |
| 1942 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1943 | /*********************************************************************** |
| 1944 | * Codec (list) testing |
| 1945 | ***********************************************************************/ |
| 1946 | |
| 1947 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 1948 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 1949 | return boolean { |
| 1950 | select (a_elem.codecType) { |
| 1951 | case (GSM_FR) { |
| 1952 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 1953 | return true; |
| 1954 | } |
| 1955 | } |
| 1956 | case (GSM_HR) { |
| 1957 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 1958 | return true; |
| 1959 | } |
| 1960 | } |
| 1961 | case (GSM_EFR) { |
| 1962 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 1963 | return true; |
| 1964 | } |
| 1965 | } |
| 1966 | case (FR_AMR) { |
| 1967 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 1968 | return true; |
| 1969 | } |
| 1970 | } |
| 1971 | case (HR_AMR) { |
| 1972 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 1973 | return true; |
| 1974 | } |
| 1975 | } |
| 1976 | case else { } |
| 1977 | } |
| 1978 | return false; |
| 1979 | } |
| 1980 | |
| 1981 | /* check if the given rsl_mode is compatible with the a_list */ |
| 1982 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 1983 | return boolean { |
| 1984 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 1985 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 1986 | return true; |
| 1987 | } |
| 1988 | } |
| 1989 | return false; |
| 1990 | } |
| 1991 | |
| 1992 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 1993 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1994 | return BSSMAP_IE_ChannelType { |
| 1995 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 1996 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 1997 | select (a_elem.codecType) { |
| 1998 | case (GSM_FR) { |
| 1999 | ret.channelRateAndType := ChRate_TCHF; |
| 2000 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 2001 | } |
| 2002 | case (GSM_HR) { |
| 2003 | ret.channelRateAndType := ChRate_TCHH; |
| 2004 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 2005 | } |
| 2006 | case (GSM_EFR) { |
| 2007 | ret.channelRateAndType := ChRate_TCHF; |
| 2008 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 2009 | } |
| 2010 | case (FR_AMR) { |
| 2011 | ret.channelRateAndType := ChRate_TCHF; |
| 2012 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 2013 | } |
| 2014 | case (HR_AMR) { |
| 2015 | ret.channelRateAndType := ChRate_TCHH; |
| 2016 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 2017 | } |
| 2018 | case else { |
| 2019 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2020 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2021 | } |
| 2022 | } |
| 2023 | return ret; |
| 2024 | } |
| 2025 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2026 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 2027 | return template RSL_IE_Body { |
| 2028 | var template RSL_IE_Body mode_ie := { |
| 2029 | chan_mode := { |
| 2030 | len := ?, |
| 2031 | reserved := ?, |
| 2032 | dtx_d := ?, |
| 2033 | dtx_u := ?, |
| 2034 | spd_ind := RSL_SPDI_SPEECH, |
| 2035 | ch_rate_type := -, |
| 2036 | coding_alg_rate := - |
| 2037 | } |
| 2038 | } |
| 2039 | |
| 2040 | select (a_elem.codecType) { |
| 2041 | case (GSM_FR) { |
| 2042 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2043 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 2044 | } |
| 2045 | case (GSM_HR) { |
| 2046 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 2047 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 2048 | } |
| 2049 | case (GSM_EFR) { |
| 2050 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2051 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 2052 | } |
| 2053 | case (FR_AMR) { |
| 2054 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2055 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 2056 | } |
| 2057 | case (HR_AMR) { |
| 2058 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 2059 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 2060 | } |
| 2061 | } |
| 2062 | return mode_ie; |
| 2063 | } |
| 2064 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2065 | type record CodecListTest { |
| 2066 | BSSMAP_IE_SpeechCodecList codec_list, |
| 2067 | charstring id |
| 2068 | } |
| 2069 | type record of CodecListTest CodecListTests |
| 2070 | |
| 2071 | 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] | 2072 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 2073 | 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] | 2074 | |
| 2075 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 2076 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2077 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 2078 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 2079 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2080 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 2081 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 2082 | g_pars.expect_mr_s0_s7; |
| 2083 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 2084 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2085 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 2086 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2087 | log("expecting ASS COMPL like this: ", exp_compl); |
| 2088 | |
| 2089 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2090 | |
| 2091 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 2092 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 2093 | |
| 2094 | var RSL_IE_Body mode_ie; |
| 2095 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 2096 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2097 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2098 | } |
| 2099 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 2100 | if (not match(mode_ie, t_mode_ie)) { |
| 2101 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 2102 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2103 | |
| 2104 | var RSL_IE_Body mr_conf; |
| 2105 | if (g_pars.expect_mr_conf_ie != omit) { |
| 2106 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 2107 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2108 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2109 | } |
| 2110 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 2111 | |
| 2112 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 2113 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 2114 | g_pars.expect_mr_conf_ie); |
| 2115 | } |
| 2116 | } else { |
| 2117 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 2118 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 2119 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2120 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2121 | } |
| 2122 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2123 | } |
| 2124 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2125 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 2126 | |
| 2127 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2128 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2129 | |
| 2130 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 2131 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2132 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 2133 | } |
| 2134 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 2135 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 2136 | log("expecting ASS FAIL like this: ", exp_fail); |
| 2137 | |
| 2138 | f_establish_fully(ass_cmd, exp_fail); |
| 2139 | } |
| 2140 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2141 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2142 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2143 | var MSC_ConnHdlr vc_conn; |
| 2144 | |
| 2145 | f_init(1, true); |
| 2146 | f_sleep(1.0); |
| 2147 | |
| 2148 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2149 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2150 | vc_conn.done; |
| 2151 | } |
| 2152 | |
| 2153 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2154 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2155 | var MSC_ConnHdlr vc_conn; |
| 2156 | |
| 2157 | f_init(1, true); |
| 2158 | f_sleep(1.0); |
| 2159 | |
| 2160 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2161 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2162 | vc_conn.done; |
| 2163 | } |
| 2164 | |
| 2165 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2166 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2167 | var MSC_ConnHdlr vc_conn; |
| 2168 | |
| 2169 | f_init(1, true); |
| 2170 | f_sleep(1.0); |
| 2171 | |
| 2172 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2173 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2174 | vc_conn.done; |
| 2175 | } |
| 2176 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2177 | /* Allow 5,90k only (current default config) */ |
| 2178 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 2179 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 2180 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 2181 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 2182 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 2183 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 2184 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 2185 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 2186 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 2187 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 2188 | f_vty_transceive(BSCVTY, "exit"); |
| 2189 | f_vty_transceive(BSCVTY, "exit"); |
| 2190 | } |
| 2191 | |
| 2192 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 2193 | * ("Config-NB-Code = 1") */ |
| 2194 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 2195 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 2196 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 2197 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 2198 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 2199 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 2200 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 2201 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 2202 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 2203 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 2204 | f_vty_transceive(BSCVTY, "exit"); |
| 2205 | f_vty_transceive(BSCVTY, "exit"); |
| 2206 | } |
| 2207 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2208 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2209 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2210 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2211 | |
| 2212 | /* Note: This setups the codec configuration. The parameter payload in |
| 2213 | * mr_conf must be consistant with the parameter codecElements in pars |
| 2214 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2215 | var RSL_IE_Body mr_conf := { |
| 2216 | other := { |
| 2217 | len := 2, |
| 2218 | payload := '2804'O |
| 2219 | } |
| 2220 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2221 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2222 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 2223 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2224 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 2225 | pars.expect_mr_conf_ie := mr_conf; |
| 2226 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2227 | f_init(1, true); |
| 2228 | f_sleep(1.0); |
| 2229 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2230 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2231 | vc_conn.done; |
| 2232 | } |
| 2233 | |
| 2234 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2235 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2236 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2237 | |
| 2238 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2239 | var RSL_IE_Body mr_conf := { |
| 2240 | other := { |
| 2241 | len := 2, |
| 2242 | payload := '2804'O |
| 2243 | } |
| 2244 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2245 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2246 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 2247 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2248 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2249 | pars.expect_mr_conf_ie := mr_conf; |
| 2250 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2251 | f_init(1, true); |
| 2252 | f_sleep(1.0); |
| 2253 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2254 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2255 | vc_conn.done; |
| 2256 | } |
| 2257 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2258 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 2259 | runs on test_CT { |
| 2260 | |
| 2261 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2262 | var MSC_ConnHdlr vc_conn; |
| 2263 | |
| 2264 | /* See note above */ |
| 2265 | var RSL_IE_Body mr_conf := { |
| 2266 | other := { |
| 2267 | len := lengthof(mrconf), |
| 2268 | payload := mrconf |
| 2269 | } |
| 2270 | }; |
| 2271 | |
| 2272 | if (fr) { |
| 2273 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 2274 | } else { |
| 2275 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2276 | } |
| 2277 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 2278 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2279 | pars.expect_mr_conf_ie := mr_conf; |
| 2280 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 2281 | |
| 2282 | f_init(1, true); |
| 2283 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 2284 | f_sleep(1.0); |
| 2285 | |
| 2286 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 2287 | vc_conn.done; |
| 2288 | f_allow_amr_rate_5_90k(); |
| 2289 | } |
| 2290 | |
| 2291 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 2292 | runs on test_CT { |
| 2293 | |
| 2294 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2295 | var MSC_ConnHdlr vc_conn; |
| 2296 | |
| 2297 | if (fr) { |
| 2298 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 2299 | } else { |
| 2300 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2301 | } |
| 2302 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 2303 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2304 | |
| 2305 | f_init(1, true); |
| 2306 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 2307 | f_sleep(1.0); |
| 2308 | |
| 2309 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 2310 | vc_conn.done; |
| 2311 | f_allow_amr_rate_5_90k(); |
| 2312 | } |
| 2313 | |
| 2314 | |
| 2315 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 2316 | * set. */ |
| 2317 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
| 2318 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
| 2319 | } |
| 2320 | |
| 2321 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 2322 | * rates set. */ |
| 2323 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
| 2324 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
| 2325 | } |
| 2326 | |
| 2327 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 2328 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 2329 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
| 2330 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
| 2331 | } |
| 2332 | |
| 2333 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 2334 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 2335 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
| 2336 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
| 2337 | } |
| 2338 | |
| 2339 | /* The following block of tests selects more and more rates until all four |
| 2340 | * possible rates are in the active set (full rate) */ |
| 2341 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
| 2342 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
| 2343 | } |
| 2344 | |
| 2345 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
| 2346 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
| 2347 | } |
| 2348 | |
| 2349 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
| 2350 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
| 2351 | } |
| 2352 | |
| 2353 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
| 2354 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
| 2355 | } |
| 2356 | |
| 2357 | /* The following block of tests selects more and more rates until all three |
| 2358 | * possible rates are in the active set (half rate) */ |
| 2359 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
| 2360 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
| 2361 | } |
| 2362 | |
| 2363 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
| 2364 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
| 2365 | } |
| 2366 | |
| 2367 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
| 2368 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
| 2369 | } |
| 2370 | |
| 2371 | /* The following block tests what happens when the MSC does offer rate |
| 2372 | * configurations that are not supported by the BSC. Normally such situations |
| 2373 | * should not happen because the MSC gets informed by the BSC in advance via |
| 2374 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 2375 | * to offer rates that are not applicable anyway. */ |
| 2376 | |
| 2377 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
| 2378 | /* Try to include 12,2k in into the active set even though the channel |
| 2379 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 2380 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
| 2381 | } |
| 2382 | |
| 2383 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
| 2384 | /* See what happens when all rates are selected at once. Since then |
| 2385 | * Also S1 is selected, this setting will be prefered and we should |
| 2386 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 2387 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
| 2388 | } |
| 2389 | |
| 2390 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
| 2391 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 2392 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 2393 | * 5,90k, and 4,75k, into the active set. */ |
| 2394 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
| 2395 | } |
| 2396 | |
| 2397 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
| 2398 | /* Try to select no rates at all */ |
| 2399 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
| 2400 | } |
| 2401 | |
| 2402 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
| 2403 | /* Try to select only unsupported rates */ |
| 2404 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
| 2405 | } |
| 2406 | |
| 2407 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
| 2408 | /* Try to select 12,2k for half rate */ |
| 2409 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
| 2410 | } |
| 2411 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 2412 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2413 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 2414 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 2415 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 2416 | 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] | 2417 | } |
| 2418 | |
| 2419 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2420 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 2421 | 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] | 2422 | } |
| 2423 | |
| 2424 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2425 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 2426 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 2427 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 2428 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 2429 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 2430 | 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] | 2431 | } |
| 2432 | |
| 2433 | /* Allow HR only */ |
| 2434 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 2435 | g_pars := f_gen_test_hdlr_pars(); |
| 2436 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2437 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2438 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2439 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 2440 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 2441 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 2442 | f_establish_fully(ass_cmd, exp_compl); |
| 2443 | } |
| 2444 | |
| 2445 | /* Allow FR only */ |
| 2446 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 2447 | g_pars := f_gen_test_hdlr_pars(); |
| 2448 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2449 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2450 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2451 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 2452 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 2453 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2454 | f_establish_fully(ass_cmd, exp_compl); |
| 2455 | } |
| 2456 | |
| 2457 | /* Allow HR only (expect assignment failure) */ |
| 2458 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 2459 | g_pars := f_gen_test_hdlr_pars(); |
| 2460 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2461 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2462 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2463 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 2464 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 2465 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 2466 | f_establish_fully(ass_cmd, exp_fail); |
| 2467 | } |
| 2468 | |
| 2469 | /* Allow FR only (expect assignment failure) */ |
| 2470 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 2471 | g_pars := f_gen_test_hdlr_pars(); |
| 2472 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2473 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2474 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2475 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 2476 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 2477 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2478 | f_establish_fully(ass_cmd, exp_fail); |
| 2479 | } |
| 2480 | |
| 2481 | /* Allow FR and HR, but prefer FR */ |
| 2482 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2483 | g_pars := f_gen_test_hdlr_pars(); |
| 2484 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2485 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2486 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2487 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2488 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2489 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2490 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2491 | f_establish_fully(ass_cmd, exp_compl); |
| 2492 | } |
| 2493 | |
| 2494 | /* Allow FR and HR, but prefer HR */ |
| 2495 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2496 | g_pars := f_gen_test_hdlr_pars(); |
| 2497 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2498 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2499 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2500 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2501 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2502 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2503 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2504 | f_establish_fully(ass_cmd, exp_compl); |
| 2505 | } |
| 2506 | |
| 2507 | /* Allow FR and HR, but prefer FR */ |
| 2508 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2509 | g_pars := f_gen_test_hdlr_pars(); |
| 2510 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2511 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2512 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2513 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2514 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2515 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2516 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2517 | f_establish_fully(ass_cmd, exp_compl); |
| 2518 | } |
| 2519 | |
| 2520 | /* Allow FR and HR, but prefer HR */ |
| 2521 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2522 | g_pars := f_gen_test_hdlr_pars(); |
| 2523 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2524 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2525 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2526 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2527 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2528 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2529 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2530 | f_establish_fully(ass_cmd, exp_compl); |
| 2531 | } |
| 2532 | |
| 2533 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 2534 | * to work without conflicts */ |
| 2535 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 2536 | var MSC_ConnHdlr vc_conn; |
| 2537 | f_init(1, true); |
| 2538 | f_sleep(1.0); |
| 2539 | f_enable_all_tch(); |
| 2540 | f_disable_all_tch_f(); |
| 2541 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 2542 | vc_conn.done; |
| 2543 | f_enable_all_tch(); |
| 2544 | setverdict(pass); |
| 2545 | } |
| 2546 | |
| 2547 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 2548 | * to fail. */ |
| 2549 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 2550 | var MSC_ConnHdlr vc_conn; |
| 2551 | f_init(1, true); |
| 2552 | f_sleep(1.0); |
| 2553 | f_enable_all_tch(); |
| 2554 | f_disable_all_tch_f(); |
| 2555 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 2556 | vc_conn.done; |
| 2557 | f_enable_all_tch(); |
| 2558 | setverdict(pass); |
| 2559 | } |
| 2560 | |
| 2561 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 2562 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 2563 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 2564 | var MSC_ConnHdlr vc_conn; |
| 2565 | f_init(1, true); |
| 2566 | f_sleep(1.0); |
| 2567 | f_enable_all_tch(); |
| 2568 | f_disable_all_tch_f(); |
| 2569 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 2570 | vc_conn.done; |
| 2571 | f_enable_all_tch(); |
| 2572 | setverdict(pass); |
| 2573 | } |
| 2574 | |
| 2575 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 2576 | * are exhausted, this is expected to work without conflicts. */ |
| 2577 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 2578 | var MSC_ConnHdlr vc_conn; |
| 2579 | f_init(1, true); |
| 2580 | f_sleep(1.0); |
| 2581 | f_enable_all_tch(); |
| 2582 | f_disable_all_tch_f(); |
| 2583 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 2584 | vc_conn.done; |
| 2585 | f_enable_all_tch(); |
| 2586 | setverdict(pass); |
| 2587 | } |
| 2588 | |
| 2589 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 2590 | * to work without conflicts */ |
| 2591 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 2592 | var MSC_ConnHdlr vc_conn; |
| 2593 | f_init(1, true); |
| 2594 | f_sleep(1.0); |
| 2595 | f_enable_all_tch(); |
| 2596 | f_disable_all_tch_h(); |
| 2597 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 2598 | vc_conn.done; |
| 2599 | f_enable_all_tch(); |
| 2600 | setverdict(pass); |
| 2601 | } |
| 2602 | |
| 2603 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 2604 | * to fail. */ |
| 2605 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 2606 | var MSC_ConnHdlr vc_conn; |
| 2607 | f_init(1, true); |
| 2608 | f_sleep(1.0); |
| 2609 | f_enable_all_tch(); |
| 2610 | f_disable_all_tch_h(); |
| 2611 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 2612 | vc_conn.done; |
| 2613 | f_enable_all_tch(); |
| 2614 | setverdict(pass); |
| 2615 | } |
| 2616 | |
| 2617 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 2618 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 2619 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 2620 | var MSC_ConnHdlr vc_conn; |
| 2621 | f_init(1, true); |
| 2622 | f_sleep(1.0); |
| 2623 | f_enable_all_tch(); |
| 2624 | f_disable_all_tch_h(); |
| 2625 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 2626 | vc_conn.done; |
| 2627 | f_enable_all_tch(); |
| 2628 | setverdict(pass); |
| 2629 | } |
| 2630 | |
| 2631 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 2632 | * are exhausted, this is expected to work without conflicts. */ |
| 2633 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 2634 | var MSC_ConnHdlr vc_conn; |
| 2635 | f_init(1, true); |
| 2636 | f_sleep(1.0); |
| 2637 | f_enable_all_tch(); |
| 2638 | f_disable_all_tch_h(); |
| 2639 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 2640 | vc_conn.done; |
| 2641 | f_enable_all_tch(); |
| 2642 | setverdict(pass); |
| 2643 | } |
| 2644 | |
| 2645 | /* Allow FR and HR, but prefer HR */ |
| 2646 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2647 | g_pars := f_gen_test_hdlr_pars(); |
| 2648 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2649 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2650 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2651 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2652 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2653 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2654 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2655 | f_establish_fully(ass_cmd, exp_compl); |
| 2656 | } |
| 2657 | |
| 2658 | /* Allow FR and HR, but prefer FR */ |
| 2659 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2660 | g_pars := f_gen_test_hdlr_pars(); |
| 2661 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2662 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2663 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2664 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2665 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2666 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2667 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2668 | f_establish_fully(ass_cmd, exp_compl); |
| 2669 | } |
| 2670 | |
| 2671 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 2672 | * HR, which is the prefered type, is selected. */ |
| 2673 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 2674 | var MSC_ConnHdlr vc_conn; |
| 2675 | f_init(1, true); |
| 2676 | f_sleep(1.0); |
| 2677 | f_enable_all_tch(); |
| 2678 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 2679 | vc_conn.done; |
| 2680 | setverdict(pass); |
| 2681 | } |
| 2682 | |
| 2683 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 2684 | * FR, which is the prefered type, is selected. */ |
| 2685 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 2686 | var MSC_ConnHdlr vc_conn; |
| 2687 | f_init(1, true); |
| 2688 | f_sleep(1.0); |
| 2689 | f_enable_all_tch(); |
| 2690 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 2691 | vc_conn.done; |
| 2692 | setverdict(pass); |
| 2693 | } |
| 2694 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 2695 | testcase TC_assignment_osmux() runs on test_CT { |
| 2696 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2697 | var MSC_ConnHdlr vc_conn; |
| 2698 | |
| 2699 | /* See note above */ |
| 2700 | var RSL_IE_Body mr_conf := { |
| 2701 | other := { |
| 2702 | len := 2, |
| 2703 | payload := '2804'O |
| 2704 | } |
| 2705 | }; |
| 2706 | |
| 2707 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2708 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 2709 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2710 | pars.expect_mr_conf_ie := mr_conf; |
| 2711 | pars.use_osmux := true; |
| 2712 | |
| 2713 | f_init(1, true, true); |
| 2714 | f_sleep(1.0); |
| 2715 | |
| 2716 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 2717 | vc_conn.done; |
| 2718 | } |
| 2719 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 2720 | /* test the procedure of the MSC requesting a Classmark Update: |
| 2721 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 2722 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2723 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2724 | g_pars := f_gen_test_hdlr_pars(); |
| 2725 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2726 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2727 | /* we should now have a COMPL_L3 at the MSC */ |
| 2728 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2729 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 2730 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 2731 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 2732 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2733 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 2734 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 2735 | setverdict(pass); |
| 2736 | } |
| 2737 | testcase TC_classmark() runs on test_CT { |
| 2738 | var MSC_ConnHdlr vc_conn; |
| 2739 | f_init(1, true); |
| 2740 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2741 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2742 | vc_conn.done; |
| 2743 | } |
| 2744 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2745 | 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] | 2746 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2747 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2748 | /* we should now have a COMPL_L3 at the MSC */ |
| 2749 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2750 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2751 | /* send the single message we want to send */ |
| 2752 | f_rsl_send_l3(l3); |
| 2753 | } |
| 2754 | |
| 2755 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 2756 | timer T := sec; |
| 2757 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2758 | T.start; |
| 2759 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2760 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 2761 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2762 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2763 | } |
| 2764 | [] T.timeout { |
| 2765 | setverdict(pass); |
| 2766 | } |
| 2767 | } |
| 2768 | } |
| 2769 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2770 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2771 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 2772 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 2773 | f_bssap_expect_nothing(); |
| 2774 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2775 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 2776 | var MSC_ConnHdlr vc_conn; |
| 2777 | f_init(1, true); |
| 2778 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2779 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2780 | vc_conn.done; |
| 2781 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 2782 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2783 | |
| 2784 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2785 | 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] | 2786 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 2787 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2788 | } |
| 2789 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 2790 | var MSC_ConnHdlr vc_conn; |
| 2791 | f_init(1, true); |
| 2792 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2793 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2794 | vc_conn.done; |
| 2795 | } |
| 2796 | |
| 2797 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2798 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2799 | 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] | 2800 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 2801 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2802 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2803 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 2804 | var MSC_ConnHdlr vc_conn; |
| 2805 | f_init(1, true); |
| 2806 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2807 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2808 | vc_conn.done; |
| 2809 | } |
| 2810 | |
| 2811 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2812 | /* short message from MS should be ignored */ |
| 2813 | 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] | 2814 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2815 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2816 | /* we should now have a COMPL_L3 at the MSC */ |
| 2817 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2818 | |
| 2819 | /* send short message */ |
| 2820 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 2821 | f_bssap_expect_nothing(); |
| 2822 | } |
| 2823 | testcase TC_err_82_short_msg() runs on test_CT { |
| 2824 | var MSC_ConnHdlr vc_conn; |
| 2825 | f_init(1, true); |
| 2826 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2827 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2828 | vc_conn.done; |
| 2829 | } |
| 2830 | |
| 2831 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2832 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 2833 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 2834 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 2835 | timer T := 3.0 |
| 2836 | alt { |
| 2837 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 2838 | setverdict(pass); |
| 2839 | } |
| 2840 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 2841 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2842 | } |
| 2843 | } |
| 2844 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 2845 | var MSC_ConnHdlr vc_conn; |
| 2846 | f_init(1, true); |
| 2847 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2848 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2849 | vc_conn.done; |
| 2850 | } |
| 2851 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2852 | /*********************************************************************** |
| 2853 | * Handover |
| 2854 | ***********************************************************************/ |
| 2855 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2856 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 2857 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 2858 | runs on test_CT { |
| 2859 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2860 | " timeslot "&int2str(ts_nr)&" "; |
| 2861 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2862 | } |
| 2863 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2864 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
| 2865 | private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr) |
| 2866 | runs on MSC_ConnHdlr { |
| 2867 | /* FIXME: resolve those from component-global state */ |
| 2868 | var integer ts_nr := chan_nr.tn; |
| 2869 | var integer ss_nr; |
| 2870 | if (ischosen(chan_nr.u.ch0)) { |
| 2871 | ss_nr := 0; |
| 2872 | } else if (ischosen(chan_nr.u.lm)) { |
| 2873 | ss_nr := chan_nr.u.lm.sub_chan; |
| 2874 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 2875 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 2876 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 2877 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 2878 | } else { |
| 2879 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2880 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2881 | } |
| 2882 | |
| 2883 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2884 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
| 2885 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2886 | } |
| 2887 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 2888 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 2889 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 2890 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 2891 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 2892 | * pair, not really to a specific BTS number. */ |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2893 | private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr, |
| 2894 | integer new_bts_nr) |
| 2895 | runs on MSC_ConnHdlr { |
| 2896 | f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
| 2897 | } |
| 2898 | |
| 2899 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 2900 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2901 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 2902 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2903 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2904 | const OCT8 kc := '0001020304050607'O; |
| 2905 | |
| 2906 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2907 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2908 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2909 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 2910 | f_bts_0_cfg({"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2911 | |
| 2912 | var HandoverState hs := { |
| 2913 | rr_ho_cmpl_seen := false, |
| 2914 | handover_done := false, |
| 2915 | old_chan_nr := - |
| 2916 | }; |
| 2917 | /* issue hand-over command on VTY */ |
| 2918 | f_vty_handover(0, 0, g_chan_nr, 1); |
| 2919 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 2920 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2921 | |
| 2922 | /* From the MGW perspective, a handover is is characterized by |
| 2923 | * performing one MDCX operation with the MGW. So we expect to see |
| 2924 | * one more MDCX during handover. */ |
| 2925 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 2926 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2927 | alt { |
| 2928 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2929 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2930 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 2931 | /* Since this is an internal handover we expect the BSC to inform the |
| 2932 | * MSC about the event */ |
| 2933 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 2934 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2935 | /* Check the amount of MGCP transactions is still consistant with the |
| 2936 | * test expectation */ |
| 2937 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 2938 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2939 | } |
| 2940 | |
| 2941 | testcase TC_ho_int() runs on test_CT { |
| 2942 | var MSC_ConnHdlr vc_conn; |
| 2943 | f_init(2, true); |
| 2944 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2945 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2946 | vc_conn.done; |
| 2947 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2948 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2949 | /* 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] | 2950 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2951 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2952 | var template MgcpResponse mgcp_resp; |
| 2953 | var MGCP_RecvFrom mrf; |
| 2954 | var template MgcpMessage msg_resp; |
| 2955 | var template MgcpMessage msg_dlcx := { |
| 2956 | command := tr_DLCX() |
| 2957 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2958 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2959 | if (g_pars.aoip) { |
| 2960 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2961 | log("Got first DLCX: ", mgcp); |
| 2962 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2963 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2964 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2965 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 2966 | log("Got second DLCX: ", mgcp); |
| 2967 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 2968 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2969 | } else { |
| 2970 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 2971 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 2972 | log("Got first DLCX: ", mrf.msg.command); |
| 2973 | msg_resp := { |
| 2974 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 2975 | } |
| 2976 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 2977 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2978 | } |
| 2979 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 2980 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2981 | } |
| 2982 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2983 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2984 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2985 | |
| 2986 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 2987 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2988 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2989 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2990 | f_establish_fully(ass_req, exp_compl); |
| 2991 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 2992 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2993 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 2994 | |
| 2995 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 2996 | |
| 2997 | f_sleep(0.5); |
| 2998 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 2999 | * the other BSS and comes back with a BSSMAP Handover Command |
| 3000 | * containing an RR Handover Command coming from the target BSS... */ |
| 3001 | |
| 3002 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 3003 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3004 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3005 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3006 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3007 | |
| 3008 | /* expect the Handover Command to go out on RR */ |
| 3009 | var RSL_Message rsl_ho_cmd |
| 3010 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3011 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3012 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3013 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3014 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3015 | setverdict(fail); |
| 3016 | } else { |
| 3017 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3018 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3019 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3020 | setverdict(fail); |
| 3021 | } else { |
| 3022 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3023 | setverdict(pass); |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | /* When the other BSS has reported a completed handover, this side is |
| 3028 | * torn down. */ |
| 3029 | |
| 3030 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 3031 | var BssmapCause cause := enum2int(cause_val); |
| 3032 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3033 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3034 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3035 | setverdict(pass); |
| 3036 | f_sleep(1.0); |
| 3037 | } |
| 3038 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 3039 | var MSC_ConnHdlr vc_conn; |
| 3040 | |
| 3041 | f_init(1, true); |
| 3042 | f_sleep(1.0); |
| 3043 | |
| 3044 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 3045 | vc_conn.done; |
| 3046 | } |
| 3047 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3048 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 3049 | * simply never sends a BSSMAP Handover Command. */ |
| 3050 | 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] | 3051 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3052 | |
| 3053 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3054 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3055 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3056 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3057 | f_establish_fully(ass_req, exp_compl); |
| 3058 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3059 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3060 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3061 | |
| 3062 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3063 | |
| 3064 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 3065 | * Let's give it a bit extra. */ |
| 3066 | f_sleep(15.0); |
| 3067 | |
| 3068 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 3069 | * is still going through. */ |
| 3070 | var octetstring l3 := '0123456789'O; |
| 3071 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 3072 | var template PDU_BSSAP exp_data := { |
| 3073 | discriminator := '1'B, |
| 3074 | spare := '0000000'B, |
| 3075 | dlci := '00'O, |
| 3076 | lengthIndicator := 5, |
| 3077 | pdu := { |
| 3078 | dtap := l3 |
| 3079 | } |
| 3080 | }; |
| 3081 | BSSAP.receive(exp_data); |
| 3082 | setverdict(pass); |
| 3083 | f_sleep(1.0); |
| 3084 | } |
| 3085 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 3086 | var MSC_ConnHdlr vc_conn; |
| 3087 | |
| 3088 | f_init(1, true); |
| 3089 | f_sleep(1.0); |
| 3090 | |
| 3091 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 3092 | vc_conn.done; |
| 3093 | } |
| 3094 | |
| 3095 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 3096 | * RR Handover Failure. */ |
| 3097 | 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] | 3098 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3099 | |
| 3100 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3101 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3102 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3103 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3104 | f_establish_fully(ass_req, exp_compl); |
| 3105 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3106 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3107 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3108 | |
| 3109 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3110 | |
| 3111 | f_sleep(0.5); |
| 3112 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 3113 | * the other BSS and comes back with a BSSMAP Handover Command |
| 3114 | * containing an RR Handover Command coming from the target BSS... */ |
| 3115 | |
| 3116 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 3117 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3118 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3119 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3120 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3121 | |
| 3122 | /* expect the Handover Command to go out on RR */ |
| 3123 | var RSL_Message rsl_ho_cmd |
| 3124 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3125 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3126 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3127 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3128 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3129 | setverdict(fail); |
| 3130 | } else { |
| 3131 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3132 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3133 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3134 | setverdict(fail); |
| 3135 | } else { |
| 3136 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3137 | setverdict(pass); |
| 3138 | } |
| 3139 | } |
| 3140 | |
| 3141 | f_sleep(0.2); |
| 3142 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 3143 | |
| 3144 | /* Should tell the MSC about the failure */ |
| 3145 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3146 | |
| 3147 | f_sleep(1.0); |
| 3148 | |
| 3149 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 3150 | * is still going through. */ |
| 3151 | var octetstring l3 := '0123456789'O; |
| 3152 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 3153 | var template PDU_BSSAP exp_data := { |
| 3154 | discriminator := '1'B, |
| 3155 | spare := '0000000'B, |
| 3156 | dlci := '00'O, |
| 3157 | lengthIndicator := 5, |
| 3158 | pdu := { |
| 3159 | dtap := l3 |
| 3160 | } |
| 3161 | }; |
| 3162 | BSSAP.receive(exp_data); |
| 3163 | setverdict(pass); |
| 3164 | f_sleep(1.0); |
| 3165 | |
| 3166 | setverdict(pass); |
| 3167 | f_sleep(1.0); |
| 3168 | } |
| 3169 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 3170 | var MSC_ConnHdlr vc_conn; |
| 3171 | |
| 3172 | f_init(1, true); |
| 3173 | f_sleep(1.0); |
| 3174 | |
| 3175 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 3176 | vc_conn.done; |
| 3177 | } |
| 3178 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 3179 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 3180 | * (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] | 3181 | * and the lchan is released. */ |
| 3182 | 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] | 3183 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3184 | |
| 3185 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3186 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3187 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3188 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3189 | f_establish_fully(ass_req, exp_compl); |
| 3190 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3191 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3192 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3193 | |
| 3194 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3195 | |
| 3196 | f_sleep(0.5); |
| 3197 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 3198 | * the other BSS and comes back with a BSSMAP Handover Command |
| 3199 | * containing an RR Handover Command coming from the target BSS... */ |
| 3200 | |
| 3201 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 3202 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3203 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3204 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3205 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3206 | |
| 3207 | /* expect the Handover Command to go out on RR */ |
| 3208 | var RSL_Message rsl_ho_cmd |
| 3209 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3210 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3211 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3212 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3213 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3214 | setverdict(fail); |
| 3215 | } else { |
| 3216 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3217 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3218 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3219 | setverdict(fail); |
| 3220 | } else { |
| 3221 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3222 | setverdict(pass); |
| 3223 | } |
| 3224 | } |
| 3225 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 3226 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 3227 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 3228 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3229 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3230 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 3231 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 3232 | log("Got BSSMAP Clear Request"); |
| 3233 | /* Instruct BSC to clear channel */ |
| 3234 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 3235 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3236 | |
| 3237 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3238 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 3239 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 3240 | log("Got Deact SACCH"); |
| 3241 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 3242 | [] 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] | 3243 | log("Got RR Release"); |
| 3244 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3245 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 3246 | log("Got RF Chan Rel"); |
| 3247 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 3248 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3249 | } |
| 3250 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3251 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 3252 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3253 | setverdict(pass); |
| 3254 | f_sleep(1.0); |
| 3255 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 3256 | 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] | 3257 | var MSC_ConnHdlr vc_conn; |
| 3258 | |
| 3259 | f_init(1, true); |
| 3260 | f_sleep(1.0); |
| 3261 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 3262 | 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] | 3263 | vc_conn.done; |
| 3264 | } |
| 3265 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3266 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 3267 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 3268 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 3269 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 3270 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 3271 | * before we get started. */ |
| 3272 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3273 | f_rslem_register(0, new_chan_nr); |
| 3274 | g_chan_nr := new_chan_nr; |
| 3275 | f_sleep(1.0); |
| 3276 | |
| 3277 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3278 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3279 | activate(as_Media()); |
| 3280 | |
| 3281 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3282 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3283 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3284 | |
| 3285 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3286 | |
| 3287 | var PDU_BSSAP rx_bssap; |
| 3288 | var octetstring ho_command_str; |
| 3289 | |
| 3290 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 3291 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3292 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3293 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3294 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3295 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3296 | |
| 3297 | var GsmArfcn arfcn; |
| 3298 | var RslChannelNr actual_new_chan_nr; |
| 3299 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3300 | actual_new_chan_nr, arfcn); |
| 3301 | |
| 3302 | if (actual_new_chan_nr != new_chan_nr) { |
| 3303 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3304 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3305 | setverdict(fail); |
| 3306 | return; |
| 3307 | } |
| 3308 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3309 | |
| 3310 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3311 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 3312 | * the new lchan with a Handover RACH: */ |
| 3313 | |
| 3314 | /* send handover detect */ |
| 3315 | |
| 3316 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 3317 | |
| 3318 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 3319 | |
| 3320 | /* send handover complete over the new channel */ |
| 3321 | |
| 3322 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 3323 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 3324 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 3325 | |
| 3326 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 3327 | setverdict(pass); |
| 3328 | } |
| 3329 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 3330 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3331 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3332 | |
| 3333 | f_init(1, true); |
| 3334 | f_sleep(1.0); |
| 3335 | |
| 3336 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3337 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3338 | |
| 3339 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 3340 | vc_conn.done; |
| 3341 | } |
| 3342 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3343 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 3344 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3345 | f_rslem_register(0, new_chan_nr); |
| 3346 | g_chan_nr := new_chan_nr; |
| 3347 | f_sleep(1.0); |
| 3348 | |
| 3349 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3350 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3351 | activate(as_Media()); |
| 3352 | |
| 3353 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3354 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3355 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3356 | |
| 3357 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3358 | |
| 3359 | var PDU_BSSAP rx_bssap; |
| 3360 | var octetstring ho_command_str; |
| 3361 | |
| 3362 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3363 | |
| 3364 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3365 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3366 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3367 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3368 | |
| 3369 | var GsmArfcn arfcn; |
| 3370 | var RslChannelNr actual_new_chan_nr; |
| 3371 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3372 | actual_new_chan_nr, arfcn); |
| 3373 | |
| 3374 | if (actual_new_chan_nr != new_chan_nr) { |
| 3375 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3376 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3377 | setverdict(fail); |
| 3378 | return; |
| 3379 | } |
| 3380 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3381 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 3382 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 3383 | f_sleep(1.0); |
| 3384 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3385 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3386 | * tells the MS to handover to the new lchan. In this case, the MS |
| 3387 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 3388 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 3389 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 3390 | * BSSMAP Clear Command: */ |
| 3391 | |
| 3392 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3393 | var BssmapCause cause := enum2int(cause_val); |
| 3394 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3395 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3396 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3397 | setverdict(pass); |
| 3398 | f_sleep(1.0); |
| 3399 | |
| 3400 | setverdict(pass); |
| 3401 | } |
| 3402 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 3403 | var MSC_ConnHdlr vc_conn; |
| 3404 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3405 | |
| 3406 | f_init(1, true); |
| 3407 | f_sleep(1.0); |
| 3408 | |
| 3409 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3410 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3411 | |
| 3412 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 3413 | vc_conn.done; |
| 3414 | } |
| 3415 | |
| 3416 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 3417 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 3418 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 3419 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 3420 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 3421 | * before we get started. */ |
| 3422 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3423 | f_rslem_register(0, new_chan_nr); |
| 3424 | g_chan_nr := new_chan_nr; |
| 3425 | f_sleep(1.0); |
| 3426 | |
| 3427 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3428 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3429 | activate(as_Media()); |
| 3430 | |
| 3431 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3432 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3433 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3434 | |
| 3435 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3436 | |
| 3437 | var PDU_BSSAP rx_bssap; |
| 3438 | var octetstring ho_command_str; |
| 3439 | |
| 3440 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3441 | |
| 3442 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3443 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3444 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3445 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3446 | |
| 3447 | var GsmArfcn arfcn; |
| 3448 | var RslChannelNr actual_new_chan_nr; |
| 3449 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3450 | actual_new_chan_nr, arfcn); |
| 3451 | |
| 3452 | if (actual_new_chan_nr != new_chan_nr) { |
| 3453 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3454 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3455 | setverdict(fail); |
| 3456 | return; |
| 3457 | } |
| 3458 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3459 | |
| 3460 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3461 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 3462 | * the new lchan with a Handover RACH: */ |
| 3463 | |
| 3464 | /* send handover detect */ |
| 3465 | |
| 3466 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 3467 | |
| 3468 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 3469 | |
| 3470 | /* The MSC chooses to clear the connection now, maybe we got the |
| 3471 | * Handover RACH on the new cell but the MS still signaled Handover |
| 3472 | * Failure to the old BSS? */ |
| 3473 | |
| 3474 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3475 | var BssmapCause cause := enum2int(cause_val); |
| 3476 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3477 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3478 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3479 | setverdict(pass); |
| 3480 | f_sleep(1.0); |
| 3481 | } |
| 3482 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 3483 | var MSC_ConnHdlr vc_conn; |
| 3484 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3485 | |
| 3486 | f_init(1, true); |
| 3487 | f_sleep(1.0); |
| 3488 | |
| 3489 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3490 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3491 | |
| 3492 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 3493 | vc_conn.done; |
| 3494 | } |
| 3495 | |
| 3496 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 3497 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 3498 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3499 | f_rslem_register(0, new_chan_nr); |
| 3500 | g_chan_nr := new_chan_nr; |
| 3501 | f_sleep(1.0); |
| 3502 | |
| 3503 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3504 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3505 | activate(as_Media()); |
| 3506 | |
| 3507 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3508 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3509 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3510 | |
| 3511 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3512 | |
| 3513 | var PDU_BSSAP rx_bssap; |
| 3514 | var octetstring ho_command_str; |
| 3515 | |
| 3516 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3517 | |
| 3518 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3519 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3520 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3521 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3522 | |
| 3523 | var GsmArfcn arfcn; |
| 3524 | var RslChannelNr actual_new_chan_nr; |
| 3525 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3526 | actual_new_chan_nr, arfcn); |
| 3527 | |
| 3528 | if (actual_new_chan_nr != new_chan_nr) { |
| 3529 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3530 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3531 | setverdict(fail); |
| 3532 | return; |
| 3533 | } |
| 3534 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3535 | |
| 3536 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3537 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 3538 | * on the new lchan. */ |
| 3539 | |
| 3540 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3541 | |
| 3542 | /* Did osmo-bsc also send a Clear Request? */ |
| 3543 | timer T := 0.5; |
| 3544 | T.start; |
| 3545 | alt { |
| 3546 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 3547 | [] T.timeout { } |
| 3548 | } |
| 3549 | |
| 3550 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 3551 | * asked for it, this is a Handover Failure after all). */ |
| 3552 | |
| 3553 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3554 | var BssmapCause cause := enum2int(cause_val); |
| 3555 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3556 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3557 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3558 | setverdict(pass); |
| 3559 | f_sleep(1.0); |
| 3560 | |
| 3561 | setverdict(pass); |
| 3562 | } |
| 3563 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 3564 | var MSC_ConnHdlr vc_conn; |
| 3565 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3566 | |
| 3567 | f_init(1, true); |
| 3568 | f_sleep(1.0); |
| 3569 | |
| 3570 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3571 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3572 | |
| 3573 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 3574 | vc_conn.done; |
| 3575 | } |
| 3576 | |
| 3577 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 3578 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 3579 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3580 | f_rslem_register(0, new_chan_nr); |
| 3581 | g_chan_nr := new_chan_nr; |
| 3582 | f_sleep(1.0); |
| 3583 | |
| 3584 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3585 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3586 | activate(as_Media()); |
| 3587 | |
| 3588 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3589 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3590 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3591 | |
| 3592 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3593 | |
| 3594 | var PDU_BSSAP rx_bssap; |
| 3595 | var octetstring ho_command_str; |
| 3596 | |
| 3597 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3598 | |
| 3599 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3600 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3601 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3602 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3603 | |
| 3604 | var GsmArfcn arfcn; |
| 3605 | var RslChannelNr actual_new_chan_nr; |
| 3606 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3607 | actual_new_chan_nr, arfcn); |
| 3608 | |
| 3609 | if (actual_new_chan_nr != new_chan_nr) { |
| 3610 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3611 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3612 | setverdict(fail); |
| 3613 | return; |
| 3614 | } |
| 3615 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3616 | |
| 3617 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3618 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 3619 | * on the new lchan. */ |
| 3620 | |
| 3621 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3622 | |
| 3623 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3624 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 3625 | |
| 3626 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3627 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 3628 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3629 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3630 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3631 | setverdict(pass); |
| 3632 | f_sleep(1.0); |
| 3633 | } |
| 3634 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 3635 | var MSC_ConnHdlr vc_conn; |
| 3636 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3637 | |
| 3638 | f_init(1, true); |
| 3639 | f_sleep(1.0); |
| 3640 | |
| 3641 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3642 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3643 | |
| 3644 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 3645 | vc_conn.done; |
| 3646 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3647 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3648 | type record of charstring Commands; |
| 3649 | |
| 3650 | private function f_bts_0_cfg(Commands cmds := {}) runs on MSC_ConnHdlr |
| 3651 | { |
| 3652 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 3653 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 3654 | f_vty_transceive(BSCVTY, cmds[i]); |
| 3655 | } |
| 3656 | f_vty_transceive(BSCVTY, "end"); |
| 3657 | } |
| 3658 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 3659 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 3660 | { |
| 3661 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 3662 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 3663 | f_vty_transceive(pt, cmds[i]); |
| 3664 | } |
| 3665 | f_vty_transceive(pt, "end"); |
| 3666 | } |
| 3667 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3668 | private function f_probe_for_handover(charstring log_label, |
| 3669 | charstring log_descr, |
| 3670 | charstring handover_vty_cmd, |
| 3671 | boolean expect_handover, |
| 3672 | boolean is_inter_bsc_handover := false) |
| 3673 | runs on MSC_ConnHdlr |
| 3674 | { |
| 3675 | var RSL_Message rsl; |
| 3676 | |
| 3677 | var charstring log_msg := " (expecting handover)" |
| 3678 | if (not expect_handover) { |
| 3679 | log_msg := " (expecting NO handover)"; |
| 3680 | } |
| 3681 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 3682 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 3683 | |
| 3684 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 3685 | * lchans to be established on bts 1 or bts 2. */ |
| 3686 | f_rslem_suspend(RSL1_PROC); |
| 3687 | f_rslem_suspend(RSL2_PROC); |
| 3688 | |
| 3689 | timer T := 2.0; |
| 3690 | T.start; |
| 3691 | |
| 3692 | alt { |
| 3693 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 3694 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 3695 | log("Rx L3 from net: ", l3); |
| 3696 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 3697 | var RslChannelNr new_chan_nr; |
| 3698 | var GsmArfcn arfcn; |
| 3699 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 3700 | new_chan_nr, arfcn); |
| 3701 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 3702 | log(l3.msgs.rrm.handoverCommand); |
| 3703 | |
| 3704 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 3705 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 3706 | * anyway. */ |
| 3707 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 3708 | f_rslem_resume(RSL1_PROC); |
| 3709 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 3710 | f_rslem_resume(RSL2_PROC); |
| 3711 | |
| 3712 | if (expect_handover and not is_inter_bsc_handover) { |
| 3713 | setverdict(pass); |
| 3714 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 3715 | } else { |
| 3716 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 3717 | & log_label & ": " & log_descr); |
| 3718 | } |
| 3719 | |
| 3720 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 3721 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 3722 | * Handover Failure. */ |
| 3723 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 3724 | |
| 3725 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 3726 | f_sleep(0.5); |
| 3727 | RSL1.clear; |
| 3728 | RSL2.clear; |
| 3729 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 3730 | break; |
| 3731 | } else { |
| 3732 | repeat; |
| 3733 | } |
| 3734 | } |
| 3735 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 3736 | if (expect_handover and is_inter_bsc_handover) { |
| 3737 | setverdict(pass); |
| 3738 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 3739 | } else { |
| 3740 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 3741 | & log_label & ": " & log_descr); |
| 3742 | } |
| 3743 | |
| 3744 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 3745 | |
| 3746 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 3747 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 3748 | * setting a short timeout and waiting is the only way. */ |
| 3749 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 3750 | f_sleep(1.5); |
| 3751 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 3752 | |
| 3753 | break; |
| 3754 | } |
| 3755 | [] T.timeout { |
| 3756 | if (expect_handover) { |
| 3757 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 3758 | & log_label & ": " & log_descr); |
| 3759 | } else { |
| 3760 | setverdict(pass); |
| 3761 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 3762 | } |
| 3763 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 3764 | break; |
| 3765 | } |
| 3766 | } |
| 3767 | |
| 3768 | f_rslem_resume(RSL1_PROC); |
| 3769 | f_rslem_resume(RSL2_PROC); |
| 3770 | f_sleep(3.0); |
| 3771 | RSL.clear; |
| 3772 | |
| 3773 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 3774 | } |
| 3775 | |
| 3776 | /* Test the effect of various neighbor configuration scenarios: |
| 3777 | * |
| 3778 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 3779 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 3780 | */ |
| 3781 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 3782 | g_pars := f_gen_test_hdlr_pars(); |
| 3783 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3784 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3785 | const OCT8 kc := '0001020304050607'O; |
| 3786 | |
| 3787 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3788 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3789 | |
| 3790 | /* Establish lchan at bts 0 */ |
| 3791 | f_establish_fully(ass_cmd, exp_compl); |
| 3792 | |
| 3793 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 3794 | f_vty_enter_cfg_network(BSCVTY); |
| 3795 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 3796 | f_vty_transceive(BSCVTY, "end"); |
| 3797 | } |
| 3798 | |
| 3799 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 3800 | f_tc_ho_neighbor_config_start(); |
| 3801 | |
| 3802 | /* |
| 3803 | * bts 0 ARFCN 871 BSIC 10 |
| 3804 | * bts 1 ARFCN 871 BSIC 11 |
| 3805 | * bts 2 ARFCN 871 BSIC 12 |
| 3806 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3807 | */ |
| 3808 | |
| 3809 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
| 3810 | f_bts_0_cfg({"no neighbors"}); |
| 3811 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 3812 | "handover any to arfcn 871 bsic 11", |
| 3813 | true); |
| 3814 | |
| 3815 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 3816 | "handover any to arfcn 13 bsic 39", |
| 3817 | false); |
| 3818 | |
| 3819 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 3820 | "handover any to arfcn 871 bsic 12", |
| 3821 | false); |
| 3822 | |
| 3823 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 3824 | "handover any to arfcn 871 bsic 11", |
| 3825 | true); |
| 3826 | } |
| 3827 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 3828 | f_tc_ho_neighbor_config_start(); |
| 3829 | |
| 3830 | /* |
| 3831 | * bts 0 ARFCN 871 BSIC 10 |
| 3832 | * bts 1 ARFCN 871 BSIC 11 |
| 3833 | * bts 2 ARFCN 871 BSIC 12 |
| 3834 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3835 | */ |
| 3836 | |
| 3837 | log("f_tc_ho_neighbor_config: 2. explicit local neighbor: 'neighbor bts 1'"); |
| 3838 | f_bts_0_cfg({"neighbor bts 1"}); |
| 3839 | f_sleep(0.5); |
| 3840 | |
| 3841 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 3842 | "handover any to arfcn 871 bsic 11", |
| 3843 | true); |
| 3844 | |
| 3845 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 3846 | "handover any to arfcn 871 bsic 12", |
| 3847 | false); |
| 3848 | } |
| 3849 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 3850 | f_tc_ho_neighbor_config_start(); |
| 3851 | |
| 3852 | /* |
| 3853 | * bts 0 ARFCN 871 BSIC 10 |
| 3854 | * bts 1 ARFCN 871 BSIC 11 |
| 3855 | * bts 2 ARFCN 871 BSIC 12 |
| 3856 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3857 | */ |
| 3858 | |
| 3859 | log("f_tc_ho_neighbor_config: 3. explicit local neighbor: 'neighbor bts 2'"); |
| 3860 | f_bts_0_cfg({"no neighbors", "neighbor bts 2"}); |
| 3861 | f_sleep(0.5); |
| 3862 | |
| 3863 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 3864 | "handover any to arfcn 871 bsic 11", |
| 3865 | false); |
| 3866 | 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", |
| 3867 | "handover any to arfcn 871 bsic 12", |
| 3868 | true); |
| 3869 | } |
| 3870 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 3871 | f_tc_ho_neighbor_config_start(); |
| 3872 | |
| 3873 | /* |
| 3874 | * bts 0 ARFCN 871 BSIC 10 |
| 3875 | * bts 1 ARFCN 871 BSIC 11 |
| 3876 | * bts 2 ARFCN 871 BSIC 12 |
| 3877 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3878 | */ |
| 3879 | |
| 3880 | log("f_tc_ho_neighbor_config: 4. explicit remote neighbor: 'neighbor lac 99 arfcn 123 bsic 45'"); |
| 3881 | f_bts_0_cfg({"no neighbors", "neighbor lac 99 arfcn 123 bsic 45"}); |
| 3882 | f_sleep(0.5); |
| 3883 | |
| 3884 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 3885 | "handover any to arfcn 871 bsic 11", |
| 3886 | false); |
| 3887 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 3888 | "handover any to arfcn 871 bsic 12", |
| 3889 | false); |
| 3890 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 3891 | "handover any to arfcn 123 bsic 45", |
| 3892 | true, true); |
| 3893 | } |
| 3894 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 3895 | f_tc_ho_neighbor_config_start(); |
| 3896 | |
| 3897 | /* |
| 3898 | * bts 0 ARFCN 871 BSIC 10 |
| 3899 | * bts 1 ARFCN 871 BSIC 11 |
| 3900 | * bts 2 ARFCN 871 BSIC 12 |
| 3901 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3902 | */ |
| 3903 | |
| 3904 | log("f_tc_ho_neighbor_config: 5. explicit remote neighbor re-using ARFCN+BSIC: 'neighbor lac 99 arfcn 871 bsic 12'"); |
| 3905 | f_bts_0_cfg({"no neighbors", "neighbor lac 99 arfcn 871 bsic 12"}); |
| 3906 | f_sleep(0.5); |
| 3907 | |
| 3908 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 3909 | "handover any to arfcn 871 bsic 12", |
| 3910 | true, true); |
| 3911 | } |
| 3912 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 3913 | f_tc_ho_neighbor_config_start(); |
| 3914 | |
| 3915 | /* |
| 3916 | * bts 0 ARFCN 871 BSIC 10 |
| 3917 | * bts 1 ARFCN 871 BSIC 11 |
| 3918 | * bts 2 ARFCN 871 BSIC 12 |
| 3919 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3920 | */ |
| 3921 | |
| 3922 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 3923 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
| 3924 | f_bts_0_cfg({"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 871 bsic 12"}); |
| 3925 | f_sleep(0.5); |
| 3926 | |
| 3927 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 3928 | "handover any to arfcn 871 bsic 12", |
| 3929 | false); |
| 3930 | } |
| 3931 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 3932 | f_tc_ho_neighbor_config_start(); |
| 3933 | |
| 3934 | /* |
| 3935 | * bts 0 ARFCN 871 BSIC 10 |
| 3936 | * bts 1 ARFCN 871 BSIC 11 |
| 3937 | * bts 2 ARFCN 871 BSIC 12 |
| 3938 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3939 | */ |
| 3940 | |
| 3941 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 3942 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
| 3943 | f_bts_0_cfg({"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 123 bsic 45"}); |
| 3944 | f_sleep(0.5); |
| 3945 | |
| 3946 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 3947 | "handover any to arfcn 871 bsic 12", |
| 3948 | true); |
| 3949 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 3950 | "handover any to arfcn 123 bsic 45", |
| 3951 | true, true); |
| 3952 | } |
| 3953 | |
| 3954 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 3955 | var MSC_ConnHdlr vc_conn; |
| 3956 | f_init(3, true); |
| 3957 | f_sleep(1.0); |
| 3958 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 3959 | vc_conn.done; |
| 3960 | } |
| 3961 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 3962 | var MSC_ConnHdlr vc_conn; |
| 3963 | f_init(3, true); |
| 3964 | f_sleep(1.0); |
| 3965 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 3966 | vc_conn.done; |
| 3967 | } |
| 3968 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 3969 | var MSC_ConnHdlr vc_conn; |
| 3970 | f_init(3, true); |
| 3971 | f_sleep(1.0); |
| 3972 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 3973 | vc_conn.done; |
| 3974 | } |
| 3975 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 3976 | var MSC_ConnHdlr vc_conn; |
| 3977 | f_init(3, true); |
| 3978 | f_sleep(1.0); |
| 3979 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 3980 | vc_conn.done; |
| 3981 | } |
| 3982 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 3983 | var MSC_ConnHdlr vc_conn; |
| 3984 | f_init(3, true); |
| 3985 | f_sleep(1.0); |
| 3986 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 3987 | vc_conn.done; |
| 3988 | } |
| 3989 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 3990 | var MSC_ConnHdlr vc_conn; |
| 3991 | f_init(3, true); |
| 3992 | f_sleep(1.0); |
| 3993 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 3994 | vc_conn.done; |
| 3995 | } |
| 3996 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 3997 | var MSC_ConnHdlr vc_conn; |
| 3998 | f_init(3, true); |
| 3999 | f_sleep(1.0); |
| 4000 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 4001 | vc_conn.done; |
| 4002 | } |
| 4003 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4004 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4005 | * BSSMAP Reset just because of that. */ |
| 4006 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 4007 | var default d; |
| 4008 | var integer i; |
| 4009 | var DchanTuple dt; |
| 4010 | |
| 4011 | f_init(); |
| 4012 | |
| 4013 | /* Wait for initial BSSMAP Reset to pass */ |
| 4014 | f_sleep(4.0); |
| 4015 | |
| 4016 | d := activate(no_bssmap_reset()); |
| 4017 | |
| 4018 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4019 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4020 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 4021 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4022 | /* Since we're doing a lot of runs, give each one a fresh |
| 4023 | * T_guard from the top. */ |
| 4024 | T_guard.start; |
| 4025 | |
| 4026 | /* Setup a BSSAP connection and clear it right away. This is |
| 4027 | * the MSC telling the BSC about a planned release, it's not an |
| 4028 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 4029 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4030 | |
| 4031 | /* MSC disconnects (RLSD). */ |
| 4032 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 4033 | } |
| 4034 | |
| 4035 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4036 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4037 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4038 | f_sleep(4.0); |
| 4039 | |
| 4040 | deactivate(d); |
| 4041 | f_shutdown_helper(); |
| 4042 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4043 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4044 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4045 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 4046 | * the MSC. */ |
| 4047 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 4048 | var default d; |
| 4049 | var integer i; |
| 4050 | var DchanTuple dt; |
| 4051 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4052 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 4053 | var BssmapCause cause := enum2int(cause_val); |
| 4054 | |
| 4055 | f_init(); |
| 4056 | |
| 4057 | /* Wait for initial BSSMAP Reset to pass */ |
| 4058 | f_sleep(4.0); |
| 4059 | |
| 4060 | d := activate(no_bssmap_reset()); |
| 4061 | |
| 4062 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4063 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4064 | * Let's do it some more times for good measure. */ |
| 4065 | for (i := 0; i < 8; i := i+1) { |
| 4066 | /* Since we're doing a lot of runs, give each one a fresh |
| 4067 | * T_guard from the top. */ |
| 4068 | T_guard.start; |
| 4069 | |
| 4070 | /* Setup a BSSAP connection and clear it right away. This is |
| 4071 | * the MSC telling the BSC about a planned release, it's not an |
| 4072 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 4073 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4074 | |
| 4075 | /* Instruct BSC to clear channel */ |
| 4076 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 4077 | |
| 4078 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 4079 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4080 | } |
| 4081 | |
| 4082 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4083 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4084 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4085 | f_sleep(4.0); |
| 4086 | |
| 4087 | deactivate(d); |
| 4088 | f_shutdown_helper(); |
| 4089 | } |
| 4090 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4091 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4092 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 4093 | * Release Ind on RSL. */ |
| 4094 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 4095 | var default d; |
| 4096 | var integer i; |
| 4097 | var DchanTuple dt; |
| 4098 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4099 | var integer j; |
| 4100 | |
| 4101 | f_init(); |
| 4102 | |
| 4103 | /* Wait for initial BSSMAP Reset to pass */ |
| 4104 | f_sleep(4.0); |
| 4105 | |
| 4106 | d := activate(no_bssmap_reset()); |
| 4107 | |
| 4108 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4109 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4110 | * Let's do it some more times for good measure. */ |
| 4111 | for (i := 0; i < 8; i := i+1) { |
| 4112 | /* Since we're doing a lot of runs, give each one a fresh |
| 4113 | * T_guard from the top. */ |
| 4114 | T_guard.start; |
| 4115 | |
| 4116 | /* Setup a BSSAP connection and clear it right away. This is |
| 4117 | * the MSC telling the BSC about a planned release, it's not an |
| 4118 | * erratic loss of a connection. */ |
| 4119 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 4120 | |
| 4121 | /* simulate RLL REL IND */ |
| 4122 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 4123 | |
| 4124 | /* expect Clear Request on MSC side */ |
| 4125 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 4126 | |
| 4127 | /* Instruct BSC to clear channel */ |
| 4128 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 4129 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 4130 | |
| 4131 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 4132 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4133 | } |
| 4134 | |
| 4135 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4136 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4137 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4138 | f_sleep(4.0); |
| 4139 | |
| 4140 | deactivate(d); |
| 4141 | f_shutdown_helper(); |
| 4142 | } |
| 4143 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4144 | /*********************************************************************** |
| 4145 | * IPA style dynamic PDCH |
| 4146 | ***********************************************************************/ |
| 4147 | |
| 4148 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4149 | template (omit) RSL_Cause nack := omit) |
| 4150 | runs on test_CT { |
| 4151 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 4152 | var RSL_Message rsl_unused; |
| 4153 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4154 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 4155 | /* expect the BSC to issue the related RSL command */ |
| 4156 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4157 | if (istemplatekind(nack, "omit")) { |
| 4158 | /* respond with a related acknowledgement */ |
| 4159 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4160 | } else { |
| 4161 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 4162 | } |
| 4163 | } |
| 4164 | |
| 4165 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4166 | template (omit) RSL_Cause nack := omit) |
| 4167 | runs on test_CT { |
| 4168 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 4169 | var RSL_Message rsl_unused; |
| 4170 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4171 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 4172 | /* expect the BSC to issue the related RSL command */ |
| 4173 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 4174 | if (istemplatekind(nack, "omit")) { |
| 4175 | /* respond with a related acknowledgement */ |
| 4176 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 4177 | } else { |
| 4178 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 4179 | } |
| 4180 | } |
| 4181 | |
| 4182 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 4183 | runs on test_CT return charstring { |
| 4184 | var charstring cmd, resp; |
| 4185 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 4186 | 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] | 4187 | } |
| 4188 | |
| 4189 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4190 | template charstring exp) |
| 4191 | runs on test_CT { |
| 4192 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 4193 | if (not match(mode, exp)) { |
| 4194 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4195 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4196 | } |
| 4197 | } |
| 4198 | |
| 4199 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 4200 | runs on test_CT { |
| 4201 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 4202 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 4203 | f_vty_transceive(BSCVTY, "end"); |
| 4204 | } |
| 4205 | |
| 4206 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 4207 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 4208 | private const charstring PDCH_MODE := "PDCH mode"; |
| 4209 | private const charstring NONE_MODE := "NONE mode"; |
| 4210 | |
| 4211 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 4212 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 4213 | var RSL_Message rsl_unused; |
| 4214 | |
| 4215 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4216 | f_init_vty(); |
| 4217 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 4218 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4219 | |
| 4220 | f_init(1, false); |
| 4221 | f_sleep(1.0); |
| 4222 | |
| 4223 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 4224 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4225 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4226 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4227 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4228 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4229 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4230 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4231 | 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] | 4232 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4233 | |
| 4234 | /* De-activate it via VTY */ |
| 4235 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4236 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4237 | 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] | 4238 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4239 | |
| 4240 | /* re-activate it via VTY */ |
| 4241 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 4242 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4243 | 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] | 4244 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4245 | |
| 4246 | /* and finally de-activate it again */ |
| 4247 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4248 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4249 | 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] | 4250 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4251 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4252 | /* clean up config */ |
| 4253 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4254 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4255 | setverdict(pass); |
| 4256 | } |
| 4257 | |
| 4258 | /* Test IPA PDCH activation NACK */ |
| 4259 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 4260 | var RSL_Message rsl_unused; |
| 4261 | |
| 4262 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4263 | f_init_vty(); |
| 4264 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 4265 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4266 | |
| 4267 | f_init(1, false); |
| 4268 | f_sleep(1.0); |
| 4269 | |
| 4270 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 4271 | |
| 4272 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4273 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4274 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4275 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4276 | f_sleep(1.0); |
| 4277 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4278 | |
| 4279 | /* De-activate it via VTY */ |
| 4280 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4281 | f_sleep(1.0); |
| 4282 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4283 | |
| 4284 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 4285 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 4286 | f_sleep(1.0); |
| 4287 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4288 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4289 | /* clean up config */ |
| 4290 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4291 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4292 | setverdict(pass); |
| 4293 | } |
| 4294 | |
| 4295 | |
| 4296 | /*********************************************************************** |
| 4297 | * Osmocom style dynamic PDCH |
| 4298 | ***********************************************************************/ |
| 4299 | |
| 4300 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4301 | template (omit) RSL_Cause nack := omit) |
| 4302 | runs on test_CT { |
| 4303 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 4304 | var RSL_Message rsl_unused; |
| 4305 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4306 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 4307 | /* expect the BSC to issue the related RSL command */ |
| 4308 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 4309 | if (istemplatekind(nack, "omit")) { |
| 4310 | /* respond with a related acknowledgement */ |
| 4311 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 4312 | } else { |
| 4313 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 4314 | } |
| 4315 | } |
| 4316 | |
| 4317 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4318 | template (omit) RSL_Cause nack := omit) |
| 4319 | runs on test_CT { |
| 4320 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 4321 | var RSL_Message rsl_unused; |
| 4322 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4323 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 4324 | /* expect the BSC to issue the related RSL command */ |
| 4325 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 4326 | if (istemplatekind(nack, "omit")) { |
| 4327 | /* respond with a related acknowledgement */ |
| 4328 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 4329 | } else { |
| 4330 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 4331 | } |
| 4332 | } |
| 4333 | |
| 4334 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 4335 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 4336 | var RSL_Message rsl_unused; |
| 4337 | |
| 4338 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4339 | f_init_vty(); |
| 4340 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 4341 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4342 | |
| 4343 | f_init(1, false); |
| 4344 | f_sleep(1.0); |
| 4345 | |
| 4346 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 4347 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4348 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4349 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4350 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4351 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 4352 | |
| 4353 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 4354 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4355 | 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] | 4356 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4357 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4358 | /* clean up config */ |
| 4359 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4360 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4361 | setverdict(pass); |
| 4362 | } |
| 4363 | |
| 4364 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 4365 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 4366 | var RSL_Message rsl_unused; |
| 4367 | |
| 4368 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4369 | f_init_vty(); |
| 4370 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 4371 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4372 | |
| 4373 | f_init(1, false); |
| 4374 | f_sleep(1.0); |
| 4375 | |
| 4376 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 4377 | |
| 4378 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4379 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4380 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 4381 | |
| 4382 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 4383 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 4384 | f_sleep(1.0); |
| 4385 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4386 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4387 | /* clean up config */ |
| 4388 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4389 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4390 | setverdict(pass); |
| 4391 | } |
| 4392 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4393 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 4394 | 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] | 4395 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 4396 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 4397 | } |
| 4398 | } |
| 4399 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4400 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 4401 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 4402 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 4403 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 4404 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 4405 | } |
| 4406 | } |
| 4407 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 4408 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 4409 | the BTS does autonomous MS power control loop */ |
| 4410 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 4411 | var MSC_ConnHdlr vc_conn; |
| 4412 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4413 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 4414 | pars.exp_ms_power_params := true; |
| 4415 | |
| 4416 | f_init(1, true); |
| 4417 | f_sleep(1.0); |
| 4418 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 4419 | vc_conn.done; |
| 4420 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4421 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 4422 | /* Dyn PDCH todo: |
| 4423 | * activate OSMO as TCH/F |
| 4424 | * activate OSMO as TCH/H |
| 4425 | * does the BSC-located PCU socket get the updated INFO? |
| 4426 | * what if no PCU is connected at the time? |
| 4427 | * is the info correct on delayed PCU (re)connect? |
| 4428 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4429 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 4430 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4431 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4432 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 4433 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 4434 | execute( TC_ctrl() ); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 4435 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
| 4436 | execute( TC_ctrl_location() ); |
| 4437 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4438 | |
| 4439 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 4440 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4441 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 4442 | execute( TC_chan_act_ack_noest() ); |
| 4443 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 4444 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 4445 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 4446 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 4447 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4448 | execute( TC_chan_rel_rll_rel_ind() ); |
| 4449 | execute( TC_chan_rel_conn_fail() ); |
| 4450 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 4451 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 4452 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 4453 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 4454 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 4455 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 4456 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 4457 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4458 | |
| 4459 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 4460 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 4461 | execute( TC_assignment_csd() ); |
| 4462 | execute( TC_assignment_ctm() ); |
| 4463 | execute( TC_assignment_sign() ); |
| 4464 | execute( TC_assignment_fr_a5_0() ); |
| 4465 | execute( TC_assignment_fr_a5_1() ); |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 4466 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 4467 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 4468 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 4469 | execute( TC_assignment_fr_a5_3() ); |
| 4470 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4471 | execute( TC_ciph_mode_a5_0() ); |
| 4472 | execute( TC_ciph_mode_a5_1() ); |
| 4473 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 4474 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4475 | execute( TC_assignment_codec_fr() ); |
| 4476 | execute( TC_assignment_codec_hr() ); |
| 4477 | execute( TC_assignment_codec_efr() ); |
| 4478 | execute( TC_assignment_codec_amr_f() ); |
| 4479 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 4480 | |
| 4481 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 4482 | execute( TC_assignment_codec_amr_f_S1() ); |
| 4483 | execute( TC_assignment_codec_amr_h_S1() ); |
| 4484 | execute( TC_assignment_codec_amr_f_S124() ); |
| 4485 | execute( TC_assignment_codec_amr_h_S124() ); |
| 4486 | execute( TC_assignment_codec_amr_f_S0() ); |
| 4487 | execute( TC_assignment_codec_amr_f_S02() ); |
| 4488 | execute( TC_assignment_codec_amr_f_S024() ); |
| 4489 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 4490 | execute( TC_assignment_codec_amr_h_S0() ); |
| 4491 | execute( TC_assignment_codec_amr_h_S02() ); |
| 4492 | execute( TC_assignment_codec_amr_h_S024() ); |
| 4493 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 4494 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 4495 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 4496 | execute( TC_assignment_codec_amr_f_zero() ); |
| 4497 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 4498 | execute( TC_assignment_codec_amr_h_S7() ); |
| 4499 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4500 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4501 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 4502 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 4503 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 4504 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 4505 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 4506 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 4507 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 4508 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 4509 | execute( TC_assignment_codec_req_hr_fr() ); |
| 4510 | execute( TC_assignment_codec_req_fr_hr() ); |
| 4511 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 4512 | if (mp_enable_osmux_test) { |
| 4513 | execute( TC_assignment_osmux() ); |
| 4514 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4515 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4516 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 4517 | execute( TC_rll_est_ind_inact_lchan() ); |
| 4518 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 4519 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 4520 | execute( TC_rll_est_ind_inval_sacch() ); |
| 4521 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4522 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 4523 | execute( TC_paging_imsi_nochan() ); |
| 4524 | execute( TC_paging_tmsi_nochan() ); |
| 4525 | execute( TC_paging_tmsi_any() ); |
| 4526 | execute( TC_paging_tmsi_sdcch() ); |
| 4527 | execute( TC_paging_tmsi_tch_f() ); |
| 4528 | execute( TC_paging_tmsi_tch_hf() ); |
| 4529 | execute( TC_paging_imsi_nochan_cgi() ); |
| 4530 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 4531 | execute( TC_paging_imsi_nochan_ci() ); |
| 4532 | execute( TC_paging_imsi_nochan_lai() ); |
| 4533 | execute( TC_paging_imsi_nochan_lac() ); |
| 4534 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 4535 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 4536 | execute( TC_paging_imsi_nochan_rnc() ); |
| 4537 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 4538 | execute( TC_paging_imsi_nochan_lacs() ); |
| 4539 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 4540 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 4541 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 4542 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 4543 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 4544 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 4545 | |
| 4546 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 4547 | execute( TC_rsl_unknown_unit_id() ); |
| 4548 | |
| 4549 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4550 | |
| 4551 | execute( TC_classmark() ); |
| 4552 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4553 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4554 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4555 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4556 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4557 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4558 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4559 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4560 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4561 | execute( TC_ho_out_fail_no_msc_response() ); |
| 4562 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4563 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4564 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4565 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4566 | execute( TC_ho_in_fail_msc_clears() ); |
| 4567 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 4568 | execute( TC_ho_in_fail_no_detect() ); |
| 4569 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4570 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4571 | execute( TC_ho_neighbor_config_1() ); |
| 4572 | execute( TC_ho_neighbor_config_2() ); |
| 4573 | execute( TC_ho_neighbor_config_3() ); |
| 4574 | execute( TC_ho_neighbor_config_4() ); |
| 4575 | execute( TC_ho_neighbor_config_5() ); |
| 4576 | execute( TC_ho_neighbor_config_6() ); |
| 4577 | execute( TC_ho_neighbor_config_7() ); |
| 4578 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4579 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4580 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4581 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4582 | |
| 4583 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 4584 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 4585 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 4586 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 4587 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4588 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4589 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4590 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 4591 | /* Power control related */ |
| 4592 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 4593 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 4594 | execute( TC_early_conn_fail() ); |
| 4595 | execute( TC_late_conn_fail() ); |
| 4596 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 4597 | } |
| 4598 | |
| 4599 | } |