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