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 | * |
| 10 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 11 | * well as the MSC. See README for more details. |
| 12 | * |
| 13 | * There are test cases that run in so-called 'handler mode' and test cases |
| 14 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 15 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 16 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 17 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 18 | * level testing. |
| 19 | */ |
| 20 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 21 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 22 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 23 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 24 | import from IPL4asp_Types all; |
| 25 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 26 | import from BSSAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 27 | import from BSSAP_Adapter all; |
| 28 | import from BSSAP_CodecPort all; |
| 29 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 30 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 31 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 32 | import from IPA_Types all; |
| 33 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 34 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 35 | import from MGCP_Emulation all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 36 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 37 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 38 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 39 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 40 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 41 | import from Osmocom_VTY_Functions all; |
| 42 | import from TELNETasp_PortType all; |
| 43 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 44 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 45 | import from MobileL3_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 46 | import from L3_Templates all; |
| 47 | import from GSM_RR_Types all; |
| 48 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 49 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 50 | import from BSSMAP_Templates all; |
| 51 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 52 | const integer NUM_BTS := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 53 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 54 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 55 | /* 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] | 56 | const integer NUM_TCHH_PER_BTS := 2; |
| 57 | const integer NUM_TCHF_PER_BTS := 4; |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 58 | const integer NUM_SDCCH_PER_BTS := 4; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 59 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 60 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 61 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 62 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 63 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 64 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 65 | } |
| 66 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 67 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 68 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 69 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 70 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 71 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 72 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 73 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 74 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 75 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 76 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 77 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 78 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 79 | var BSSAP_Adapter g_bssap; |
| 80 | /* for old legacy-tests only */ |
| 81 | port BSSAP_CODEC_PT BSSAP; |
| 82 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 83 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 84 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 85 | |
| 86 | /* global test case guard timer */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 87 | timer T_guard := 30.0; |
| 88 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 92 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 93 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 94 | /* port number to which to establish the IPA OML connections */ |
| 95 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 96 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 97 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 98 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 99 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 100 | /* IP address at which the test binds */ |
| 101 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 102 | |
| 103 | BSSAP_Configuration mp_bssap_cfg := { |
Harald Welte | 7ef51aa | 2018-04-16 19:16:01 +0200 | [diff] [blame] | 104 | transport := BSSAP_TRANSPORT_AoIP, |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 105 | sccp_service_type := "mtp3_itu", |
| 106 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 107 | own_pc := 185, |
| 108 | own_ssn := 254, |
| 109 | peer_pc := 187, |
| 110 | peer_ssn := 254, |
Philipp Maier | 38d6894 | 2018-03-29 15:38:09 +0200 | [diff] [blame] | 111 | sio := '83'O, |
| 112 | rctx := 0 |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 113 | }; |
| 114 | } |
| 115 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 116 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 117 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 118 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 119 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 120 | } |
| 121 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 122 | private function f_legacy_bssap_reset() runs on test_CT { |
| 123 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 124 | timer T := 5.0; |
| 125 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 126 | T.start; |
| 127 | alt { |
| 128 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { |
| 129 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 130 | } |
| 131 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 132 | log("Respoding to inbound RESET with RESET-ACK"); |
| 133 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 134 | ts_BSSMAP_ResetAck)); |
| 135 | repeat; |
| 136 | } |
| 137 | [] BSSAP.receive { repeat; } |
| 138 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 139 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 140 | } |
| 141 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 142 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 143 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 144 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 145 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 146 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 147 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 148 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 149 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 150 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 151 | } |
| 152 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 153 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 154 | * \param clnt IPA_Client for which to establish |
| 155 | * \param bsc_host IP address / hostname of the BSC |
| 156 | * \param bsc_port TCP port number of the BSC |
| 157 | * \param i number identifying this BTS |
| 158 | * \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] | 159 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 160 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 161 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 162 | timer T := 10.0; |
| 163 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 164 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 165 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 166 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 167 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 168 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 169 | if (handler_mode) { |
| 170 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 171 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 172 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 173 | |
| 174 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 175 | if (handler_mode) { |
| 176 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 177 | } else { |
| 178 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 179 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 180 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 181 | 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] | 182 | if (handler_mode) { |
| 183 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 184 | return; |
| 185 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 186 | |
| 187 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 188 | T.start; |
| 189 | alt { |
| 190 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 191 | T.stop; |
| 192 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 193 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 194 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 195 | [] IPA_RSL[i].receive { repeat } |
| 196 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 197 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 198 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 203 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 204 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 205 | return; |
| 206 | } |
| 207 | clnt.vc_IPA.stop; |
| 208 | if (isbound(clnt.vc_RSL)) { |
| 209 | clnt.vc_RSL.stop; |
| 210 | } |
| 211 | } |
| 212 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 213 | /* 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] | 214 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 215 | timer T := secs_max; |
| 216 | T.start; |
| 217 | while (true) { |
| 218 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 219 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 220 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 221 | * until all MO's are initialized */ |
| 222 | T.start(1.0); |
| 223 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 224 | return; |
| 225 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 226 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 227 | if (not T.running) { |
| 228 | setverdict(fail, "Timeout waiting for oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 229 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 234 | /* 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] | 235 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 236 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 237 | [] T_guard.timeout { |
| 238 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 239 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 240 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 241 | /* always respond with RESET ACK to RESET */ |
| 242 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 243 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 244 | ts_BSSMAP_ResetAck)); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 245 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 246 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 247 | } |
| 248 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 249 | altstep no_bssmap_reset() runs on test_CT { |
| 250 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { |
| 251 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 252 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 256 | function f_init_mgcp(charstring id) runs on test_CT { |
| 257 | id := id & "-MGCP"; |
| 258 | |
| 259 | var MGCPOps ops := { |
| 260 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 261 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 262 | }; |
| 263 | var MGCP_conn_parameters mgcp_pars := { |
| 264 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 265 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 266 | mgw_ip := mp_test_ip, |
| 267 | mgw_udp_port := 2427 |
| 268 | }; |
| 269 | |
| 270 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 271 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 272 | } |
| 273 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 274 | private function f_init_vty(charstring id := "foo") runs on test_CT { |
| 275 | if (BSCVTY.checkstate("Mapped")) { |
| 276 | /* skip initialization if already executed once */ |
| 277 | return; |
| 278 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 279 | map(self:BSCVTY, system:BSCVTY); |
| 280 | f_vty_set_prompts(BSCVTY); |
| 281 | f_vty_transceive(BSCVTY, "enable"); |
| 282 | } |
| 283 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 284 | /* global initialization function |
| 285 | * \param nr_bts Number of BTSs we should start/bring up |
| 286 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 287 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs on test_CT { |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 288 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 289 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 290 | if (g_initialized) { |
| 291 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 292 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 293 | g_initialized := true; |
| 294 | |
| 295 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 296 | * MSC-side BSSAP emulation */ |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 297 | if (handler_mode) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 298 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps); |
Harald Welte | 4bcbd17 | 2018-05-27 19:47:44 +0200 | [diff] [blame] | 299 | f_bssap_start(g_bssap); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 300 | } else { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 301 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
| 302 | connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT); |
Harald Welte | 4bcbd17 | 2018-05-27 19:47:44 +0200 | [diff] [blame] | 303 | f_bssap_start(g_bssap); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 304 | f_legacy_bssap_reset(); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 305 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 306 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 307 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 308 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 309 | f_init_mgcp("VirtMSC"); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 310 | f_init_vty("VirtMSC"); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 311 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 312 | for (i := 0; i < nr_bts; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 313 | /* wait until osmo-bts-omldummy has respawned */ |
| 314 | f_wait_oml(i, "degraded", 5.0); |
| 315 | /* start RSL connection */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 316 | 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] | 317 | /* wait until BSC tells us "connected" */ |
| 318 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 319 | } |
| 320 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 321 | T_guard.start; |
| 322 | activate(as_Tguard()); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 323 | } |
| 324 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 325 | /* expect to receive a RSL message matching a specified templaten on a given BTS / stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 326 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 327 | runs on test_CT return RSL_Message { |
| 328 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 329 | timer T := t_secs; |
| 330 | |
| 331 | T.start; |
| 332 | alt { |
| 333 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 334 | T.stop; |
| 335 | } |
| 336 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 337 | [] T.timeout { |
| 338 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 339 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 340 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 341 | } |
| 342 | return rx_rsl_ud.rsl; |
| 343 | } |
| 344 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 345 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 346 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 347 | runs on test_CT { |
| 348 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 349 | } |
| 350 | |
| 351 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 352 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 353 | testcase TC_chan_act_noreply() runs on test_CT { |
| 354 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 355 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 356 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 357 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 358 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 359 | 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] | 360 | 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] | 361 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 362 | } |
| 363 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 364 | /* verify if the "chreq:total" counter increments as expected */ |
| 365 | testcase TC_chan_act_counter() runs on test_CT { |
| 366 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 367 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 368 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 369 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 370 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 371 | |
| 372 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 373 | 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] | 374 | 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] | 375 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 376 | |
| 377 | setverdict(pass); |
| 378 | } |
| 379 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 380 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 381 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 382 | var RSL_Message rx_rsl; |
| 383 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 384 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 385 | |
| 386 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 387 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 388 | |
| 389 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 390 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 391 | |
| 392 | setverdict(pass); |
| 393 | } |
| 394 | |
| 395 | /* Test behavior if MSC never answers to CR */ |
| 396 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 397 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 398 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 399 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 400 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 401 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 402 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 403 | |
| 404 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 405 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 406 | |
| 407 | var octetstring l3 := '00010203040506'O |
| 408 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 409 | |
| 410 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 411 | |
| 412 | /* 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] | 413 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
| 414 | IPA_RSL[0].clear; |
| 415 | alt { |
| 416 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { } |
| 417 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) -> value rx_rsl_ud { |
| 418 | f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch)); |
| 419 | repeat; |
| 420 | } |
| 421 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 422 | |
| 423 | setverdict(pass); |
| 424 | } |
| 425 | |
| 426 | /* Test behavior if MSC answers with CREF to CR */ |
| 427 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 428 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 429 | var RSL_Message rx_rsl; |
| 430 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 431 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 432 | |
| 433 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 434 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 435 | |
| 436 | var octetstring l3 := '00010203040506'O |
| 437 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 438 | |
| 439 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 440 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 441 | |
| 442 | /* expect BSC to disable the channel */ |
Harald Welte | 725844b | 2018-01-28 16:18:32 +0100 | [diff] [blame] | 443 | f_expect_chan_rel(0, chan_nr); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 444 | setverdict(pass); |
| 445 | } |
| 446 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 447 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 448 | testcase TC_chan_act_nack() runs on test_CT { |
| 449 | var RSL_Message rx_rsl; |
| 450 | var integer chact_nack; |
| 451 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 452 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 453 | |
| 454 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 455 | |
| 456 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 457 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 458 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 459 | |
| 460 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 461 | |
| 462 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 463 | f_sleep(0.5); |
| 464 | |
| 465 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 466 | |
| 467 | setverdict(pass); |
| 468 | } |
| 469 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 470 | /* Test for channel exhaustion due to RACH overload */ |
| 471 | testcase TC_chan_exhaustion() runs on test_CT { |
| 472 | var ASP_RSL_Unitdata rsl_ud; |
| 473 | var integer i; |
| 474 | var integer chreq_total, chreq_nochan; |
| 475 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 476 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 477 | |
| 478 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 479 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 480 | |
| 481 | /* expect 5xTCH/F to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 482 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 483 | var RslChannelNr chan_nr := f_chreq_act_ack('23'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | IPA_RSL[0].clear; |
| 487 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 488 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 489 | 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] | 490 | |
| 491 | /* now expect additional channel activations to fail */ |
| 492 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 493 | |
| 494 | alt { |
| 495 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 496 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 497 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 498 | } |
| 499 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 500 | var GsmRrMessage rr; |
| 501 | /* match on IMM ASS REJ */ |
| 502 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 503 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 504 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 505 | 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] | 506 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 507 | chreq_nochan+1); |
| 508 | setverdict(pass); |
| 509 | } else { |
| 510 | repeat; |
| 511 | } |
| 512 | } |
| 513 | [] IPA_RSL[0].receive { repeat; } |
| 514 | } |
| 515 | } |
| 516 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 517 | /*********************************************************************** |
| 518 | * Assignment Testing |
| 519 | ***********************************************************************/ |
| 520 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 521 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 522 | * except for the inter-BSC handover, MT side) */ |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 523 | testcase TC_outbound_connect() runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 524 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 525 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 526 | 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] | 527 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 528 | setverdict(pass); |
| 529 | } |
| 530 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 531 | /* Test behavior if MSC answers with CREF to CR */ |
| 532 | testcase TC_assignment_cic_only() runs on test_CT { |
| 533 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 534 | var RSL_Message rx_rsl; |
| 535 | var DchanTuple dt; |
| 536 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 537 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 538 | |
| 539 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 540 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 541 | /* send assignment without AoIP IEs */ |
| 542 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 543 | } else { |
| 544 | /* Send assignmetn without CIC in IPA case */ |
| 545 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 546 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 547 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 548 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 549 | alt { |
| 550 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 551 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 552 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 553 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 554 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 555 | setverdict(pass); |
| 556 | } |
| 557 | [] BSSAP.receive { repeat; } |
| 558 | } |
| 559 | } |
| 560 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 561 | /* generate an assignment request for either AoIP or SCCPlite */ |
Harald Welte | e102eae | 2018-05-31 21:03:47 +0200 | [diff] [blame] | 562 | function f_gen_ass_req() return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 563 | var PDU_BSSAP ass_cmd; |
| 564 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 565 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 566 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 567 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 568 | } else { |
| 569 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 570 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
| 571 | } |
| 572 | return ass_cmd; |
| 573 | } |
| 574 | |
| 575 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Harald Welte | e102eae | 2018-05-31 21:03:47 +0200 | [diff] [blame] | 576 | function f_gen_exp_compl() return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 577 | var template PDU_BSSAP exp_compl; |
| 578 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 579 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 580 | } else { |
| 581 | /* CIC is optional "*" as the MSC allocated it */ |
| 582 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
| 583 | } |
| 584 | return exp_compl; |
| 585 | } |
| 586 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 587 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 588 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 589 | runs on test_CT { |
| 590 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 591 | var RSL_Message rx_rsl; |
| 592 | var DchanTuple dt; |
| 593 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 594 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 595 | |
| 596 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 597 | /* send assignment without AoIP IEs */ |
| 598 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 599 | alt { |
| 600 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 601 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 602 | setverdict(pass); |
| 603 | } else { |
| 604 | setverdict(fail, fail_text); |
| 605 | } |
| 606 | } |
| 607 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 608 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 609 | setverdict(pass); |
| 610 | } else { |
| 611 | setverdict(fail, fail_text); |
| 612 | } |
| 613 | } |
| 614 | [] BSSAP.receive { repeat; } |
| 615 | } |
| 616 | } |
| 617 | testcase TC_assignment_csd() runs on test_CT { |
| 618 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 619 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 620 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 621 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 622 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 623 | } |
| 624 | |
| 625 | testcase TC_assignment_ctm() runs on test_CT { |
| 626 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 627 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 628 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 629 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 630 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 631 | } |
| 632 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 633 | type record DchanTuple { |
| 634 | integer sccp_conn_id, |
| 635 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 636 | } |
| 637 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 638 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 639 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 640 | runs on test_CT return RslChannelNr { |
| 641 | var RSL_Message rx_rsl; |
| 642 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 643 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 644 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 645 | 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] | 646 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 647 | return chan_nr; |
| 648 | } |
| 649 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 650 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 651 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 652 | runs on test_CT return DchanTuple { |
| 653 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 654 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 655 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 656 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 657 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 658 | |
| 659 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 660 | |
| 661 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 662 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 663 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 664 | |
| 665 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 666 | } |
| 667 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 668 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 669 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 670 | var RSL_Message rx_rsl; |
| 671 | /* expect BSC to disable the channel */ |
| 672 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 673 | /* respond with CHAN REL ACK */ |
| 674 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 675 | |
| 676 | /* expect Clear Complete from BSC */ |
| 677 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 678 | |
| 679 | /* MSC disconnects as instructed. */ |
| 680 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 681 | } |
| 682 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 683 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 684 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 685 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 686 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 687 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 688 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 689 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 690 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 691 | |
| 692 | /* simulate RLL REL IND */ |
| 693 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 694 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 695 | /* expect Clear Request on MSC side */ |
| 696 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 697 | |
| 698 | /* Instruct BSC to clear channel */ |
| 699 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 700 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 701 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 702 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 703 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 704 | |
| 705 | /* wait for SCCP emulation to do its job */ |
| 706 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 707 | |
| 708 | setverdict(pass); |
| 709 | } |
| 710 | |
| 711 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 712 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 713 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 714 | var DchanTuple dt; |
| 715 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 716 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 717 | |
| 718 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 719 | |
| 720 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 721 | 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] | 722 | /* TODO: different cause values? */ |
| 723 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 724 | /* expect Clear Request from BSC */ |
| 725 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 726 | |
| 727 | /* Instruct BSC to clear channel */ |
| 728 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 729 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 730 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 731 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 732 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 733 | |
| 734 | /* wait for SCCP emulation to do its job */ |
| 735 | f_sleep(1.0); |
| 736 | |
| 737 | setverdict(pass); |
| 738 | } |
| 739 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 740 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 741 | /* See also https://www.osmocom.org/issues/3182 */ |
| 742 | testcase TC_early_conn_fail() runs on test_CT { |
| 743 | var RSL_Message rx_rsl; |
| 744 | var DchanTuple dt; |
| 745 | |
| 746 | f_init(1); |
| 747 | |
| 748 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
| 749 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23); |
| 750 | |
| 751 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 752 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 753 | |
| 754 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 755 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 756 | |
| 757 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 758 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 759 | |
| 760 | setverdict(pass); |
| 761 | } |
| 762 | |
| 763 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 764 | /* See also https://www.osmocom.org/issues/3182 */ |
| 765 | testcase TC_late_conn_fail() runs on test_CT { |
| 766 | var RSL_Message rx_rsl; |
| 767 | var DchanTuple dt; |
| 768 | |
| 769 | f_init(1); |
| 770 | |
| 771 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 772 | |
| 773 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 774 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 775 | |
| 776 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 777 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 778 | |
| 779 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 780 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 781 | |
| 782 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 783 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 784 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 785 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 786 | |
| 787 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 788 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 789 | |
| 790 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 791 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 792 | |
| 793 | setverdict(pass); |
| 794 | } |
| 795 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 796 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean flush := true, |
| 797 | boolean handle_rll_rel := true) runs on test_CT { |
| 798 | |
| 799 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 800 | if (flush) { |
| 801 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 802 | IPA_RSL[bts_nr].clear; |
| 803 | } |
| 804 | alt { |
| 805 | /* ignore DEACTIVATE SACCH (if any) */ |
| 806 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 807 | tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
| 808 | repeat; |
| 809 | } |
| 810 | /* acknowledge RLL release (if any)*/ |
| 811 | [handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 812 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
| 813 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 814 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 815 | repeat; |
| 816 | } |
Neels Hofmeyr | 92d4842 | 2018-06-14 04:05:07 +0200 | [diff] [blame] | 817 | [not handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 818 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
| 819 | /* Do not reply, just continue */ |
| 820 | repeat; |
| 821 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 822 | /* Expect RF channel release from BSC on Abis */ |
| 823 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 824 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 825 | /* respond with CHAN REL ACK */ |
| 826 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 827 | } |
| 828 | /* ignore any user data */ |
| 829 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 830 | repeat; |
| 831 | } |
| 832 | } |
| 833 | } |
| 834 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 835 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 836 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 837 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 838 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 839 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 840 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 841 | |
| 842 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 843 | |
| 844 | /* Instruct BSC to clear channel */ |
| 845 | var BssmapCause cause := 0; |
| 846 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 847 | |
| 848 | /* expect Clear Complete from BSC on A */ |
| 849 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 850 | /* release the SCCP connection */ |
| 851 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 852 | } |
| 853 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 854 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 855 | setverdict(pass); |
| 856 | } |
| 857 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 858 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 859 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 860 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 861 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 862 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 863 | |
| 864 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 865 | |
| 866 | /* release the SCCP connection */ |
| 867 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 868 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 869 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 870 | setverdict(pass); |
| 871 | } |
| 872 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 873 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 874 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 875 | var DchanTuple dt; |
| 876 | |
| 877 | f_init(1); |
| 878 | |
| 879 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 880 | |
| 881 | /* release the SCCP connection */ |
| 882 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 883 | |
| 884 | f_expect_chan_rel(0, dt.rsl_chan_nr, true, false); |
| 885 | setverdict(pass); |
| 886 | } |
| 887 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 888 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 889 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 890 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 891 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 892 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 893 | |
| 894 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 895 | |
| 896 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 897 | IPA_RSL[0].clear; |
| 898 | |
| 899 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 900 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 901 | interleave { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 902 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 903 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 904 | } |
| 905 | |
Philipp Maier | e8f38ed | 2018-02-09 10:30:31 +0100 | [diff] [blame] | 906 | f_expect_chan_rel(0, dt.rsl_chan_nr, false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 907 | setverdict(pass); |
| 908 | } |
| 909 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 910 | /* Test behavior if RSL EST IND for non-active channel */ |
| 911 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 912 | timer T := 2.0; |
| 913 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 914 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 915 | |
| 916 | var octetstring l3 := '00010203040506'O; |
| 917 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 918 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 919 | |
| 920 | T.start; |
| 921 | alt { |
| 922 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 923 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 924 | } |
| 925 | [] BSSAP.receive {} |
| 926 | [] IPA_RSL[0].receive {} |
| 927 | [] T.timeout {} |
| 928 | } |
| 929 | |
| 930 | setverdict(pass); |
| 931 | } |
| 932 | |
| 933 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 934 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 935 | var RslChannelNr chan_nr; |
| 936 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 937 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 938 | |
| 939 | chan_nr := f_chreq_act_ack() |
| 940 | |
| 941 | var octetstring l3 := '00010203040506'O; |
| 942 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 943 | |
| 944 | timer T := 2.0; |
| 945 | T.start; |
| 946 | alt { |
| 947 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 948 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 949 | } |
| 950 | [] BSSAP.receive { repeat; } |
| 951 | [] IPA_RSL[0].receive { repeat; } |
| 952 | [] T.timeout {} |
| 953 | } |
| 954 | |
| 955 | setverdict(pass); |
| 956 | } |
| 957 | |
| 958 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 959 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 960 | timer T := 2.0; |
| 961 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 962 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 963 | |
| 964 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 965 | |
| 966 | var octetstring l3 := '00010203040506'O; |
| 967 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 968 | |
| 969 | T.start; |
| 970 | alt { |
| 971 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 972 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 973 | } |
| 974 | [] BSSAP.receive { repeat; } |
| 975 | [] IPA_RSL[0].receive { repeat; } |
| 976 | [] T.timeout {} |
| 977 | } |
| 978 | |
| 979 | setverdict(pass); |
| 980 | } |
| 981 | |
| 982 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 983 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 984 | timer T := 2.0; |
| 985 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 986 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 987 | |
| 988 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 989 | |
| 990 | var octetstring l3 := '00010203040506'O; |
| 991 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 992 | |
| 993 | T.start; |
| 994 | alt { |
| 995 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 996 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 997 | } |
| 998 | [] BSSAP.receive { repeat; } |
| 999 | [] IPA_RSL[0].receive { repeat; } |
| 1000 | [] T.timeout {} |
| 1001 | } |
| 1002 | |
| 1003 | setverdict(pass); |
| 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1008 | |
| 1009 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 1010 | var charstring ctrl_resp; |
| 1011 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1012 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1013 | |
| 1014 | /* See https://osmocom.org/issues/2729 */ |
| 1015 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 1016 | setverdict(pass); |
| 1017 | } |
| 1018 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1019 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 1020 | var charstring ctrl_resp; |
| 1021 | |
| 1022 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1023 | |
| 1024 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 1025 | setverdict(pass); |
| 1026 | } |
| 1027 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1028 | testcase TC_ctrl() runs on test_CT { |
| 1029 | var charstring ctrl_resp; |
| 1030 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1031 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1032 | |
| 1033 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 1034 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 1035 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 1036 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Harald Welte | 44bdaa5 | 2017-12-17 17:01:47 +0100 | [diff] [blame] | 1037 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1038 | |
| 1039 | var integer bts_nr := 0; |
| 1040 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 1041 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 1042 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 1043 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 1044 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 1045 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 1046 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 1047 | |
| 1048 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 1049 | f_sleep(2.0); |
| 1050 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 1051 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 1052 | } |
| 1053 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 1054 | |
| 1055 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 1056 | |
| 1057 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1058 | } |
| 1059 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1060 | 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] | 1061 | 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] | 1062 | } |
| 1063 | |
| 1064 | |
| 1065 | /*********************************************************************** |
| 1066 | * Paging Testing |
| 1067 | ***********************************************************************/ |
| 1068 | |
| 1069 | type record Cell_Identity { |
| 1070 | GsmMcc mcc, |
| 1071 | GsmMnc mnc, |
| 1072 | GsmLac lac, |
| 1073 | GsmCellId ci |
| 1074 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 1075 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1076 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1077 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1078 | type set of integer BtsIdList; |
| 1079 | |
| 1080 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 1081 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 1082 | if (bts_id == bts_ids[j]) { |
| 1083 | return true; |
| 1084 | } |
| 1085 | } |
| 1086 | return false; |
| 1087 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1088 | |
| 1089 | /* core paging test helper function; used by most paging test cases */ |
| 1090 | private function f_pageing_helper(hexstring imsi, |
| 1091 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1092 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1093 | template RSL_ChanNeeded rsl_chneed := omit, |
| 1094 | template OCT4 tmsi := omit) runs on test_CT |
| 1095 | { |
| 1096 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 1097 | var MobileIdentity mi; |
| 1098 | var template octetstring id_enc; /* FIXME */ |
| 1099 | var RSL_Message rx_rsl; |
| 1100 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1101 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1102 | |
| 1103 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1104 | |
| 1105 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 1106 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1107 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1108 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1109 | |
| 1110 | if (isvalue(rsl_chneed)) { |
| 1111 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 1112 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 1113 | } else { |
| 1114 | bssmap_chneed := omit; |
| 1115 | } |
| 1116 | |
| 1117 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 1118 | |
| 1119 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
| 1120 | if (isvalue(tmsi)) { |
| 1121 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 1122 | } else { |
| 1123 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 1124 | } |
| 1125 | id_enc := enc_MobileIdentity(mi); |
| 1126 | */ |
| 1127 | id_enc := ?; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1128 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 1129 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc)); |
| 1130 | /* check channel type, paging group */ |
| 1131 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 1132 | setverdict(fail, "Paging for wrong paging group"); |
| 1133 | } |
| 1134 | if (ispresent(rsl_chneed) and |
| 1135 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 1136 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 1137 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1138 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 1139 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1140 | /* do a quick check on all not-included BTSs if they received paging */ |
| 1141 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1142 | timer T := 0.1; |
| 1143 | if (f_bts_in_list(i, bts_ids)) { |
| 1144 | continue; |
| 1145 | } |
| 1146 | T.start; |
| 1147 | alt { |
| 1148 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) { |
| 1149 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 1150 | } |
| 1151 | [] IPA_RSL[i].receive { repeat; } |
| 1152 | [] T.timeout { } |
| 1153 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1154 | } |
| 1155 | |
| 1156 | setverdict(pass); |
| 1157 | } |
| 1158 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1159 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1160 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1161 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 1162 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 1163 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1164 | /* PAGING by IMSI + TMSI */ |
| 1165 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 1166 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1167 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 1168 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1169 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1170 | } |
| 1171 | |
| 1172 | /* PAGING by IMSI + TMSI */ |
| 1173 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 1174 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1175 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1176 | 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] | 1177 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1178 | } |
| 1179 | |
| 1180 | /* Paging with different "channel needed' values */ |
| 1181 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 1182 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1183 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1184 | 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] | 1185 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1186 | } |
| 1187 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 1188 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1189 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1190 | 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] | 1191 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1192 | } |
| 1193 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 1194 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1195 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1196 | 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] | 1197 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1198 | } |
| 1199 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 1200 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1201 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1202 | 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] | 1203 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1204 | } |
| 1205 | |
| 1206 | /* Paging by CGI */ |
| 1207 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 1208 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1209 | 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] | 1210 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1211 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1212 | } |
| 1213 | |
| 1214 | /* Paging by LAC+CI */ |
| 1215 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 1216 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1217 | 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] | 1218 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1219 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1220 | } |
| 1221 | |
| 1222 | /* Paging by CI */ |
| 1223 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 1224 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1225 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1226 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1227 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1228 | } |
| 1229 | |
| 1230 | /* Paging by LAI */ |
| 1231 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 1232 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1233 | 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] | 1234 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1235 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | /* Paging by LAC */ |
| 1239 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 1240 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1241 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1242 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1243 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1244 | } |
| 1245 | |
| 1246 | /* Paging by "all in BSS" */ |
| 1247 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 1248 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1249 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1250 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1251 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1252 | } |
| 1253 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1254 | /* 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] | 1255 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 1256 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1257 | 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] | 1258 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1259 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1260 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1261 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1262 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1263 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 1264 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1265 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1266 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1267 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1268 | } |
| 1269 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1270 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1271 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 1272 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1273 | 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] | 1274 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1275 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1276 | } |
| 1277 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1278 | /* 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] | 1279 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 1280 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1281 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 1282 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1283 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | /* Paging on empty list: Verify none of them page */ |
| 1287 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 1288 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1289 | cid_list := { cIl_LAC := { } }; |
| 1290 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1291 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1292 | } |
| 1293 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1294 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 1295 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 1296 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1297 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 1298 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 1299 | f_shutdown_helper(); |
| 1300 | } |
| 1301 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1302 | /* Verify paging retransmission interval + count */ |
| 1303 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1304 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1305 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1306 | /* Verify PCH load */ |
| 1307 | testcase TC_paging_imsi_load() runs on test_CT { |
| 1308 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1309 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1310 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1311 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1312 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1313 | |
| 1314 | /* tell BSC there is no paging space anymore */ |
| 1315 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 1316 | f_sleep(0.2); |
| 1317 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1318 | |
| 1319 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 1320 | * there would be 8 retransmissions during 4 seconds */ |
| 1321 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1322 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1323 | alt { |
| 1324 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1325 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1326 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1327 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1328 | [] T_retrans.timeout { |
| 1329 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 1330 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 1331 | T_retrans.start; |
| 1332 | repeat; |
| 1333 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1334 | [] T.timeout { |
| 1335 | setverdict(pass); |
| 1336 | } |
| 1337 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1338 | |
| 1339 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1340 | } |
| 1341 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1342 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1343 | testcase TC_paging_counter() runs on test_CT { |
| 1344 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1345 | timer T := 4.0; |
| 1346 | var integer i; |
| 1347 | var integer paging_attempted_bsc; |
| 1348 | var integer paging_attempted_bts[NUM_BTS]; |
| 1349 | var integer paging_expired_bts[NUM_BTS]; |
| 1350 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 1351 | |
| 1352 | f_init(); |
| 1353 | |
| 1354 | /* read counters before paging */ |
| 1355 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 1356 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1357 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 1358 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 1359 | } |
| 1360 | |
| 1361 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 1362 | |
| 1363 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1364 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1365 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1366 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1367 | paging_attempted_bts[i]+1); |
| 1368 | } |
| 1369 | |
| 1370 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1371 | f_sleep(12.0); |
| 1372 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1373 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1374 | paging_expired_bts[i]+1); |
| 1375 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1376 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1377 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1381 | /* Verify paging stops after A-RESET */ |
| 1382 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1383 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1384 | timer T := 3.0; |
| 1385 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1386 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1387 | |
| 1388 | /* Perform a BSSMAP Reset and wait for ACK */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1389 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1390 | alt { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1391 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1392 | [] BSSAP.receive { repeat; } |
| 1393 | } |
| 1394 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 1395 | /* Wait to avoid a possible race condition if a paging message is |
| 1396 | * received right before the reset ACK. */ |
| 1397 | f_sleep(0.2); |
| 1398 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1399 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 1400 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 1401 | IPA_RSL[i].clear; |
| 1402 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1403 | |
| 1404 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1405 | T.start; |
| 1406 | alt { |
| 1407 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1408 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1409 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1410 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1411 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1412 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1413 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1414 | } |
| 1415 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1416 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1417 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1418 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1419 | [] T.timeout { |
| 1420 | setverdict(pass); |
| 1421 | } |
| 1422 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1423 | |
| 1424 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1425 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1426 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1427 | /* Test RSL link drop causes counter increment */ |
| 1428 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1429 | var integer rsl_fail; |
| 1430 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1431 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1432 | |
| 1433 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1434 | |
| 1435 | bts[0].rsl.vc_IPA.stop; |
| 1436 | |
| 1437 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1438 | |
| 1439 | setverdict(pass); |
| 1440 | } |
| 1441 | |
| 1442 | /* TODO: Test OML link drop causes counter increment */ |
| 1443 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1444 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 1445 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 1446 | timer T := 10.0; |
| 1447 | |
| 1448 | bts[0].rsl.id := "IPA-0-RSL"; |
| 1449 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 1450 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 1451 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 1452 | bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at BTS */ |
| 1453 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1454 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 1455 | |
| 1456 | f_init_mgcp("VirtMSC"); |
| 1457 | |
| 1458 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 1459 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 1460 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 1461 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 1462 | |
| 1463 | /* wait for IPA OML link to connect and then disconnect */ |
| 1464 | T.start; |
| 1465 | alt { |
| 1466 | [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) { |
| 1467 | T.stop; |
| 1468 | return true; |
| 1469 | } |
| 1470 | [] IPA_RSL[0].receive { repeat } |
| 1471 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1472 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1473 | } |
| 1474 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1475 | return false; |
| 1476 | } |
| 1477 | |
| 1478 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1479 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 1480 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 1481 | setverdict(pass); |
| 1482 | } else { |
| 1483 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | |
| 1488 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1489 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 1490 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 1491 | setverdict(pass); |
| 1492 | } else { |
| 1493 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1498 | /*********************************************************************** |
| 1499 | * "New world" test cases using RSL_Emulation + BSSMAP_Emulation |
| 1500 | ***********************************************************************/ |
| 1501 | |
| 1502 | import from BSSMAP_Emulation all; |
| 1503 | import from RSL_Emulation all; |
| 1504 | import from MSC_ConnectionHandler all; |
| 1505 | |
| 1506 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 1507 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1508 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 1509 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1510 | connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1511 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1512 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 1513 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 1514 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 1515 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 1516 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 1517 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1518 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1519 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1520 | } |
| 1521 | |
| 1522 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 1523 | runs on test_CT return MSC_ConnHdlr { |
| 1524 | var charstring id := testcasename(); |
| 1525 | var MSC_ConnHdlr vc_conn; |
| 1526 | vc_conn := MSC_ConnHdlr.create(id); |
| 1527 | f_connect_handler(vc_conn); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1528 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1529 | return vc_conn; |
| 1530 | } |
| 1531 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1532 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 1533 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 1534 | runs on MSC_ConnHdlr { |
| 1535 | if (isvalue(pars)) { |
| 1536 | g_pars := valueof(pars); |
| 1537 | } |
| 1538 | fn.apply(id); |
| 1539 | } |
| 1540 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1541 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 1542 | 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] | 1543 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1544 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1545 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1546 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 1547 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 1548 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 1549 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1550 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1551 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1552 | } |
| 1553 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 1554 | var MSC_ConnHdlr vc_conn; |
| 1555 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1556 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 1557 | |
| 1558 | f_init(1, true); |
| 1559 | f_sleep(1.0); |
| 1560 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1561 | vc_conn.done; |
| 1562 | } |
| 1563 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 1564 | var MSC_ConnHdlr vc_conn; |
| 1565 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1566 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 1567 | |
| 1568 | f_init(1, true); |
| 1569 | f_sleep(1.0); |
| 1570 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1571 | vc_conn.done; |
| 1572 | } |
| 1573 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 1574 | var MSC_ConnHdlr vc_conn; |
| 1575 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1576 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 1577 | |
| 1578 | f_init(1, true); |
| 1579 | f_sleep(1.0); |
| 1580 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1581 | vc_conn.done; |
| 1582 | } |
| 1583 | |
| 1584 | |
| 1585 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1586 | 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] | 1587 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1588 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1589 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1590 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1591 | 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] | 1592 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1593 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1594 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1595 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 1596 | var MSC_ConnHdlr vc_conn; |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1597 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1598 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1599 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1600 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1601 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1602 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1603 | vc_conn.done; |
| 1604 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1605 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1606 | var MSC_ConnHdlr vc_conn; |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1607 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1608 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1609 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1610 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1611 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1612 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 1613 | vc_conn.done; |
| 1614 | } |
| 1615 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 1616 | var MSC_ConnHdlr vc_conn; |
| 1617 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1618 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1619 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1620 | f_init(1, true); |
| 1621 | f_sleep(1.0); |
| 1622 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1623 | vc_conn.done; |
| 1624 | } |
| 1625 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1626 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 1627 | private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1628 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1629 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1630 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1631 | const OCT8 kc := '0001020304050607'O; |
| 1632 | |
| 1633 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1634 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 1635 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1636 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1637 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1638 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 1639 | var MSC_ConnHdlr vc_conn; |
| 1640 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1641 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1642 | f_sleep(1.0); |
| 1643 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1644 | 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] | 1645 | vc_conn.done; |
| 1646 | } |
| 1647 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1648 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1649 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1650 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1651 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1652 | const OCT8 kc := '0001020304050607'O; |
| 1653 | const OCT16 kc128 := kc & kc; |
| 1654 | |
| 1655 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1656 | 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] | 1657 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1658 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1659 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1660 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1661 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 1662 | var MSC_ConnHdlr vc_conn; |
| 1663 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1664 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1665 | f_sleep(1.0); |
| 1666 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1667 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1668 | vc_conn.done; |
| 1669 | } |
| 1670 | |
| 1671 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1672 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 6a50c7c | 2018-04-16 16:15:59 +0200 | [diff] [blame] | 1673 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1674 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
| 1675 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, omit)); |
| 1676 | |
| 1677 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1678 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1679 | } |
| 1680 | |
| 1681 | testcase TC_assignment_sign() runs on test_CT { |
| 1682 | var MSC_ConnHdlr vc_conn; |
| 1683 | |
| 1684 | f_init(1, true); |
| 1685 | f_sleep(1.0); |
| 1686 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1687 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1688 | vc_conn.done; |
| 1689 | } |
| 1690 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1691 | /*********************************************************************** |
| 1692 | * Codec (list) testing |
| 1693 | ***********************************************************************/ |
| 1694 | |
| 1695 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 1696 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 1697 | return boolean { |
| 1698 | select (a_elem.codecType) { |
| 1699 | case (GSM_FR) { |
| 1700 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 1701 | return true; |
| 1702 | } |
| 1703 | } |
| 1704 | case (GSM_HR) { |
| 1705 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 1706 | return true; |
| 1707 | } |
| 1708 | } |
| 1709 | case (GSM_EFR) { |
| 1710 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 1711 | return true; |
| 1712 | } |
| 1713 | } |
| 1714 | case (FR_AMR) { |
| 1715 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 1716 | return true; |
| 1717 | } |
| 1718 | } |
| 1719 | case (HR_AMR) { |
| 1720 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 1721 | return true; |
| 1722 | } |
| 1723 | } |
| 1724 | case else { } |
| 1725 | } |
| 1726 | return false; |
| 1727 | } |
| 1728 | |
| 1729 | /* check if the given rsl_mode is compatible with the a_list */ |
| 1730 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 1731 | return boolean { |
| 1732 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 1733 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 1734 | return true; |
| 1735 | } |
| 1736 | } |
| 1737 | return false; |
| 1738 | } |
| 1739 | |
| 1740 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 1741 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1742 | return BSSMAP_IE_ChannelType { |
| 1743 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 1744 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 1745 | select (a_elem.codecType) { |
| 1746 | case (GSM_FR) { |
| 1747 | ret.channelRateAndType := ChRate_TCHF; |
| 1748 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 1749 | } |
| 1750 | case (GSM_HR) { |
| 1751 | ret.channelRateAndType := ChRate_TCHH; |
| 1752 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 1753 | } |
| 1754 | case (GSM_EFR) { |
| 1755 | ret.channelRateAndType := ChRate_TCHF; |
| 1756 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 1757 | } |
| 1758 | case (FR_AMR) { |
| 1759 | ret.channelRateAndType := ChRate_TCHF; |
| 1760 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 1761 | } |
| 1762 | case (HR_AMR) { |
| 1763 | ret.channelRateAndType := ChRate_TCHH; |
| 1764 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 1765 | } |
| 1766 | case else { |
| 1767 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1768 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1769 | } |
| 1770 | } |
| 1771 | return ret; |
| 1772 | } |
| 1773 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1774 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 1775 | return template RSL_IE_Body { |
| 1776 | var template RSL_IE_Body mode_ie := { |
| 1777 | chan_mode := { |
| 1778 | len := ?, |
| 1779 | reserved := ?, |
| 1780 | dtx_d := ?, |
| 1781 | dtx_u := ?, |
| 1782 | spd_ind := RSL_SPDI_SPEECH, |
| 1783 | ch_rate_type := -, |
| 1784 | coding_alg_rate := - |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | select (a_elem.codecType) { |
| 1789 | case (GSM_FR) { |
| 1790 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1791 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 1792 | } |
| 1793 | case (GSM_HR) { |
| 1794 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 1795 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 1796 | } |
| 1797 | case (GSM_EFR) { |
| 1798 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1799 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 1800 | } |
| 1801 | case (FR_AMR) { |
| 1802 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1803 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 1804 | } |
| 1805 | case (HR_AMR) { |
| 1806 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 1807 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 1808 | } |
| 1809 | } |
| 1810 | return mode_ie; |
| 1811 | } |
| 1812 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1813 | type record CodecListTest { |
| 1814 | BSSMAP_IE_SpeechCodecList codec_list, |
| 1815 | charstring id |
| 1816 | } |
| 1817 | type record of CodecListTest CodecListTests |
| 1818 | |
| 1819 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1820 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1821 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1822 | |
| 1823 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 1824 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 1825 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 1826 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 1827 | g_pars.ass_codec_list.codecElements[0]; |
| 1828 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1829 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 1830 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1831 | log("expecting ASS COMPL like this: ", exp_compl); |
| 1832 | |
| 1833 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1834 | |
| 1835 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 1836 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 1837 | |
| 1838 | var RSL_IE_Body mode_ie; |
| 1839 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 1840 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1841 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1842 | } |
| 1843 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 1844 | if (not match(mode_ie, t_mode_ie)) { |
| 1845 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 1846 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1847 | |
| 1848 | var RSL_IE_Body mr_conf; |
| 1849 | if (g_pars.expect_mr_conf_ie != omit) { |
| 1850 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 1851 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1852 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1853 | } |
| 1854 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 1855 | |
| 1856 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 1857 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 1858 | g_pars.expect_mr_conf_ie); |
| 1859 | } |
| 1860 | } else { |
| 1861 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 1862 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 1863 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1864 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1865 | } |
| 1866 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1867 | } |
| 1868 | |
| 1869 | testcase TC_assignment_codec_fr() runs on test_CT { |
| 1870 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1871 | var MSC_ConnHdlr vc_conn; |
| 1872 | |
| 1873 | f_init(1, true); |
| 1874 | f_sleep(1.0); |
| 1875 | |
| 1876 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1877 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1878 | vc_conn.done; |
| 1879 | } |
| 1880 | |
| 1881 | testcase TC_assignment_codec_hr() runs on test_CT { |
| 1882 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1883 | var MSC_ConnHdlr vc_conn; |
| 1884 | |
| 1885 | f_init(1, true); |
| 1886 | f_sleep(1.0); |
| 1887 | |
| 1888 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1889 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1890 | vc_conn.done; |
| 1891 | } |
| 1892 | |
| 1893 | testcase TC_assignment_codec_efr() runs on test_CT { |
| 1894 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1895 | var MSC_ConnHdlr vc_conn; |
| 1896 | |
| 1897 | f_init(1, true); |
| 1898 | f_sleep(1.0); |
| 1899 | |
| 1900 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1901 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1902 | vc_conn.done; |
| 1903 | } |
| 1904 | |
| 1905 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
| 1906 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1907 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7f5609a | 2018-09-21 12:50:57 +0200 | [diff] [blame^] | 1908 | |
| 1909 | /* Note: This setups the codec configuration. The parameter payload in |
| 1910 | * mr_conf must be consistant with the parameter codecElements in pars |
| 1911 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1912 | var RSL_IE_Body mr_conf := { |
| 1913 | other := { |
| 1914 | len := 2, |
| 1915 | payload := '2804'O |
| 1916 | } |
| 1917 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1918 | |
Philipp Maier | 7f5609a | 2018-09-21 12:50:57 +0200 | [diff] [blame^] | 1919 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 1920 | pars.ass_codec_list.codecElements[0].s0_7 := '00000110'B; |
| 1921 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 1922 | pars.expect_mr_conf_ie := mr_conf; |
| 1923 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1924 | f_init(1, true); |
| 1925 | f_sleep(1.0); |
| 1926 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1927 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1928 | vc_conn.done; |
| 1929 | } |
| 1930 | |
| 1931 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
| 1932 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1933 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7f5609a | 2018-09-21 12:50:57 +0200 | [diff] [blame^] | 1934 | |
| 1935 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1936 | var RSL_IE_Body mr_conf := { |
| 1937 | other := { |
| 1938 | len := 2, |
| 1939 | payload := '2804'O |
| 1940 | } |
| 1941 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1942 | |
Philipp Maier | 7f5609a | 2018-09-21 12:50:57 +0200 | [diff] [blame^] | 1943 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 1944 | pars.ass_codec_list.codecElements[0].s0_7 := '00000110'B; |
| 1945 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 1946 | pars.expect_mr_conf_ie := mr_conf; |
| 1947 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1948 | f_init(1, true); |
| 1949 | f_sleep(1.0); |
| 1950 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1951 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1952 | vc_conn.done; |
| 1953 | } |
| 1954 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 1955 | /* test the procedure of the MSC requesting a Classmark Update: |
| 1956 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 1957 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1958 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1959 | g_pars := valueof(t_def_TestHdlrPars); |
| 1960 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1961 | /* we should now have a COMPL_L3 at the MSC */ |
| 1962 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1963 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 1964 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 1965 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 1966 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1967 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 1968 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 1969 | setverdict(pass); |
| 1970 | } |
| 1971 | testcase TC_classmark() runs on test_CT { |
| 1972 | var MSC_ConnHdlr vc_conn; |
| 1973 | f_init(1, true); |
| 1974 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1975 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1976 | vc_conn.done; |
| 1977 | } |
| 1978 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1979 | private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1980 | g_pars := valueof(t_def_TestHdlrPars); |
| 1981 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1982 | /* we should now have a COMPL_L3 at the MSC */ |
| 1983 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1984 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1985 | /* send the single message we want to send */ |
| 1986 | f_rsl_send_l3(l3); |
| 1987 | } |
| 1988 | |
| 1989 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 1990 | timer T := sec; |
| 1991 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1992 | T.start; |
| 1993 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1994 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 1995 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1996 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1997 | } |
| 1998 | [] T.timeout { |
| 1999 | setverdict(pass); |
| 2000 | } |
| 2001 | } |
| 2002 | } |
| 2003 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2004 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2005 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 2006 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 2007 | f_bssap_expect_nothing(); |
| 2008 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2009 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 2010 | var MSC_ConnHdlr vc_conn; |
| 2011 | f_init(1, true); |
| 2012 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2013 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2014 | vc_conn.done; |
| 2015 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 2016 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2017 | |
| 2018 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2019 | 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] | 2020 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 2021 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2022 | } |
| 2023 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 2024 | var MSC_ConnHdlr vc_conn; |
| 2025 | f_init(1, true); |
| 2026 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2027 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2028 | vc_conn.done; |
| 2029 | } |
| 2030 | |
| 2031 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2032 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2033 | 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] | 2034 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 2035 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2036 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2037 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 2038 | var MSC_ConnHdlr vc_conn; |
| 2039 | f_init(1, true); |
| 2040 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2041 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2042 | vc_conn.done; |
| 2043 | } |
| 2044 | |
| 2045 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2046 | /* short message from MS should be ignored */ |
| 2047 | private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2048 | g_pars := valueof(t_def_TestHdlrPars); |
| 2049 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2050 | /* we should now have a COMPL_L3 at the MSC */ |
| 2051 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2052 | |
| 2053 | /* send short message */ |
| 2054 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 2055 | f_bssap_expect_nothing(); |
| 2056 | } |
| 2057 | testcase TC_err_82_short_msg() runs on test_CT { |
| 2058 | var MSC_ConnHdlr vc_conn; |
| 2059 | f_init(1, true); |
| 2060 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2061 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2062 | vc_conn.done; |
| 2063 | } |
| 2064 | |
| 2065 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2066 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 2067 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 2068 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 2069 | timer T := 3.0 |
| 2070 | alt { |
| 2071 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 2072 | setverdict(pass); |
| 2073 | } |
| 2074 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 2075 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2076 | } |
| 2077 | } |
| 2078 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 2079 | var MSC_ConnHdlr vc_conn; |
| 2080 | f_init(1, true); |
| 2081 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2082 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2083 | vc_conn.done; |
| 2084 | } |
| 2085 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2086 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 2087 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 2088 | runs on test_CT { |
| 2089 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2090 | " timeslot "&int2str(ts_nr)&" "; |
| 2091 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2092 | } |
| 2093 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2094 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
| 2095 | private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr) |
| 2096 | runs on MSC_ConnHdlr { |
| 2097 | /* FIXME: resolve those from component-global state */ |
| 2098 | var integer ts_nr := chan_nr.tn; |
| 2099 | var integer ss_nr; |
| 2100 | if (ischosen(chan_nr.u.ch0)) { |
| 2101 | ss_nr := 0; |
| 2102 | } else if (ischosen(chan_nr.u.lm)) { |
| 2103 | ss_nr := chan_nr.u.lm.sub_chan; |
| 2104 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 2105 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 2106 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 2107 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 2108 | } else { |
| 2109 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2110 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2111 | } |
| 2112 | |
| 2113 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2114 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
| 2115 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2116 | } |
| 2117 | |
| 2118 | private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr, |
| 2119 | integer new_bts_nr) |
| 2120 | runs on MSC_ConnHdlr { |
| 2121 | f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
| 2122 | } |
| 2123 | |
| 2124 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 2125 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2126 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 2127 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2128 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2129 | const OCT8 kc := '0001020304050607'O; |
| 2130 | |
| 2131 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2132 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2133 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2134 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2135 | |
| 2136 | var HandoverState hs := { |
| 2137 | rr_ho_cmpl_seen := false, |
| 2138 | handover_done := false, |
| 2139 | old_chan_nr := - |
| 2140 | }; |
| 2141 | /* issue hand-over command on VTY */ |
| 2142 | f_vty_handover(0, 0, g_chan_nr, 1); |
| 2143 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 2144 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2145 | |
| 2146 | /* From the MGW perspective, a handover is is characterized by |
| 2147 | * performing one MDCX operation with the MGW. So we expect to see |
| 2148 | * one more MDCX during handover. */ |
| 2149 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 2150 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2151 | alt { |
| 2152 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2153 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2154 | |
| 2155 | /* Check the amount of MGCP transactions is still consistant with the |
| 2156 | * test expectation */ |
| 2157 | f_check_mgcp_expectations() |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2158 | } |
| 2159 | |
| 2160 | testcase TC_ho_int() runs on test_CT { |
| 2161 | var MSC_ConnHdlr vc_conn; |
| 2162 | f_init(2, true); |
| 2163 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2164 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2165 | vc_conn.done; |
| 2166 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2167 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2168 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2169 | * BSSMAP Reset just because of that. */ |
| 2170 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 2171 | var default d; |
| 2172 | var integer i; |
| 2173 | var DchanTuple dt; |
| 2174 | |
| 2175 | f_init(); |
| 2176 | |
| 2177 | /* Wait for initial BSSMAP Reset to pass */ |
| 2178 | f_sleep(4.0); |
| 2179 | |
| 2180 | d := activate(no_bssmap_reset()); |
| 2181 | |
| 2182 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2183 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2184 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 2185 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2186 | /* Since we're doing a lot of runs, give each one a fresh |
| 2187 | * T_guard from the top. */ |
| 2188 | T_guard.start; |
| 2189 | |
| 2190 | /* Setup a BSSAP connection and clear it right away. This is |
| 2191 | * the MSC telling the BSC about a planned release, it's not an |
| 2192 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 2193 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2194 | |
| 2195 | /* MSC disconnects (RLSD). */ |
| 2196 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2197 | } |
| 2198 | |
| 2199 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2200 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2201 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2202 | f_sleep(4.0); |
| 2203 | |
| 2204 | deactivate(d); |
| 2205 | f_shutdown_helper(); |
| 2206 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 2207 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2208 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2209 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 2210 | * the MSC. */ |
| 2211 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 2212 | var default d; |
| 2213 | var integer i; |
| 2214 | var DchanTuple dt; |
| 2215 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2216 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 2217 | var BssmapCause cause := enum2int(cause_val); |
| 2218 | |
| 2219 | f_init(); |
| 2220 | |
| 2221 | /* Wait for initial BSSMAP Reset to pass */ |
| 2222 | f_sleep(4.0); |
| 2223 | |
| 2224 | d := activate(no_bssmap_reset()); |
| 2225 | |
| 2226 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2227 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2228 | * Let's do it some more times for good measure. */ |
| 2229 | for (i := 0; i < 8; i := i+1) { |
| 2230 | /* Since we're doing a lot of runs, give each one a fresh |
| 2231 | * T_guard from the top. */ |
| 2232 | T_guard.start; |
| 2233 | |
| 2234 | /* Setup a BSSAP connection and clear it right away. This is |
| 2235 | * the MSC telling the BSC about a planned release, it's not an |
| 2236 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 2237 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2238 | |
| 2239 | /* Instruct BSC to clear channel */ |
| 2240 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2241 | |
| 2242 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 2243 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2244 | } |
| 2245 | |
| 2246 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2247 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2248 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2249 | f_sleep(4.0); |
| 2250 | |
| 2251 | deactivate(d); |
| 2252 | f_shutdown_helper(); |
| 2253 | } |
| 2254 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2255 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2256 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 2257 | * Release Ind on RSL. */ |
| 2258 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 2259 | var default d; |
| 2260 | var integer i; |
| 2261 | var DchanTuple dt; |
| 2262 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2263 | var integer j; |
| 2264 | |
| 2265 | f_init(); |
| 2266 | |
| 2267 | /* Wait for initial BSSMAP Reset to pass */ |
| 2268 | f_sleep(4.0); |
| 2269 | |
| 2270 | d := activate(no_bssmap_reset()); |
| 2271 | |
| 2272 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2273 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2274 | * Let's do it some more times for good measure. */ |
| 2275 | for (i := 0; i < 8; i := i+1) { |
| 2276 | /* Since we're doing a lot of runs, give each one a fresh |
| 2277 | * T_guard from the top. */ |
| 2278 | T_guard.start; |
| 2279 | |
| 2280 | /* Setup a BSSAP connection and clear it right away. This is |
| 2281 | * the MSC telling the BSC about a planned release, it's not an |
| 2282 | * erratic loss of a connection. */ |
| 2283 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2284 | |
| 2285 | /* simulate RLL REL IND */ |
| 2286 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 2287 | |
| 2288 | /* expect Clear Request on MSC side */ |
| 2289 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 2290 | |
| 2291 | /* Instruct BSC to clear channel */ |
| 2292 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 2293 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2294 | |
| 2295 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 2296 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2297 | } |
| 2298 | |
| 2299 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2300 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2301 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2302 | f_sleep(4.0); |
| 2303 | |
| 2304 | deactivate(d); |
| 2305 | f_shutdown_helper(); |
| 2306 | } |
| 2307 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2308 | /*********************************************************************** |
| 2309 | * IPA style dynamic PDCH |
| 2310 | ***********************************************************************/ |
| 2311 | |
| 2312 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2313 | template (omit) RSL_Cause nack := omit) |
| 2314 | runs on test_CT { |
| 2315 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 2316 | var RSL_Message rsl_unused; |
| 2317 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2318 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 2319 | /* expect the BSC to issue the related RSL command */ |
| 2320 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2321 | if (istemplatekind(nack, "omit")) { |
| 2322 | /* respond with a related acknowledgement */ |
| 2323 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2324 | } else { |
| 2325 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 2326 | } |
| 2327 | } |
| 2328 | |
| 2329 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2330 | template (omit) RSL_Cause nack := omit) |
| 2331 | runs on test_CT { |
| 2332 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 2333 | var RSL_Message rsl_unused; |
| 2334 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2335 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 2336 | /* expect the BSC to issue the related RSL command */ |
| 2337 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 2338 | if (istemplatekind(nack, "omit")) { |
| 2339 | /* respond with a related acknowledgement */ |
| 2340 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 2341 | } else { |
| 2342 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 2343 | } |
| 2344 | } |
| 2345 | |
| 2346 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 2347 | runs on test_CT return charstring { |
| 2348 | var charstring cmd, resp; |
| 2349 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
| 2350 | resp := f_vty_transceive_ret(BSCVTY, cmd); |
| 2351 | return regexp(resp, "*\((*)\)*", 0); |
| 2352 | } |
| 2353 | |
| 2354 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2355 | template charstring exp) |
| 2356 | runs on test_CT { |
| 2357 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 2358 | if (not match(mode, exp)) { |
| 2359 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2360 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2361 | } |
| 2362 | } |
| 2363 | |
| 2364 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 2365 | runs on test_CT { |
| 2366 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 2367 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 2368 | f_vty_transceive(BSCVTY, "end"); |
| 2369 | } |
| 2370 | |
| 2371 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 2372 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 2373 | private const charstring PDCH_MODE := "PDCH mode"; |
| 2374 | private const charstring NONE_MODE := "NONE mode"; |
| 2375 | |
| 2376 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 2377 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 2378 | var RSL_Message rsl_unused; |
| 2379 | |
| 2380 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2381 | f_init_vty(); |
| 2382 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 2383 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2384 | |
| 2385 | f_init(1, false); |
| 2386 | f_sleep(1.0); |
| 2387 | |
| 2388 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2389 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2390 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2391 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2392 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2393 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2394 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2395 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2396 | 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] | 2397 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2398 | |
| 2399 | /* De-activate it via VTY */ |
| 2400 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2401 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2402 | 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] | 2403 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2404 | |
| 2405 | /* re-activate it via VTY */ |
| 2406 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 2407 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2408 | 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] | 2409 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2410 | |
| 2411 | /* and finally de-activate it again */ |
| 2412 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2413 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2414 | 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] | 2415 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2416 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2417 | /* clean up config */ |
| 2418 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2419 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2420 | setverdict(pass); |
| 2421 | } |
| 2422 | |
| 2423 | /* Test IPA PDCH activation NACK */ |
| 2424 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 2425 | var RSL_Message rsl_unused; |
| 2426 | |
| 2427 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2428 | f_init_vty(); |
| 2429 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 2430 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2431 | |
| 2432 | f_init(1, false); |
| 2433 | f_sleep(1.0); |
| 2434 | |
| 2435 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2436 | |
| 2437 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2438 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2439 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2440 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2441 | f_sleep(1.0); |
| 2442 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2443 | |
| 2444 | /* De-activate it via VTY */ |
| 2445 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2446 | f_sleep(1.0); |
| 2447 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2448 | |
| 2449 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 2450 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 2451 | f_sleep(1.0); |
| 2452 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2453 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2454 | /* clean up config */ |
| 2455 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2456 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2457 | setverdict(pass); |
| 2458 | } |
| 2459 | |
| 2460 | |
| 2461 | /*********************************************************************** |
| 2462 | * Osmocom style dynamic PDCH |
| 2463 | ***********************************************************************/ |
| 2464 | |
| 2465 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2466 | template (omit) RSL_Cause nack := omit) |
| 2467 | runs on test_CT { |
| 2468 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 2469 | var RSL_Message rsl_unused; |
| 2470 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2471 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 2472 | /* expect the BSC to issue the related RSL command */ |
| 2473 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 2474 | if (istemplatekind(nack, "omit")) { |
| 2475 | /* respond with a related acknowledgement */ |
| 2476 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 2477 | } else { |
| 2478 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 2479 | } |
| 2480 | } |
| 2481 | |
| 2482 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2483 | template (omit) RSL_Cause nack := omit) |
| 2484 | runs on test_CT { |
| 2485 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 2486 | var RSL_Message rsl_unused; |
| 2487 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2488 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 2489 | /* expect the BSC to issue the related RSL command */ |
| 2490 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 2491 | if (istemplatekind(nack, "omit")) { |
| 2492 | /* respond with a related acknowledgement */ |
| 2493 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 2494 | } else { |
| 2495 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 2496 | } |
| 2497 | } |
| 2498 | |
| 2499 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 2500 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 2501 | var RSL_Message rsl_unused; |
| 2502 | |
| 2503 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2504 | f_init_vty(); |
| 2505 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 2506 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2507 | |
| 2508 | f_init(1, false); |
| 2509 | f_sleep(1.0); |
| 2510 | |
| 2511 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 2512 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2513 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2514 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2515 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2516 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 2517 | |
| 2518 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 2519 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2520 | 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] | 2521 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2522 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2523 | /* clean up config */ |
| 2524 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2525 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2526 | setverdict(pass); |
| 2527 | } |
| 2528 | |
| 2529 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 2530 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 2531 | var RSL_Message rsl_unused; |
| 2532 | |
| 2533 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2534 | f_init_vty(); |
| 2535 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 2536 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2537 | |
| 2538 | f_init(1, false); |
| 2539 | f_sleep(1.0); |
| 2540 | |
| 2541 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 2542 | |
| 2543 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2544 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2545 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 2546 | |
| 2547 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 2548 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 2549 | f_sleep(1.0); |
| 2550 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2551 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2552 | /* clean up config */ |
| 2553 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2554 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2555 | setverdict(pass); |
| 2556 | } |
| 2557 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 2558 | /* Dyn PDCH todo: |
| 2559 | * activate OSMO as TCH/F |
| 2560 | * activate OSMO as TCH/H |
| 2561 | * does the BSC-located PCU socket get the updated INFO? |
| 2562 | * what if no PCU is connected at the time? |
| 2563 | * is the info correct on delayed PCU (re)connect? |
| 2564 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2565 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 2566 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2567 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2568 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2569 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2570 | execute( TC_ctrl() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2571 | |
| 2572 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2573 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2574 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2575 | execute( TC_chan_act_ack_noest() ); |
| 2576 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 2577 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 2578 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 2579 | execute( TC_chan_exhaustion() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2580 | execute( TC_chan_rel_rll_rel_ind() ); |
| 2581 | execute( TC_chan_rel_conn_fail() ); |
| 2582 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2583 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2584 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2585 | execute( TC_chan_rel_a_reset() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2586 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 2587 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2588 | |
| 2589 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 2590 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2591 | execute( TC_assignment_csd() ); |
| 2592 | execute( TC_assignment_ctm() ); |
| 2593 | execute( TC_assignment_sign() ); |
| 2594 | execute( TC_assignment_fr_a5_0() ); |
| 2595 | execute( TC_assignment_fr_a5_1() ); |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 2596 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2597 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 2598 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2599 | execute( TC_assignment_fr_a5_3() ); |
| 2600 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 2601 | execute( TC_ciph_mode_a5_0() ); |
| 2602 | execute( TC_ciph_mode_a5_1() ); |
| 2603 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 2604 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2605 | execute( TC_assignment_codec_fr() ); |
| 2606 | execute( TC_assignment_codec_hr() ); |
| 2607 | execute( TC_assignment_codec_efr() ); |
| 2608 | execute( TC_assignment_codec_amr_f() ); |
| 2609 | execute( TC_assignment_codec_amr_h() ); |
| 2610 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2611 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2612 | execute( TC_rll_est_ind_inact_lchan() ); |
| 2613 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 2614 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 2615 | execute( TC_rll_est_ind_inval_sacch() ); |
| 2616 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2617 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2618 | execute( TC_paging_imsi_nochan() ); |
| 2619 | execute( TC_paging_tmsi_nochan() ); |
| 2620 | execute( TC_paging_tmsi_any() ); |
| 2621 | execute( TC_paging_tmsi_sdcch() ); |
| 2622 | execute( TC_paging_tmsi_tch_f() ); |
| 2623 | execute( TC_paging_tmsi_tch_hf() ); |
| 2624 | execute( TC_paging_imsi_nochan_cgi() ); |
| 2625 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 2626 | execute( TC_paging_imsi_nochan_ci() ); |
| 2627 | execute( TC_paging_imsi_nochan_lai() ); |
| 2628 | execute( TC_paging_imsi_nochan_lac() ); |
| 2629 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2630 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 2631 | execute( TC_paging_imsi_nochan_rnc() ); |
| 2632 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 2633 | execute( TC_paging_imsi_nochan_lacs() ); |
| 2634 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2635 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2636 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2637 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 2638 | execute( TC_paging_counter() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 2639 | |
| 2640 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2641 | execute( TC_rsl_unknown_unit_id() ); |
| 2642 | |
| 2643 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2644 | |
| 2645 | execute( TC_classmark() ); |
| 2646 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2647 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2648 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2649 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2650 | execute( TC_err_84_unknown_msg() ); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2651 | execute( TC_ho_int() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2652 | |
| 2653 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2654 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2655 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2656 | |
| 2657 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 2658 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 2659 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 2660 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2661 | |
| 2662 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 2663 | execute( TC_early_conn_fail() ); |
| 2664 | execute( TC_late_conn_fail() ); |
| 2665 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 2666 | } |
| 2667 | |
| 2668 | } |