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 |
| 4 | * (C) 2017 by Harald Welte <laforge@gnumonks.org> |
| 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 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 49 | const integer NUM_BTS := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 50 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 51 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 52 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
| 53 | const integer NUM_TCHF_PER_BTS := 5; |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 54 | const integer NUM_SDCCH_PER_BTS := 4; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 55 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 56 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 57 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 58 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 59 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 60 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 61 | } |
| 62 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 63 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 64 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 65 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 66 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 67 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 68 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 69 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 70 | 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] | 71 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 72 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 73 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 74 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 75 | var BSSAP_Adapter g_bssap; |
| 76 | /* for old legacy-tests only */ |
| 77 | port BSSAP_CODEC_PT BSSAP; |
| 78 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 79 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 80 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 81 | |
| 82 | /* global test case guard timer */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | timer T_guard := 30.0; |
| 84 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 89 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 90 | /* port number to which to establish the IPA OML connections */ |
| 91 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 92 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 93 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 94 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 95 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 96 | /* IP address at which the test binds */ |
| 97 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 98 | |
| 99 | BSSAP_Configuration mp_bssap_cfg := { |
| 100 | sccp_service_type := "mtp3_itu", |
| 101 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 102 | own_pc := 185, |
| 103 | own_ssn := 254, |
| 104 | peer_pc := 187, |
| 105 | peer_ssn := 254, |
| 106 | sio := '83'O |
| 107 | }; |
| 108 | } |
| 109 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 110 | private function f_shutdown_helper() runs on test_CT { |
| 111 | all port.stop; |
| 112 | setverdict(pass); |
| 113 | } |
| 114 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 115 | private function f_legacy_bssap_reset() runs on test_CT { |
| 116 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 117 | timer T := 5.0; |
| 118 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 119 | T.start; |
| 120 | alt { |
| 121 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { |
| 122 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 123 | } |
| 124 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 125 | log("Respoding to inbound RESET with RESET-ACK"); |
| 126 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 127 | ts_BSSMAP_ResetAck)); |
| 128 | repeat; |
| 129 | } |
| 130 | [] BSSAP.receive { repeat; } |
| 131 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 132 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 133 | } |
| 134 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 135 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 136 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 137 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 138 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 139 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 140 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 141 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 142 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 143 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 144 | } |
| 145 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 146 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 147 | * \param clnt IPA_Client for which to establish |
| 148 | * \param bsc_host IP address / hostname of the BSC |
| 149 | * \param bsc_port TCP port number of the BSC |
| 150 | * \param i number identifying this BTS |
| 151 | * \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] | 152 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 153 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 154 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 155 | timer T := 10.0; |
| 156 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 157 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 158 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 159 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 160 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 161 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 162 | if (handler_mode) { |
| 163 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 164 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 165 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 166 | |
| 167 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 168 | if (handler_mode) { |
| 169 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 170 | } else { |
| 171 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 172 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 173 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 174 | 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] | 175 | if (handler_mode) { |
| 176 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 177 | return; |
| 178 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 179 | |
| 180 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 181 | T.start; |
| 182 | alt { |
| 183 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 184 | T.stop; |
| 185 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 186 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 187 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 188 | [] IPA_RSL[i].receive { repeat } |
| 189 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 190 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 191 | self.stop; |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 196 | /* 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] | 197 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 198 | timer T := secs_max; |
| 199 | T.start; |
| 200 | while (true) { |
| 201 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 202 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 203 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 204 | * until all MO's are initialized */ |
| 205 | T.start(1.0); |
| 206 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 207 | return; |
| 208 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 209 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 210 | if (not T.running) { |
| 211 | setverdict(fail, "Timeout waiting for oml-connection-state ", status); |
| 212 | self.stop; |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 217 | /* sleep for given number of (fractional) seconds */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 218 | function f_sleep(float seconds) { |
| 219 | timer T := seconds; |
| 220 | T.start; |
| 221 | T.timeout; |
| 222 | } |
| 223 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 224 | /* 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] | 225 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 226 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 227 | [] T_guard.timeout { |
| 228 | setverdict(fail, "Timeout of T_guard"); |
| 229 | self.stop; |
| 230 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 231 | /* always respond with RESET ACK to RESET */ |
| 232 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 233 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 234 | ts_BSSMAP_ResetAck)); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 235 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 236 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 237 | } |
| 238 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame^] | 239 | altstep no_bssmap_reset() runs on test_CT { |
| 240 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { |
| 241 | setverdict(fail, "unexpected BSSMAP Reset"); |
| 242 | self.stop; |
| 243 | } |
| 244 | } |
| 245 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 246 | function f_init_mgcp(charstring id) runs on test_CT { |
| 247 | id := id & "-MGCP"; |
| 248 | |
| 249 | var MGCPOps ops := { |
| 250 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 251 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 252 | }; |
| 253 | var MGCP_conn_parameters mgcp_pars := { |
| 254 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 255 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 256 | mgw_ip := mp_test_ip, |
| 257 | mgw_udp_port := 2427 |
| 258 | }; |
| 259 | |
| 260 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 261 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 262 | } |
| 263 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 264 | private function f_init_vty(charstring id) runs on test_CT { |
| 265 | map(self:BSCVTY, system:BSCVTY); |
| 266 | f_vty_set_prompts(BSCVTY); |
| 267 | f_vty_transceive(BSCVTY, "enable"); |
| 268 | } |
| 269 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 270 | /* global initialization function |
| 271 | * \param nr_bts Number of BTSs we should start/bring up |
| 272 | * \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] | 273 | 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] | 274 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 275 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 276 | if (g_initialized) { |
| 277 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 278 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 279 | g_initialized := true; |
| 280 | |
| 281 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 282 | * MSC-side BSSAP emulation */ |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 283 | if (handler_mode) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 284 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 285 | } else { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 286 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
| 287 | connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT); |
| 288 | f_legacy_bssap_reset(); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 289 | } |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 290 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 291 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 292 | f_init_mgcp("VirtMSC"); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 293 | f_init_vty("VirtMSC"); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 294 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 295 | for (i := 0; i < nr_bts; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 296 | /* wait until osmo-bts-omldummy has respawned */ |
| 297 | f_wait_oml(i, "degraded", 5.0); |
| 298 | /* start RSL connection */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 299 | 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] | 300 | /* wait until BSC tells us "connected" */ |
| 301 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 302 | } |
| 303 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 304 | T_guard.start; |
| 305 | activate(as_Tguard()); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 306 | } |
| 307 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 308 | /* 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] | 309 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 310 | runs on test_CT return RSL_Message { |
| 311 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 312 | timer T := t_secs; |
| 313 | |
| 314 | T.start; |
| 315 | alt { |
| 316 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 317 | T.stop; |
| 318 | } |
| 319 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 320 | [] T.timeout { |
| 321 | setverdict(fail, "Timeout expecting ", t_rx); |
| 322 | self.stop; |
| 323 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 324 | } |
| 325 | return rx_rsl_ud.rsl; |
| 326 | } |
| 327 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 328 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 329 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 330 | runs on test_CT { |
| 331 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 332 | } |
| 333 | |
| 334 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 335 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 336 | testcase TC_chan_act_noreply() runs on test_CT { |
| 337 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 338 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 339 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 340 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 341 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 342 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 343 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 344 | } |
| 345 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 346 | /* verify if the "chreq:total" counter increments as expected */ |
| 347 | testcase TC_chan_act_counter() runs on test_CT { |
| 348 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 349 | var integer chreq_total; |
| 350 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 351 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 352 | |
| 353 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 354 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 355 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 356 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 357 | |
| 358 | setverdict(pass); |
| 359 | } |
| 360 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 361 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 362 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 363 | var RSL_Message rx_rsl; |
| 364 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 365 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 366 | |
| 367 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 368 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 369 | |
| 370 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 371 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 372 | |
| 373 | setverdict(pass); |
| 374 | } |
| 375 | |
| 376 | /* Test behavior if MSC never answers to CR */ |
| 377 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 378 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 379 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 380 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 381 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 382 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 383 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 384 | |
| 385 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 386 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 387 | |
| 388 | var octetstring l3 := '00010203040506'O |
| 389 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 390 | |
| 391 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 392 | |
| 393 | /* 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] | 394 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
| 395 | IPA_RSL[0].clear; |
| 396 | alt { |
| 397 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { } |
| 398 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) -> value rx_rsl_ud { |
| 399 | f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch)); |
| 400 | repeat; |
| 401 | } |
| 402 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 403 | |
| 404 | setverdict(pass); |
| 405 | } |
| 406 | |
| 407 | /* Test behavior if MSC answers with CREF to CR */ |
| 408 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 409 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 410 | var RSL_Message rx_rsl; |
| 411 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 412 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 413 | |
| 414 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 415 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 416 | |
| 417 | var octetstring l3 := '00010203040506'O |
| 418 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 419 | |
| 420 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 421 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 422 | |
| 423 | /* expect BSC to disable the channel */ |
Harald Welte | 725844b | 2018-01-28 16:18:32 +0100 | [diff] [blame] | 424 | f_expect_chan_rel(0, chan_nr); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 425 | setverdict(pass); |
| 426 | } |
| 427 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 428 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 429 | testcase TC_chan_act_nack() runs on test_CT { |
| 430 | var RSL_Message rx_rsl; |
| 431 | var integer chact_nack; |
| 432 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 433 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 434 | |
| 435 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 436 | |
| 437 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 438 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 439 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 440 | |
| 441 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 442 | |
| 443 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 444 | f_sleep(0.5); |
| 445 | |
| 446 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 447 | |
| 448 | setverdict(pass); |
| 449 | } |
| 450 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 451 | /* Test for channel exhaustion due to RACH overload */ |
| 452 | testcase TC_chan_exhaustion() runs on test_CT { |
| 453 | var ASP_RSL_Unitdata rsl_ud; |
| 454 | var integer i; |
| 455 | var integer chreq_total, chreq_nochan; |
| 456 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 457 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 458 | |
| 459 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 460 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 461 | |
| 462 | /* expect 5xTCH/F to succeed */ |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 463 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 464 | f_chreq_act_ack('23'O, i); |
| 465 | } |
| 466 | |
| 467 | IPA_RSL[0].clear; |
| 468 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 469 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 470 | chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 471 | |
| 472 | /* now expect additional channel activations to fail */ |
| 473 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 474 | |
| 475 | alt { |
| 476 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 477 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 478 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 479 | } |
| 480 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 481 | var GsmRrMessage rr; |
| 482 | /* match on IMM ASS REJ */ |
| 483 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 484 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 485 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 486 | chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS+1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 487 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 488 | chreq_nochan+1); |
| 489 | setverdict(pass); |
| 490 | } else { |
| 491 | repeat; |
| 492 | } |
| 493 | } |
| 494 | [] IPA_RSL[0].receive { repeat; } |
| 495 | } |
| 496 | } |
| 497 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 498 | /*********************************************************************** |
| 499 | * Assignment Testing |
| 500 | ***********************************************************************/ |
| 501 | |
| 502 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction) */ |
| 503 | testcase TC_outbound_connect() runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 504 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 505 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 506 | 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] | 507 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 508 | setverdict(pass); |
| 509 | } |
| 510 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 511 | /* Test behavior if MSC answers with CREF to CR */ |
| 512 | testcase TC_assignment_cic_only() runs on test_CT { |
| 513 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 514 | var RSL_Message rx_rsl; |
| 515 | var DchanTuple dt; |
| 516 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 517 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 518 | |
| 519 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 520 | /* send assignment without AoIP IEs */ |
Harald Welte | cc7e4dc | 2017-12-14 21:55:10 +0100 | [diff] [blame] | 521 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 522 | alt { |
| 523 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 524 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 525 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 526 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 527 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 528 | setverdict(pass); |
| 529 | } |
| 530 | [] BSSAP.receive { repeat; } |
| 531 | } |
| 532 | } |
| 533 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 534 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 535 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 536 | runs on test_CT { |
| 537 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 538 | var RSL_Message rx_rsl; |
| 539 | var DchanTuple dt; |
| 540 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 541 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 542 | |
| 543 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 544 | /* send assignment without AoIP IEs */ |
| 545 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 546 | alt { |
| 547 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 548 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 549 | setverdict(pass); |
| 550 | } else { |
| 551 | setverdict(fail, fail_text); |
| 552 | } |
| 553 | } |
| 554 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 555 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 556 | setverdict(pass); |
| 557 | } else { |
| 558 | setverdict(fail, fail_text); |
| 559 | } |
| 560 | } |
| 561 | [] BSSAP.receive { repeat; } |
| 562 | } |
| 563 | } |
| 564 | testcase TC_assignment_csd() runs on test_CT { |
| 565 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 566 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 567 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 568 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 569 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 570 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 571 | } |
| 572 | |
| 573 | testcase TC_assignment_ctm() runs on test_CT { |
| 574 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 575 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 576 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 577 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 578 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 579 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 580 | } |
| 581 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 582 | type record DchanTuple { |
| 583 | integer sccp_conn_id, |
| 584 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 585 | } |
| 586 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 587 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 588 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 589 | runs on test_CT return RslChannelNr { |
| 590 | var RSL_Message rx_rsl; |
| 591 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 592 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 593 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 594 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 595 | return chan_nr; |
| 596 | } |
| 597 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 598 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 599 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 600 | runs on test_CT return DchanTuple { |
| 601 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 602 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 603 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 604 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 605 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 606 | |
| 607 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 608 | |
| 609 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 610 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 611 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 612 | |
| 613 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 614 | } |
| 615 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 616 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 617 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
| 618 | var RSL_Message rx_rsl; |
| 619 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 620 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 621 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 622 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 623 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 624 | |
| 625 | /* simulate RLL REL IND */ |
| 626 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 627 | |
| 628 | /* expect BSC to disable the channel */ |
| 629 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 630 | /* respond with CHAN REL ACK */ |
| 631 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 632 | |
| 633 | /* expect DISC_IND on MSC side */ |
| 634 | BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)); |
| 635 | |
| 636 | setverdict(pass); |
| 637 | } |
| 638 | |
| 639 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 640 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 641 | var BSSAP_N_DATA_ind rx_di; |
| 642 | var RSL_Message rx_rsl; |
| 643 | var DchanTuple dt; |
| 644 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 645 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 646 | |
| 647 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 648 | |
| 649 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 650 | 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] | 651 | /* TODO: different cause values? */ |
| 652 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 653 | /* expect Clear Request from BSC */ |
| 654 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 655 | |
| 656 | /* Instruct BSC to clear channel */ |
| 657 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 658 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 659 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 660 | /* expect BSC to disable the channel */ |
| 661 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 662 | /* respond with CHAN REL ACK */ |
| 663 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 664 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 665 | /* expect Clear Complete from BSC */ |
| 666 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 667 | |
| 668 | /* release the SCCP connection */ |
| 669 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 670 | |
| 671 | /* wait for SCCP emulation to do its job */ |
| 672 | f_sleep(1.0); |
| 673 | |
| 674 | setverdict(pass); |
| 675 | } |
| 676 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 677 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean flush := true, |
| 678 | boolean handle_rll_rel := true) runs on test_CT { |
| 679 | |
| 680 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 681 | if (flush) { |
| 682 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 683 | IPA_RSL[bts_nr].clear; |
| 684 | } |
| 685 | alt { |
| 686 | /* ignore DEACTIVATE SACCH (if any) */ |
| 687 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 688 | tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
| 689 | repeat; |
| 690 | } |
| 691 | /* acknowledge RLL release (if any)*/ |
| 692 | [handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 693 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
| 694 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 695 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 696 | repeat; |
| 697 | } |
| 698 | /* Expect RF channel release from BSC on Abis */ |
| 699 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 700 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 701 | /* respond with CHAN REL ACK */ |
| 702 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 703 | } |
| 704 | /* ignore any user data */ |
| 705 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 706 | repeat; |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 711 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 712 | testcase TC_chan_rel_hard_clear() 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; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 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 | /* Instruct BSC to clear channel */ |
| 721 | var BssmapCause cause := 0; |
| 722 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 723 | |
| 724 | /* expect Clear Complete from BSC on A */ |
| 725 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 726 | /* release the SCCP connection */ |
| 727 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 728 | } |
| 729 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 730 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 731 | setverdict(pass); |
| 732 | } |
| 733 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 734 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 735 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 736 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 737 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 738 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 739 | |
| 740 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 741 | |
| 742 | /* release the SCCP connection */ |
| 743 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 744 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 745 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 746 | setverdict(pass); |
| 747 | } |
| 748 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 749 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 750 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 751 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 752 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 753 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 754 | |
| 755 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 756 | |
| 757 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 758 | IPA_RSL[0].clear; |
| 759 | |
| 760 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 761 | 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] | 762 | interleave { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 763 | [] 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] | 764 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 765 | } |
| 766 | |
Philipp Maier | e8f38ed | 2018-02-09 10:30:31 +0100 | [diff] [blame] | 767 | f_expect_chan_rel(0, dt.rsl_chan_nr, false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 768 | setverdict(pass); |
| 769 | } |
| 770 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 771 | /* Test behavior if RSL EST IND for non-active channel */ |
| 772 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 773 | timer T := 2.0; |
| 774 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 775 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 776 | |
| 777 | var octetstring l3 := '00010203040506'O; |
| 778 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 779 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 780 | |
| 781 | T.start; |
| 782 | alt { |
| 783 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 784 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 785 | } |
| 786 | [] BSSAP.receive {} |
| 787 | [] IPA_RSL[0].receive {} |
| 788 | [] T.timeout {} |
| 789 | } |
| 790 | |
| 791 | setverdict(pass); |
| 792 | } |
| 793 | |
| 794 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 795 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 796 | var RslChannelNr chan_nr; |
| 797 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 798 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 799 | |
| 800 | chan_nr := f_chreq_act_ack() |
| 801 | |
| 802 | var octetstring l3 := '00010203040506'O; |
| 803 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 804 | |
| 805 | timer T := 2.0; |
| 806 | T.start; |
| 807 | alt { |
| 808 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 809 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 810 | } |
| 811 | [] BSSAP.receive { repeat; } |
| 812 | [] IPA_RSL[0].receive { repeat; } |
| 813 | [] T.timeout {} |
| 814 | } |
| 815 | |
| 816 | setverdict(pass); |
| 817 | } |
| 818 | |
| 819 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 820 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 821 | timer T := 2.0; |
| 822 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 823 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 824 | |
| 825 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 826 | |
| 827 | var octetstring l3 := '00010203040506'O; |
| 828 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 829 | |
| 830 | T.start; |
| 831 | alt { |
| 832 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 833 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 834 | } |
| 835 | [] BSSAP.receive { repeat; } |
| 836 | [] IPA_RSL[0].receive { repeat; } |
| 837 | [] T.timeout {} |
| 838 | } |
| 839 | |
| 840 | setverdict(pass); |
| 841 | } |
| 842 | |
| 843 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 844 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 845 | timer T := 2.0; |
| 846 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 847 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 848 | |
| 849 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 850 | |
| 851 | var octetstring l3 := '00010203040506'O; |
| 852 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 853 | |
| 854 | T.start; |
| 855 | alt { |
| 856 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 857 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 858 | } |
| 859 | [] BSSAP.receive { repeat; } |
| 860 | [] IPA_RSL[0].receive { repeat; } |
| 861 | [] T.timeout {} |
| 862 | } |
| 863 | |
| 864 | setverdict(pass); |
| 865 | } |
| 866 | |
| 867 | |
| 868 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 869 | |
| 870 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 871 | var charstring ctrl_resp; |
| 872 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 873 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 874 | |
| 875 | /* See https://osmocom.org/issues/2729 */ |
| 876 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 877 | setverdict(pass); |
| 878 | } |
| 879 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 880 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 881 | var charstring ctrl_resp; |
| 882 | |
| 883 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 884 | |
| 885 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 886 | setverdict(pass); |
| 887 | } |
| 888 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 889 | testcase TC_ctrl() runs on test_CT { |
| 890 | var charstring ctrl_resp; |
| 891 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 892 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 893 | |
| 894 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 895 | |
| 896 | f_ctrl_get_exp(IPA_CTRL, "mcc", "1"); |
| 897 | f_ctrl_get_exp(IPA_CTRL, "mnc", "1"); |
Harald Welte | 44bdaa5 | 2017-12-17 17:01:47 +0100 | [diff] [blame] | 898 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 899 | |
| 900 | var integer bts_nr := 0; |
| 901 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 902 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 903 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 904 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 905 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 906 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 907 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 908 | |
| 909 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 910 | f_sleep(2.0); |
| 911 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 912 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 913 | } |
| 914 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 915 | |
| 916 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 917 | |
| 918 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 919 | } |
| 920 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 921 | 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] | 922 | 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] | 923 | } |
| 924 | |
| 925 | |
| 926 | /*********************************************************************** |
| 927 | * Paging Testing |
| 928 | ***********************************************************************/ |
| 929 | |
| 930 | type record Cell_Identity { |
| 931 | GsmMcc mcc, |
| 932 | GsmMnc mnc, |
| 933 | GsmLac lac, |
| 934 | GsmCellId ci |
| 935 | }; |
| 936 | private const Cell_Identity cid := { '001'H, '001'H, 1, 0 }; |
| 937 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 938 | type set of integer BtsIdList; |
| 939 | |
| 940 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 941 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 942 | if (bts_id == bts_ids[j]) { |
| 943 | return true; |
| 944 | } |
| 945 | } |
| 946 | return false; |
| 947 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 948 | |
| 949 | /* core paging test helper function; used by most paging test cases */ |
| 950 | private function f_pageing_helper(hexstring imsi, |
| 951 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 952 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 953 | template RSL_ChanNeeded rsl_chneed := omit, |
| 954 | template OCT4 tmsi := omit) runs on test_CT |
| 955 | { |
| 956 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 957 | var MobileIdentity mi; |
| 958 | var template octetstring id_enc; /* FIXME */ |
| 959 | var RSL_Message rx_rsl; |
| 960 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 961 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 962 | |
| 963 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 964 | |
| 965 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 966 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 967 | IPA_RSL[bts_ids[i]].clear; |
| 968 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 969 | |
| 970 | if (isvalue(rsl_chneed)) { |
| 971 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 972 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 973 | } else { |
| 974 | bssmap_chneed := omit; |
| 975 | } |
| 976 | |
| 977 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 978 | |
| 979 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
| 980 | if (isvalue(tmsi)) { |
| 981 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 982 | } else { |
| 983 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 984 | } |
| 985 | id_enc := enc_MobileIdentity(mi); |
| 986 | */ |
| 987 | id_enc := ?; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 988 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 989 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc)); |
| 990 | /* check channel type, paging group */ |
| 991 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 992 | setverdict(fail, "Paging for wrong paging group"); |
| 993 | } |
| 994 | if (ispresent(rsl_chneed) and |
| 995 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 996 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 997 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 998 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 999 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1000 | /* do a quick check on all not-included BTSs if they received paging */ |
| 1001 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1002 | timer T := 0.1; |
| 1003 | if (f_bts_in_list(i, bts_ids)) { |
| 1004 | continue; |
| 1005 | } |
| 1006 | T.start; |
| 1007 | alt { |
| 1008 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) { |
| 1009 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 1010 | } |
| 1011 | [] IPA_RSL[i].receive { repeat; } |
| 1012 | [] T.timeout { } |
| 1013 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1014 | } |
| 1015 | |
| 1016 | setverdict(pass); |
| 1017 | } |
| 1018 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1019 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1020 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1021 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 1022 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 1023 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1024 | /* PAGING by IMSI + TMSI */ |
| 1025 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 1026 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1027 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 1028 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1029 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | /* PAGING by IMSI + TMSI */ |
| 1033 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 1034 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1035 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1036 | 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] | 1037 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1038 | } |
| 1039 | |
| 1040 | /* Paging with different "channel needed' values */ |
| 1041 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 1042 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1043 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1044 | 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] | 1045 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1046 | } |
| 1047 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 1048 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1049 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1050 | 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] | 1051 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1052 | } |
| 1053 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 1054 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1055 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1056 | 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] | 1057 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1058 | } |
| 1059 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 1060 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1061 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1062 | 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] | 1063 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | /* Paging by CGI */ |
| 1067 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 1068 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1069 | 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] | 1070 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1071 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1072 | } |
| 1073 | |
| 1074 | /* Paging by LAC+CI */ |
| 1075 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 1076 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1077 | 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] | 1078 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1079 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | /* Paging by CI */ |
| 1083 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 1084 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1085 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1086 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1087 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1088 | } |
| 1089 | |
| 1090 | /* Paging by LAI */ |
| 1091 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 1092 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1093 | 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] | 1094 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1095 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1096 | } |
| 1097 | |
| 1098 | /* Paging by LAC */ |
| 1099 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 1100 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1101 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1102 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1103 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1104 | } |
| 1105 | |
| 1106 | /* Paging by "all in BSS" */ |
| 1107 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 1108 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1109 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1110 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1111 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1112 | } |
| 1113 | |
| 1114 | /* Paging by PLMN+LAC+RNC */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1115 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 1116 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1117 | cid_list := { cIl_PLMN_LAC_RNC := { ts_BSSMAP_CI_PLMN_LAC_RNC(cid.mcc, cid.mnc, cid.lac, 12) } }; |
Harald Welte | beb9dbc | 2018-01-31 15:56:00 +0100 | [diff] [blame] | 1118 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1119 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1120 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1121 | |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1122 | /* Paging by RNC */ |
| 1123 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 1124 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1125 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Harald Welte | beb9dbc | 2018-01-31 15:56:00 +0100 | [diff] [blame] | 1126 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1127 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1128 | } |
| 1129 | |
| 1130 | /* Paging by LAC+RNC */ |
| 1131 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 1132 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1133 | cid_list := { cIl_LAC_RNC := { ts_BSSMAP_CI_LAC_RNC(cid.lac, 14) } }; |
Harald Welte | beb9dbc | 2018-01-31 15:56:00 +0100 | [diff] [blame] | 1134 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1135 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1136 | } |
| 1137 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1138 | /* 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] | 1139 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 1140 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1141 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 1142 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1143 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1144 | } |
| 1145 | |
| 1146 | /* Paging on empty list: Verify none of them page */ |
| 1147 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 1148 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1149 | cid_list := { cIl_LAC := { } }; |
| 1150 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1151 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1152 | } |
| 1153 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1154 | /* Verify paging retransmission interval + count */ |
| 1155 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1156 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1157 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1158 | /* Verify PCH load */ |
| 1159 | testcase TC_paging_imsi_load() runs on test_CT { |
| 1160 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1161 | timer T := 4.0; |
| 1162 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1163 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1164 | |
| 1165 | /* tell BSC there is no paging space anymore */ |
| 1166 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 1167 | |
| 1168 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 1169 | * there would be 8 retransmissions during 4 seconds */ |
| 1170 | T.start; |
| 1171 | alt { |
| 1172 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1173 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
| 1174 | self.stop; |
| 1175 | } |
| 1176 | [] T.timeout { |
| 1177 | setverdict(pass); |
| 1178 | } |
| 1179 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1180 | |
| 1181 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1182 | } |
| 1183 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1184 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1185 | testcase TC_paging_counter() runs on test_CT { |
| 1186 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1187 | timer T := 4.0; |
| 1188 | var integer i; |
| 1189 | var integer paging_attempted_bsc; |
| 1190 | var integer paging_attempted_bts[NUM_BTS]; |
| 1191 | var integer paging_expired_bts[NUM_BTS]; |
| 1192 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 1193 | |
| 1194 | f_init(); |
| 1195 | |
| 1196 | /* read counters before paging */ |
| 1197 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 1198 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1199 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 1200 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 1201 | } |
| 1202 | |
| 1203 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 1204 | |
| 1205 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1206 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1207 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1208 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1209 | paging_attempted_bts[i]+1); |
| 1210 | } |
| 1211 | |
| 1212 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1213 | f_sleep(12.0); |
| 1214 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1215 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1216 | paging_expired_bts[i]+1); |
| 1217 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1218 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1219 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1220 | } |
| 1221 | |
| 1222 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1223 | /* Verify paging stops after A-RESET */ |
| 1224 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1225 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1226 | timer T := 3.0; |
| 1227 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1228 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1229 | |
| 1230 | /* Perform a BSSMAP Reset and wait for ACK */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1231 | 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] | 1232 | alt { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1233 | [] 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] | 1234 | [] BSSAP.receive { repeat; } |
| 1235 | } |
| 1236 | |
| 1237 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 1238 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 1239 | IPA_RSL[i].clear; |
| 1240 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1241 | |
| 1242 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1243 | T.start; |
| 1244 | alt { |
| 1245 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1246 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1247 | self.stop; |
| 1248 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1249 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1250 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1251 | self.stop; |
| 1252 | } |
| 1253 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1254 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1255 | self.stop; |
| 1256 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1257 | [] T.timeout { |
| 1258 | setverdict(pass); |
| 1259 | } |
| 1260 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1261 | |
| 1262 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1263 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1264 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1265 | /* Test RSL link drop causes counter increment */ |
| 1266 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1267 | var integer rsl_fail; |
| 1268 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1269 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1270 | |
| 1271 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1272 | |
| 1273 | bts[0].rsl.vc_IPA.stop; |
| 1274 | |
| 1275 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1276 | |
| 1277 | setverdict(pass); |
| 1278 | } |
| 1279 | |
| 1280 | /* TODO: Test OML link drop causes counter increment */ |
| 1281 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1282 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 1283 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 1284 | timer T := 10.0; |
| 1285 | |
| 1286 | bts[0].rsl.id := "IPA-0-RSL"; |
| 1287 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 1288 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 1289 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 1290 | bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at BTS */ |
| 1291 | |
| 1292 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 1293 | * MSC-side BSSAP emulation */ |
| 1294 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
| 1295 | |
| 1296 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 1297 | |
| 1298 | f_init_mgcp("VirtMSC"); |
| 1299 | |
| 1300 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 1301 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 1302 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 1303 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 1304 | |
| 1305 | /* wait for IPA OML link to connect and then disconnect */ |
| 1306 | T.start; |
| 1307 | alt { |
| 1308 | [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) { |
| 1309 | T.stop; |
| 1310 | return true; |
| 1311 | } |
| 1312 | [] IPA_RSL[0].receive { repeat } |
| 1313 | [] T.timeout { |
| 1314 | self.stop; |
| 1315 | return false; |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | return false; |
| 1320 | } |
| 1321 | |
| 1322 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1323 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 1324 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 1325 | setverdict(pass); |
| 1326 | } else { |
| 1327 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | |
| 1332 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1333 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 1334 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 1335 | setverdict(pass); |
| 1336 | } else { |
| 1337 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1342 | /*********************************************************************** |
| 1343 | * "New world" test cases using RSL_Emulation + BSSMAP_Emulation |
| 1344 | ***********************************************************************/ |
| 1345 | |
| 1346 | import from BSSMAP_Emulation all; |
| 1347 | import from RSL_Emulation all; |
| 1348 | import from MSC_ConnectionHandler all; |
| 1349 | |
| 1350 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 1351 | |
| 1352 | /* helper function to create, connect and start a MSC_ConnHdlr component */ |
| 1353 | function f_start_handler(void_fn fn, charstring id) runs on test_CT return MSC_ConnHdlr { |
| 1354 | var MSC_ConnHdlr vc_conn; |
| 1355 | |
| 1356 | vc_conn := MSC_ConnHdlr.create(id); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1357 | connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1358 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1359 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 1360 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 1361 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 1362 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 1363 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 1364 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1365 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1366 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1367 | vc_conn.start(derefers(fn)(id)); |
| 1368 | return vc_conn; |
| 1369 | } |
| 1370 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1371 | private function f_tc_assignment_fr_a5_0(charstring id) runs on MSC_ConnHdlr { |
| 1372 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1373 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 1374 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1375 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1376 | const OCT8 kc := '0001020304050607'O; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1377 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1378 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1379 | 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] | 1380 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1381 | f_establish_fully(pars, ass_cmd, exp_compl); |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 1382 | f_cipher_mode('01'O, kc); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1383 | } |
| 1384 | |
| 1385 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 1386 | var MSC_ConnHdlr vc_conn; |
| 1387 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1388 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1389 | f_sleep(1.0); |
| 1390 | |
| 1391 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_0), testcasename()); |
| 1392 | vc_conn.done; |
| 1393 | } |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | private function f_tc_assignment_fr_a5_1(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1398 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1399 | |
| 1400 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 1401 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1402 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1403 | const OCT8 kc := '0001020304050607'O; |
| 1404 | |
| 1405 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1406 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1407 | |
| 1408 | f_establish_fully(pars, ass_cmd, exp_compl); |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 1409 | f_cipher_mode('02'O, kc); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1410 | } |
| 1411 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1412 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1413 | var MSC_ConnHdlr vc_conn; |
| 1414 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1415 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1416 | f_sleep(1.0); |
| 1417 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1418 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_1), testcasename()); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1419 | vc_conn.done; |
| 1420 | } |
| 1421 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1422 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 1423 | private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr { |
| 1424 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1425 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 1426 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1427 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1428 | const OCT8 kc := '0001020304050607'O; |
| 1429 | |
| 1430 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1431 | f_establish_fully(pars, ass_cmd, exp_fail); |
| 1432 | } |
| 1433 | |
| 1434 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 1435 | var MSC_ConnHdlr vc_conn; |
| 1436 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1437 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1438 | f_sleep(1.0); |
| 1439 | |
| 1440 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_1_codec_missing), testcasename()); |
| 1441 | vc_conn.done; |
| 1442 | } |
| 1443 | |
| 1444 | |
| 1445 | private function f_tc_assignment_fr_a5_3(charstring id ) runs on MSC_ConnHdlr { |
| 1446 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1447 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 1448 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1449 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1450 | const OCT8 kc := '0001020304050607'O; |
| 1451 | |
| 1452 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1453 | 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] | 1454 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1455 | f_establish_fully(pars, ass_cmd, exp_compl); |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 1456 | f_cipher_mode('08'O, kc); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1457 | } |
| 1458 | |
| 1459 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 1460 | var MSC_ConnHdlr vc_conn; |
| 1461 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1462 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1463 | f_sleep(1.0); |
| 1464 | |
| 1465 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_3), testcasename()); |
| 1466 | vc_conn.done; |
| 1467 | } |
| 1468 | |
| 1469 | |
| 1470 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
| 1471 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1472 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1473 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1474 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1475 | const OCT8 kc := '0001020304050607'O; |
| 1476 | const OCT16 kc128 := kc & kc; |
| 1477 | |
| 1478 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1479 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1480 | f_establish_fully(pars, ass_cmd, exp_compl); |
| 1481 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1482 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1483 | } |
| 1484 | |
| 1485 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 1486 | var MSC_ConnHdlr vc_conn; |
| 1487 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1488 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1489 | f_sleep(1.0); |
| 1490 | |
| 1491 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4), testcasename()); |
| 1492 | vc_conn.done; |
| 1493 | } |
| 1494 | |
| 1495 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1496 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
| 1497 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1498 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
| 1499 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, omit)); |
| 1500 | |
| 1501 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
| 1502 | f_establish_fully(pars, ass_cmd, exp_compl); |
| 1503 | } |
| 1504 | |
| 1505 | testcase TC_assignment_sign() runs on test_CT { |
| 1506 | var MSC_ConnHdlr vc_conn; |
| 1507 | |
| 1508 | f_init(1, true); |
| 1509 | f_sleep(1.0); |
| 1510 | |
| 1511 | vc_conn := f_start_handler(refers(f_tc_assignment_sign), testcasename()); |
| 1512 | vc_conn.done; |
| 1513 | } |
| 1514 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1515 | /* test if L3 RR CLASSMARK CHANGE is translated to BSSMAP CLASSMARK UPDATE */ |
| 1516 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
| 1517 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1518 | f_create_chan_and_exp(pars); |
| 1519 | /* we should now have a COMPL_L3 at the MSC */ |
| 1520 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1521 | |
| 1522 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 1523 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 1524 | setverdict(pass); |
| 1525 | } |
| 1526 | testcase TC_classmark() runs on test_CT { |
| 1527 | var MSC_ConnHdlr vc_conn; |
| 1528 | f_init(1, true); |
| 1529 | f_sleep(1.0); |
| 1530 | vc_conn := f_start_handler(refers(f_tc_classmark), testcasename()); |
| 1531 | vc_conn.done; |
| 1532 | } |
| 1533 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1534 | private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1535 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1536 | f_create_chan_and_exp(pars); |
| 1537 | /* we should now have a COMPL_L3 at the MSC */ |
| 1538 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1539 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1540 | /* send the single message we want to send */ |
| 1541 | f_rsl_send_l3(l3); |
| 1542 | } |
| 1543 | |
| 1544 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 1545 | timer T := sec; |
| 1546 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1547 | T.start; |
| 1548 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1549 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 1550 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
| 1551 | self.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1552 | } |
| 1553 | [] T.timeout { |
| 1554 | setverdict(pass); |
| 1555 | } |
| 1556 | } |
| 1557 | } |
| 1558 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1559 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 1560 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 1561 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 1562 | f_bssap_expect_nothing(); |
| 1563 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1564 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 1565 | var MSC_ConnHdlr vc_conn; |
| 1566 | f_init(1, true); |
| 1567 | f_sleep(1.0); |
| 1568 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail), testcasename()); |
| 1569 | vc_conn.done; |
| 1570 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1571 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 1572 | |
| 1573 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 1574 | 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] | 1575 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 1576 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 1577 | } |
| 1578 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 1579 | var MSC_ConnHdlr vc_conn; |
| 1580 | f_init(1, true); |
| 1581 | f_sleep(1.0); |
| 1582 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl), testcasename()); |
| 1583 | vc_conn.done; |
| 1584 | } |
| 1585 | |
| 1586 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 1587 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 1588 | 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] | 1589 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 1590 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 1591 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 1592 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 1593 | var MSC_ConnHdlr vc_conn; |
| 1594 | f_init(1, true); |
| 1595 | f_sleep(1.0); |
| 1596 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail), testcasename()); |
| 1597 | vc_conn.done; |
| 1598 | } |
| 1599 | |
| 1600 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1601 | /* short message from MS should be ignored */ |
| 1602 | private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr { |
| 1603 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1604 | f_create_chan_and_exp(pars); |
| 1605 | /* we should now have a COMPL_L3 at the MSC */ |
| 1606 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1607 | |
| 1608 | /* send short message */ |
| 1609 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 1610 | f_bssap_expect_nothing(); |
| 1611 | } |
| 1612 | testcase TC_err_82_short_msg() runs on test_CT { |
| 1613 | var MSC_ConnHdlr vc_conn; |
| 1614 | f_init(1, true); |
| 1615 | f_sleep(1.0); |
| 1616 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg), testcasename()); |
| 1617 | vc_conn.done; |
| 1618 | } |
| 1619 | |
| 1620 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 1621 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 1622 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 1623 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 1624 | timer T := 3.0 |
| 1625 | alt { |
| 1626 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 1627 | setverdict(pass); |
| 1628 | } |
| 1629 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
| 1630 | [] T.timeout { setverdict(inconc); } |
| 1631 | } |
| 1632 | } |
| 1633 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 1634 | var MSC_ConnHdlr vc_conn; |
| 1635 | f_init(1, true); |
| 1636 | f_sleep(1.0); |
| 1637 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg), testcasename()); |
| 1638 | vc_conn.done; |
| 1639 | } |
| 1640 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 1641 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
| 1642 | private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr) |
| 1643 | runs on MSC_ConnHdlr { |
| 1644 | /* FIXME: resolve those from component-global state */ |
| 1645 | var integer ts_nr := chan_nr.tn; |
| 1646 | var integer ss_nr; |
| 1647 | if (ischosen(chan_nr.u.ch0)) { |
| 1648 | ss_nr := 0; |
| 1649 | } else if (ischosen(chan_nr.u.lm)) { |
| 1650 | ss_nr := chan_nr.u.lm.sub_chan; |
| 1651 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 1652 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 1653 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 1654 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 1655 | } else { |
| 1656 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
| 1657 | self.stop; |
| 1658 | } |
| 1659 | |
| 1660 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 1661 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
| 1662 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 1663 | } |
| 1664 | |
| 1665 | private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr, |
| 1666 | integer new_bts_nr) |
| 1667 | runs on MSC_ConnHdlr { |
| 1668 | f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
| 1669 | } |
| 1670 | |
| 1671 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 1672 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
| 1673 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1674 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 1675 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1676 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1677 | const OCT8 kc := '0001020304050607'O; |
| 1678 | |
| 1679 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1680 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 1681 | |
| 1682 | f_establish_fully(pars, ass_cmd, exp_compl); |
| 1683 | |
| 1684 | var HandoverState hs := { |
| 1685 | rr_ho_cmpl_seen := false, |
| 1686 | handover_done := false, |
| 1687 | old_chan_nr := - |
| 1688 | }; |
| 1689 | /* issue hand-over command on VTY */ |
| 1690 | f_vty_handover(0, 0, g_chan_nr, 1); |
| 1691 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 1692 | f_rslem_suspend(RSL1_PROC); |
| 1693 | alt { |
| 1694 | [] as_handover(hs); |
| 1695 | /* FIXME: somehow determine that the hand-over has completed, by MGCP MDCX? */ |
| 1696 | } |
| 1697 | } |
| 1698 | |
| 1699 | testcase TC_ho_int() runs on test_CT { |
| 1700 | var MSC_ConnHdlr vc_conn; |
| 1701 | f_init(2, true); |
| 1702 | f_sleep(1.0); |
| 1703 | vc_conn := f_start_handler(refers(f_tc_ho_int), testcasename()); |
| 1704 | vc_conn.done; |
| 1705 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 1706 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame^] | 1707 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 1708 | * BSSMAP Reset just because of that. */ |
| 1709 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 1710 | var default d; |
| 1711 | var integer i; |
| 1712 | var DchanTuple dt; |
| 1713 | |
| 1714 | f_init(); |
| 1715 | |
| 1716 | /* Wait for initial BSSMAP Reset to pass */ |
| 1717 | f_sleep(4.0); |
| 1718 | |
| 1719 | d := activate(no_bssmap_reset()); |
| 1720 | |
| 1721 | /* Setup up a number of connections and RLSD them again from the MSC |
| 1722 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 1723 | * Let's do it some more times for good measure. */ |
| 1724 | for (i := 0; i < 8; i := i+1) { |
| 1725 | /* Since we're doing a lot of runs, give each one a fresh |
| 1726 | * T_guard from the top. */ |
| 1727 | T_guard.start; |
| 1728 | |
| 1729 | /* Setup a BSSAP connection and clear it right away. This is |
| 1730 | * the MSC telling the BSC about a planned release, it's not an |
| 1731 | * erratic loss of a connection. */ |
| 1732 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1733 | |
| 1734 | /* MSC disconnects (RLSD). */ |
| 1735 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1736 | } |
| 1737 | |
| 1738 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 1739 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 1740 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 1741 | f_sleep(4.0); |
| 1742 | |
| 1743 | deactivate(d); |
| 1744 | f_shutdown_helper(); |
| 1745 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1746 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1747 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1748 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1749 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1750 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1751 | execute( TC_ctrl() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1752 | |
| 1753 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1754 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1755 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1756 | execute( TC_chan_act_ack_noest() ); |
| 1757 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 1758 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1759 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1760 | execute( TC_chan_exhaustion() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1761 | execute( TC_chan_rel_rll_rel_ind() ); |
| 1762 | execute( TC_chan_rel_conn_fail() ); |
| 1763 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1764 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1765 | execute( TC_chan_rel_a_reset() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1766 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1767 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1768 | |
| 1769 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1770 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1771 | execute( TC_assignment_csd() ); |
| 1772 | execute( TC_assignment_ctm() ); |
| 1773 | execute( TC_assignment_sign() ); |
| 1774 | execute( TC_assignment_fr_a5_0() ); |
| 1775 | execute( TC_assignment_fr_a5_1() ); |
Harald Welte | f1b64e2 | 2017-12-15 14:55:14 +0100 | [diff] [blame] | 1776 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1777 | execute( TC_assignment_fr_a5_3() ); |
| 1778 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1779 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1780 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1781 | execute( TC_rll_est_ind_inact_lchan() ); |
| 1782 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 1783 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 1784 | execute( TC_rll_est_ind_inval_sacch() ); |
| 1785 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1786 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1787 | execute( TC_paging_imsi_nochan() ); |
| 1788 | execute( TC_paging_tmsi_nochan() ); |
| 1789 | execute( TC_paging_tmsi_any() ); |
| 1790 | execute( TC_paging_tmsi_sdcch() ); |
| 1791 | execute( TC_paging_tmsi_tch_f() ); |
| 1792 | execute( TC_paging_tmsi_tch_hf() ); |
| 1793 | execute( TC_paging_imsi_nochan_cgi() ); |
| 1794 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 1795 | execute( TC_paging_imsi_nochan_ci() ); |
| 1796 | execute( TC_paging_imsi_nochan_lai() ); |
| 1797 | execute( TC_paging_imsi_nochan_lac() ); |
| 1798 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1799 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 1800 | execute( TC_paging_imsi_nochan_rnc() ); |
| 1801 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 1802 | execute( TC_paging_imsi_nochan_lacs() ); |
| 1803 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1804 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1805 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 1806 | execute( TC_paging_counter() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1807 | |
| 1808 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1809 | execute( TC_rsl_unknown_unit_id() ); |
| 1810 | |
| 1811 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1812 | |
| 1813 | execute( TC_classmark() ); |
| 1814 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 1815 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 1816 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1817 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 1818 | execute( TC_err_84_unknown_msg() ); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 1819 | execute( TC_ho_int() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame^] | 1820 | |
| 1821 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1822 | } |
| 1823 | |
| 1824 | } |