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