Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 1 | module MSC_Tests { |
| 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* Osmocom MSC test suite in in TTCN-3 |
| 4 | * (C) 2017-2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * (C) 2018-2019 sysmocom - s.f.m.c. GmbH |
| 6 | * (C) 2018-2019 Vadim Yanitskiy <axilirator@gmail.com> |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Released under the terms of GNU General Public License, Version 2 or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 13 | */ |
| 14 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 15 | friend module MSC_Tests_Iu; |
| 16 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 17 | import from General_Types all; |
| 18 | import from Osmocom_Types all; |
| 19 | |
| 20 | import from M3UA_Types all; |
| 21 | import from M3UA_Emulation all; |
| 22 | |
| 23 | import from MTP3asp_Types all; |
| 24 | import from MTP3asp_PortType all; |
| 25 | |
| 26 | import from SCCPasp_Types all; |
| 27 | import from SCCP_Types all; |
| 28 | import from SCCP_Emulation all; |
| 29 | |
| 30 | import from SCTPasp_Types all; |
| 31 | import from SCTPasp_PortType all; |
| 32 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 33 | import from Osmocom_CTRL_Functions all; |
| 34 | import from Osmocom_CTRL_Types all; |
| 35 | import from Osmocom_CTRL_Adapter all; |
| 36 | |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 37 | import from TELNETasp_PortType all; |
| 38 | import from Osmocom_VTY_Functions all; |
| 39 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 40 | import from MNCC_Emulation all; |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 41 | import from MNCC_Types all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 42 | |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 43 | import from MGCP_Emulation all; |
| 44 | import from MGCP_Types all; |
| 45 | import from MGCP_Templates all; |
| 46 | import from SDP_Types all; |
| 47 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 48 | import from GSUP_Emulation all; |
| 49 | import from GSUP_Types all; |
| 50 | import from IPA_Emulation all; |
| 51 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 52 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 53 | import from RAN_Adapter all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 54 | import from BSSAP_CodecPort all; |
| 55 | import from BSSMAP_Templates all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 56 | import from RAN_Emulation all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 57 | import from BSC_ConnectionHandler all; |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 58 | import from RANAP_Templates all; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 59 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 60 | import from SGsAP_Templates all; |
| 61 | import from SGsAP_Types all; |
| 62 | import from SGsAP_Emulation all; |
| 63 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 64 | import from MobileL3_Types all; |
| 65 | import from MobileL3_CommonIE_Types all; |
Vadim Yanitskiy | 103d09f | 2018-11-12 02:50:23 +0700 | [diff] [blame] | 66 | import from MobileL3_SMS_Types all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 67 | import from L3_Templates all; |
Harald Welte | 158a7ca | 2018-02-16 18:11:31 +0100 | [diff] [blame] | 68 | import from L3_Common all; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 69 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 70 | import from SMPP_Types all; |
| 71 | import from SMPP_Templates all; |
| 72 | import from SMPP_Emulation all; |
| 73 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 74 | import from SCCP_Templates all; |
| 75 | |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 76 | import from SS_Types all; |
| 77 | import from SS_Templates all; |
| 78 | import from USSD_Helpers all; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 79 | import from DNS_Helpers all; |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 80 | |
Philipp Maier | 948747b | 2019-04-02 15:22:33 +0200 | [diff] [blame] | 81 | import from TCCConversion_Functions all; |
| 82 | |
Harald Welte | 9b751a6 | 2019-04-14 17:39:29 +0200 | [diff] [blame] | 83 | const integer NUM_BSC := 3; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 84 | type record of RAN_Configuration RAN_Configurations; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 85 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 86 | /* Needed for SGsAP SMS */ |
| 87 | import from MobileL3_SMS_Types all; |
| 88 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 89 | type component MTC_CT extends CTRL_Adapter_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 90 | var boolean g_initialized := false; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 91 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 92 | var RAN_Adapter g_bssap[NUM_BSC]; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 93 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 94 | /* no 'adapter_CT' for MNCC or GSUP */ |
| 95 | var MNCC_Emulation_CT vc_MNCC; |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 96 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 97 | var GSUP_Emulation_CT vc_GSUP; |
| 98 | var IPA_Emulation_CT vc_GSUP_IPA; |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 99 | var SMPP_Emulation_CT vc_SMPP; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 100 | var SGsAP_Emulation_CT vc_SGsAP; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 101 | |
| 102 | /* only to get events from IPA underneath GSUP */ |
| 103 | port IPA_CTRL_PT GSUP_IPA_EVENT; |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 104 | /* VTY to MSC */ |
| 105 | port TELNETasp_PT MSCVTY; |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 106 | |
| 107 | /* A port to directly send BSSAP messages. This port is used for |
| 108 | * tests that require low level access to sen arbitrary BSSAP |
| 109 | * messages. Run f_init_bssap_direct() to connect and initialize */ |
| 110 | port BSSAP_CODEC_PT BSSAP_DIRECT; |
| 111 | |
| 112 | /* When BSSAP messages are directly sent, then the connection |
| 113 | * handler is not active, which means that also no guard timer is |
| 114 | * set up. The following timer will serve as a replacement */ |
| 115 | timer Tguard_direct := 60.0; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | modulepar { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 119 | /* remote parameters of IUT */ |
| 120 | charstring mp_msc_ip := "127.0.0.1"; |
| 121 | integer mp_msc_ctrl_port := 4255; |
| 122 | integer mp_msc_vty_port := 4254; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 123 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 124 | /* local parameters of emulated HLR */ |
Philipp Maier | 9b690e4 | 2018-12-21 11:50:03 +0100 | [diff] [blame] | 125 | boolean mp_mm_info := false; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 126 | charstring mp_hlr_ip := "127.0.0.1"; |
| 127 | integer mp_hlr_port := 4222; |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 128 | charstring mp_mgw_ip := "127.0.0.1"; |
| 129 | integer mp_mgw_port := 2427; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 130 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 131 | charstring mp_msc_mncc := "/tmp/mncc"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 132 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 133 | integer mp_msc_smpp_port := 2775; |
| 134 | charstring mp_smpp_system_id := "msc_tester"; |
| 135 | charstring mp_smpp_password := "osmocom1"; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 136 | charstring mp_mme_name := "mmec01.mmegi0001.mme.epc.mnc070.mcc901.3gppnetwork.org"; |
| 137 | charstring mp_vlr_name := "vlr.example.net"; |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 138 | |
Pau Espin Pedrol | 690d659 | 2019-05-31 17:56:32 +0200 | [diff] [blame] | 139 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 140 | unconditionally once new version of osmo-msc is released (current |
| 141 | version: 1.3.1) */ |
| 142 | boolean mp_enable_osmux_test := true; |
| 143 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 144 | RAN_Configurations mp_bssap_cfg := { |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 145 | { |
| 146 | sccp_service_type := "mtp3_itu", |
| 147 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 148 | own_pc := 185, |
| 149 | own_ssn := 254, |
| 150 | peer_pc := 187, |
| 151 | peer_ssn := 254, |
| 152 | sio := '83'O, |
| 153 | rctx := 0 |
| 154 | }, |
| 155 | { |
| 156 | sccp_service_type := "mtp3_itu", |
| 157 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 158 | own_pc := 186, |
| 159 | own_ssn := 254, |
| 160 | peer_pc := 187, |
| 161 | peer_ssn := 254, |
| 162 | sio := '83'O, |
| 163 | rctx := 1 |
| 164 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 165 | }; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 166 | } |
| 167 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 168 | /* altstep for the global guard timer (only used when BSSAP_DIRECT |
| 169 | * is used for communication */ |
| 170 | private altstep as_Tguard_direct() runs on MTC_CT { |
| 171 | [] Tguard_direct.timeout { |
| 172 | setverdict(fail, "Tguard timeout"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 173 | mtc.stop; |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 174 | } |
| 175 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 176 | |
Neels Hofmeyr | 2ca1ab4 | 2019-03-08 03:45:43 +0100 | [diff] [blame] | 177 | private altstep as_optional_cc_rel(CallParameters cpars, boolean respond := false) runs on BSC_ConnHdlr { |
| 178 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))) { |
| 179 | if (respond) { |
| 180 | var BIT1 tid_remote := '1'B; |
| 181 | if (cpars.mo_call) { |
| 182 | tid_remote := '0'B; |
| 183 | } |
| 184 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id, tid_remote))); |
| 185 | } |
| 186 | } |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 187 | } |
| 188 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 189 | function f_init_smpp(charstring id) runs on MTC_CT { |
| 190 | id := id & "-SMPP"; |
| 191 | var EsmePars pars := { |
| 192 | mode := MODE_TRANSCEIVER, |
| 193 | bind := { |
| 194 | system_id := mp_smpp_system_id, |
| 195 | password := mp_smpp_password, |
| 196 | system_type := "MSC_Tests", |
| 197 | interface_version := hex2int('34'H), |
| 198 | addr_ton := unknown, |
| 199 | addr_npi := unknown, |
| 200 | address_range := "" |
| 201 | }, |
| 202 | esme_role := true |
| 203 | } |
| 204 | |
| 205 | vc_SMPP := SMPP_Emulation_CT.create(id); |
| 206 | map(vc_SMPP:SMPP_PORT, system:SMPP_PORT); |
| 207 | vc_SMPP.start(SMPP_Emulation.main_client(pars, mp_msc_ip, mp_msc_smpp_port, "", -1)); |
| 208 | } |
| 209 | |
| 210 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 211 | function f_init_mncc(charstring id) runs on MTC_CT { |
| 212 | id := id & "-MNCC"; |
| 213 | var MnccOps ops := { |
| 214 | create_cb := refers(MNCC_Emulation.ExpectedCreateCallback), |
| 215 | unitdata_cb := refers(MNCC_Emulation.DummyUnitdataCallback) |
| 216 | } |
| 217 | |
| 218 | vc_MNCC := MNCC_Emulation_CT.create(id); |
| 219 | map(vc_MNCC:MNCC, system:MNCC_CODEC_PT); |
| 220 | vc_MNCC.start(MNCC_Emulation.main(ops, id, mp_msc_mncc)); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 221 | } |
| 222 | |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 223 | function f_init_mgcp(charstring id) runs on MTC_CT { |
| 224 | id := id & "-MGCP"; |
| 225 | var MGCPOps ops := { |
| 226 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 227 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 228 | } |
| 229 | var MGCP_conn_parameters pars := { |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 230 | callagent_ip := mp_msc_ip, |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 231 | callagent_udp_port := -1, |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 232 | mgw_ip := mp_mgw_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 233 | mgw_udp_port := mp_mgw_port, |
| 234 | multi_conn_mode := false |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 238 | map(vc_MGCP:MGCP, system:MGCP_CODEC_PT); |
| 239 | vc_MGCP.start(MGCP_Emulation.main(ops, pars, id)); |
| 240 | } |
| 241 | |
Philipp Maier | c09a131 | 2019-04-09 16:05:26 +0200 | [diff] [blame] | 242 | function ForwardUnitdataCallback(PDU_SGsAP msg) |
| 243 | runs on SGsAP_Emulation_CT return template PDU_SGsAP { |
| 244 | SGsAP_CLIENT.send(msg); |
| 245 | return omit; |
| 246 | } |
| 247 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 248 | function f_init_sgsap(charstring id) runs on MTC_CT { |
| 249 | id := id & "-SGsAP"; |
| 250 | var SGsAPOps ops := { |
| 251 | create_cb := refers(SGsAP_Emulation.ExpectedCreateCallback), |
Philipp Maier | c09a131 | 2019-04-09 16:05:26 +0200 | [diff] [blame] | 252 | unitdata_cb := refers(ForwardUnitdataCallback) |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 253 | } |
| 254 | var SGsAP_conn_parameters pars := { |
| 255 | remote_ip := mp_msc_ip, |
| 256 | remote_sctp_port := 29118, |
| 257 | local_ip := "", |
| 258 | local_sctp_port := -1 |
| 259 | } |
| 260 | |
| 261 | vc_SGsAP := SGsAP_Emulation_CT.create(id); |
| 262 | map(vc_SGsAP:SGsAP, system:SGsAP_CODEC_PT); |
| 263 | vc_SGsAP.start(SGsAP_Emulation.main(ops, pars, id)); |
| 264 | } |
| 265 | |
| 266 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 267 | function f_init_gsup(charstring id) runs on MTC_CT { |
| 268 | id := id & "-GSUP"; |
| 269 | var GsupOps ops := { |
| 270 | create_cb := refers(GSUP_Emulation.ExpectedCreateCallback) |
| 271 | } |
| 272 | |
| 273 | vc_GSUP_IPA := IPA_Emulation_CT.create(id & "-IPA"); |
| 274 | vc_GSUP := GSUP_Emulation_CT.create(id); |
| 275 | |
| 276 | map(vc_GSUP_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 277 | connect(vc_GSUP:GSUP, vc_GSUP_IPA:IPA_GSUP_PORT); |
| 278 | /* we use this hack to get events like ASP_IPA_EVENT_UP */ |
| 279 | connect(vc_GSUP_IPA:IPA_CTRL_PORT, self:GSUP_IPA_EVENT); |
| 280 | |
| 281 | vc_GSUP.start(GSUP_Emulation.main(ops, id)); |
| 282 | vc_GSUP_IPA.start(IPA_Emulation.main_server(mp_hlr_ip, mp_hlr_port)); |
| 283 | |
| 284 | /* wait for incoming connection to GSUP port before proceeding */ |
| 285 | timer T := 10.0; |
| 286 | T.start; |
| 287 | alt { |
| 288 | [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { } |
| 289 | [] T.timeout { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 290 | setverdict(fail, "No connection to GSUP Port"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 291 | mtc.stop |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 292 | } |
| 293 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 294 | } |
| 295 | |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 296 | function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := true, boolean osmux := false) runs on MTC_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 297 | |
| 298 | if (g_initialized == true) { |
| 299 | return; |
| 300 | } |
| 301 | g_initialized := true; |
| 302 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 303 | if (num_bsc > NUM_BSC) { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 304 | testcase.stop("excess number of BSC instances requested"); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | for (var integer i := 0; i < num_bsc; i := i + 1) { |
| 308 | if (isbound(mp_bssap_cfg[i])) { |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 309 | var RanOps ranops := BSC_RanOps; |
| 310 | ranops.use_osmux := osmux; |
| 311 | f_ran_adapter_init(g_bssap[i], mp_bssap_cfg[i], "MSC_Test_" & int2str(i), ranops); |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 312 | f_ran_adapter_start(g_bssap[i]); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 313 | } else { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 314 | testcase.stop("missing BSSAP configuration"); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 315 | } |
| 316 | } |
| 317 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 318 | f_ipa_ctrl_start(mp_msc_ip, mp_msc_ctrl_port); |
| 319 | f_init_mncc("MSC_Test"); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 320 | f_init_mgcp("MSC_Test"); |
Philipp Maier | c09a131 | 2019-04-09 16:05:26 +0200 | [diff] [blame] | 321 | |
| 322 | if (gsup == true) { |
| 323 | f_init_gsup("MSC_Test"); |
| 324 | } |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 325 | f_init_smpp("MSC_Test"); |
Philipp Maier | 5786548 | 2019-01-07 18:33:13 +0100 | [diff] [blame] | 326 | |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 327 | if (sgsap == true) { |
Philipp Maier | 5786548 | 2019-01-07 18:33:13 +0100 | [diff] [blame] | 328 | f_init_sgsap("MSC_Test"); |
| 329 | } |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 330 | |
| 331 | map(self:MSCVTY, system:MSCVTY); |
| 332 | f_vty_set_prompts(MSCVTY); |
| 333 | f_vty_transceive(MSCVTY, "enable"); |
Harald Welte | b14c77a | 2018-01-25 17:25:44 +0100 | [diff] [blame] | 334 | |
| 335 | /* set some defaults */ |
| 336 | f_vty_config(MSCVTY, "network", "authentication optional"); |
| 337 | f_vty_config(MSCVTY, "msc", "assign-tmsi"); |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 338 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 0"); |
Harald Welte | b14c77a | 2018-01-25 17:25:44 +0100 | [diff] [blame] | 339 | f_vty_config(MSCVTY, "network", "encryption a5 0"); |
Pau Espin Pedrol | 690d659 | 2019-05-31 17:56:32 +0200 | [diff] [blame] | 340 | if (mp_enable_osmux_test) { |
| 341 | if (osmux) { |
| 342 | f_vty_config(MSCVTY, "msc", "osmux on"); |
| 343 | } else { |
| 344 | f_vty_config(MSCVTY, "msc", "osmux off"); |
| 345 | } |
Pau Espin Pedrol | 3dd33bc | 2019-05-31 17:51:20 +0200 | [diff] [blame] | 346 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 347 | } |
| 348 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 349 | /* Initialize for a direct connection to BSSAP. This function is an alternative |
| 350 | * to f_init() when the high level functions of the BSC_ConnectionHandler are |
| 351 | * not needed. */ |
| 352 | function f_init_bssap_direct() runs on MTC_CT { |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 353 | f_ran_adapter_init(g_bssap[0], mp_bssap_cfg[0], "MSC_Test", omit); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 354 | connect(g_bssap[0].vc_SCCP:SCCP_SP_PORT, self:BSSAP_DIRECT); |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 355 | |
| 356 | /* Start guard timer and activate it as default */ |
| 357 | Tguard_direct.start |
| 358 | activate(as_Tguard_direct()); |
| 359 | } |
| 360 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 361 | type function void_fn(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 362 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 363 | /* FIXME: move into BSC_ConnectionHandler? */ |
Harald Welte | 9b751a6 | 2019-04-14 17:39:29 +0200 | [diff] [blame] | 364 | function f_init_pars(integer imsi_suffix, boolean sgsap := false, boolean gsup := true, integer ran_idx := 0, |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 365 | boolean ran_is_geran := true, boolean use_osmux := false) |
Harald Welte | f9abf8d | 2019-04-21 13:07:17 +0200 | [diff] [blame] | 366 | runs on MTC_CT return BSC_ConnHdlrPars { |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 367 | var BSC_ConnHdlrNetworkPars net_pars := { |
| 368 | kc_support := '0A'O, /* A5/1 and A5/3 enabled */ |
| 369 | expect_tmsi := true, |
| 370 | expect_auth := false, |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 371 | expect_ciph := false, |
| 372 | expect_imei := false, |
| 373 | expect_imei_early := false, |
| 374 | check_imei_result := OSMO_GSUP_IMEI_RESULT_ACK, |
| 375 | check_imei_error := false |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 376 | }; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 377 | var BSC_ConnHdlrPars pars := { |
Harald Welte | f9abf8d | 2019-04-21 13:07:17 +0200 | [diff] [blame] | 378 | sccp_addr_own := g_bssap[ran_idx].sccp_addr_own, |
| 379 | sccp_addr_peer := g_bssap[ran_idx].sccp_addr_peer, |
Harald Welte | edbab81 | 2018-03-18 16:02:25 +0100 | [diff] [blame] | 380 | cell_id := valueof(ts_CellId_CGI('262'H, '42'H, 23, 42)), |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 381 | imei := f_gen_imei(imsi_suffix), |
| 382 | imsi := f_gen_imsi(imsi_suffix), |
| 383 | msisdn := f_gen_msisdn(imsi_suffix), |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 384 | tmsi := omit, |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 385 | cm1 := valueof(ts_CM1), |
Harald Welte | 8260057 | 2018-01-21 20:54:08 +0100 | [diff] [blame] | 386 | cm2 := valueof(ts_CM2_default), |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 387 | cm3 := omit, |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 388 | vec := omit, |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 389 | net := net_pars, |
Philipp Maier | aeb29a8 | 2018-11-08 17:40:53 +0100 | [diff] [blame] | 390 | send_early_cm := true, |
| 391 | ipa_ctrl_ip := mp_msc_ip, |
| 392 | ipa_ctrl_port := mp_msc_ctrl_port, |
Philipp Maier | 9b690e4 | 2018-12-21 11:50:03 +0100 | [diff] [blame] | 393 | ipa_ctrl_enable := true, |
Philipp Maier | 5786548 | 2019-01-07 18:33:13 +0100 | [diff] [blame] | 394 | mm_info := mp_mm_info, |
Philipp Maier | c09a131 | 2019-04-09 16:05:26 +0200 | [diff] [blame] | 395 | sgsap_enable := sgsap, |
Harald Welte | f9abf8d | 2019-04-21 13:07:17 +0200 | [diff] [blame] | 396 | gsup_enable := gsup, |
Harald Welte | c1f937a | 2019-04-21 21:19:23 +0200 | [diff] [blame] | 397 | ran_idx := ran_idx, |
Harald Welte | 9b751a6 | 2019-04-14 17:39:29 +0200 | [diff] [blame] | 398 | use_umts_aka := false, |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 399 | ran_is_geran := ran_is_geran, |
| 400 | use_osmux := use_osmux |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 401 | }; |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 402 | if (not ran_is_geran) { |
| 403 | pars.use_umts_aka := true; |
| 404 | pars.net.expect_auth := true; |
| 405 | } |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 406 | return pars; |
| 407 | } |
| 408 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 409 | function f_start_handler_with_pars(void_fn fn, BSC_ConnHdlrPars pars, integer bssap_idx := 0) runs on MTC_CT return BSC_ConnHdlr { |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 410 | var BSC_ConnHdlr vc_conn; |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 411 | var charstring id := testcasename() & int2str(bssap_idx); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 412 | |
| 413 | vc_conn := BSC_ConnHdlr.create(id); |
| 414 | /* BSSMAP part / A interface */ |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 415 | connect(vc_conn:BSSAP, g_bssap[pars.ran_idx + bssap_idx].vc_RAN:CLIENT); |
| 416 | connect(vc_conn:BSSAP_PROC, g_bssap[pars.ran_idx + bssap_idx].vc_RAN:PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 417 | /* MNCC part */ |
| 418 | connect(vc_conn:MNCC, vc_MNCC:MNCC_CLIENT); |
| 419 | connect(vc_conn:MNCC_PROC, vc_MNCC:MNCC_PROC); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 420 | /* MGCP part */ |
| 421 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 422 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 423 | /* GSUP part */ |
Philipp Maier | c09a131 | 2019-04-09 16:05:26 +0200 | [diff] [blame] | 424 | if (pars.gsup_enable == true) { |
| 425 | connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT); |
| 426 | connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC); |
| 427 | } |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 428 | /* SMPP part */ |
| 429 | connect(vc_conn:SMPP, vc_SMPP:SMPP_CLIENT); |
| 430 | connect(vc_conn:SMPP_PROC, vc_SMPP:SMPP_PROC); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 431 | /* SGs part */ |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 432 | if (pars.sgsap_enable == true) { |
Philipp Maier | 5786548 | 2019-01-07 18:33:13 +0100 | [diff] [blame] | 433 | connect(vc_conn:SGsAP, vc_SGsAP:SGsAP_CLIENT); |
| 434 | connect(vc_conn:SGsAP_PROC, vc_SGsAP:SGsAP_PROC); |
| 435 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 436 | |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 437 | /* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we cannot have |
| 438 | * a stand-alone 'derefers()' call, see https://www.eclipse.org/forums/index.php/t/1091364/ */ |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 439 | vc_conn.start(derefers(fn)(id, pars)); |
| 440 | return vc_conn; |
| 441 | } |
| 442 | |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 443 | function f_start_handler(void_fn fn, integer imsi_suffix, integer ran_idx := 0, boolean ran_is_geran := true, boolean use_osmux := false) |
Harald Welte | 9b751a6 | 2019-04-14 17:39:29 +0200 | [diff] [blame] | 444 | runs on MTC_CT return BSC_ConnHdlr { |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 445 | return f_start_handler_with_pars(fn, f_init_pars(imsi_suffix, ran_idx := ran_idx, ran_is_geran := ran_is_geran, use_osmux := use_osmux)); |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 446 | } |
| 447 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 448 | private function f_tc_lu_imsi_noauth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 449 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 450 | f_perform_lu(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 451 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 452 | testcase TC_lu_imsi_noauth_tmsi() runs on MTC_CT { |
| 453 | var BSC_ConnHdlr vc_conn; |
| 454 | f_init(); |
| 455 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 456 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_tmsi), 1); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 457 | vc_conn.done; |
| 458 | } |
| 459 | |
| 460 | private function f_tc_lu_imsi_noauth_notmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 461 | pars.net.expect_tmsi := false; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 462 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 463 | f_perform_lu(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 464 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 465 | testcase TC_lu_imsi_noauth_notmsi() runs on MTC_CT { |
| 466 | var BSC_ConnHdlr vc_conn; |
| 467 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 468 | f_vty_config(MSCVTY, "msc", "no assign-tmsi"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 469 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 470 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_notmsi), 2); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 471 | vc_conn.done; |
| 472 | } |
| 473 | |
| 474 | /* Do LU by IMSI, refuse it on GSUP and expect LU REJ back to MS */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 475 | friend function f_tc_lu_imsi_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 476 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 477 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 478 | |
| 479 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 480 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | b781799 | 2019-05-09 13:15:39 +0200 | [diff] [blame] | 481 | f_mm_auth(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 482 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 483 | GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23)); |
| 484 | alt { |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 485 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej(int2oct(23,1)))) { |
| 486 | f_expect_clear(); |
| 487 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 488 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 489 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 490 | mtc.stop; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 491 | } |
| 492 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 493 | } |
| 494 | testcase TC_lu_imsi_reject() runs on MTC_CT { |
| 495 | var BSC_ConnHdlr vc_conn; |
| 496 | f_init(); |
| 497 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 498 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_reject), 3); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 499 | vc_conn.done; |
| 500 | } |
| 501 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 502 | |
| 503 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 504 | /* Do LU by IMSI, timeout on GSUP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 505 | friend function f_tc_lu_imsi_timeout_gsup(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 506 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 507 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 508 | |
| 509 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 510 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | b781799 | 2019-05-09 13:15:39 +0200 | [diff] [blame] | 511 | f_mm_auth(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 512 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 513 | /* Normally the HLR would need to respond here, but we decide to force a timeout here */ |
| 514 | alt { |
| 515 | /* FIXME: Expect specific reject cause */ |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 516 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 517 | f_expect_clear(); |
| 518 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 519 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 520 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 521 | mtc.stop; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 522 | } |
| 523 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 524 | } |
| 525 | testcase TC_lu_imsi_timeout_gsup() runs on MTC_CT { |
| 526 | var BSC_ConnHdlr vc_conn; |
| 527 | f_init(); |
| 528 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 529 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_timeout_gsup), 4); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 530 | vc_conn.done; |
| 531 | } |
| 532 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 533 | |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 534 | private function f_tc_lu_imsi_auth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 535 | pars.net.expect_auth := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 536 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 537 | f_perform_lu(); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 538 | } |
| 539 | testcase TC_lu_imsi_auth_tmsi() runs on MTC_CT { |
| 540 | var BSC_ConnHdlr vc_conn; |
| 541 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 542 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 543 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 544 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi), 5); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 545 | vc_conn.done; |
| 546 | } |
| 547 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 548 | |
| 549 | friend function f_tc_lu_imsi_auth3g_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | 8a397ae | 2019-04-21 22:03:37 +0200 | [diff] [blame] | 550 | pars.net.expect_auth := true; |
| 551 | pars.use_umts_aka := true; |
| 552 | f_init_handler(pars); |
| 553 | f_perform_lu(); |
| 554 | } |
| 555 | testcase TC_lu_imsi_auth3g_tmsi() runs on MTC_CT { |
| 556 | var BSC_ConnHdlr vc_conn; |
| 557 | f_init(); |
| 558 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 559 | |
| 560 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth3g_tmsi), 1005); |
| 561 | vc_conn.done; |
| 562 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 563 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 564 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 565 | /* Send CM SERVICE REQ for IMSI that has never performed LU before */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 566 | friend function f_tc_cmserv_imsi_unknown(charstring id, BSC_ConnHdlrPars pars) |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 567 | runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 568 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 569 | |
| 570 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | edbab81 | 2018-03-18 16:02:25 +0100 | [diff] [blame] | 571 | var BSSMAP_IE_CellIdentifier cell_id := valueof(ts_CellId_CGI('262'H, '42'H, 23, 42)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 572 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 573 | |
| 574 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 575 | |
| 576 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 577 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | b781799 | 2019-05-09 13:15:39 +0200 | [diff] [blame] | 578 | f_mm_auth(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 579 | |
| 580 | timer T := 10.0; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 581 | T.start; |
| 582 | alt { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 583 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 584 | //[] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC)) { } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 585 | [] BSSAP.receive { |
| 586 | setverdict(fail, "Received unexpected BSSAP"); |
| 587 | mtc.stop; |
| 588 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 589 | [] GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) { |
| 590 | setverdict(fail, "Unexpected GSUP UL REQ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 591 | mtc.stop; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 592 | } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 593 | [] T.timeout { |
| 594 | setverdict(fail, "Timeout waiting for CM SERV REQ"); |
| 595 | mtc.stop; |
| 596 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 597 | } |
| 598 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 599 | f_expect_clear(); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 600 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 601 | testcase TC_cmserv_imsi_unknown() runs on MTC_CT { |
| 602 | var BSC_ConnHdlr vc_conn; |
| 603 | f_init(); |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 604 | vc_conn := f_start_handler(refers(f_tc_cmserv_imsi_unknown), 6); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 605 | vc_conn.done; |
| 606 | } |
| 607 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 608 | |
| 609 | friend function f_tc_lu_and_mo_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 610 | f_init_handler(pars); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 611 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 612 | cpars.bss_rtp_port := 1110; |
| 613 | cpars.mgcp_connection_id_bss := '22222'H; |
| 614 | cpars.mgcp_connection_id_mss := '33333'H; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 615 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 616 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 617 | f_perform_lu(); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 618 | f_mo_call(cpars); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 619 | } |
| 620 | testcase TC_lu_and_mo_call() runs on MTC_CT { |
| 621 | var BSC_ConnHdlr vc_conn; |
| 622 | f_init(); |
| 623 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 624 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_call), 7); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 625 | vc_conn.done; |
| 626 | } |
| 627 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 628 | |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 629 | /* Test LU (with authentication enabled), where HLR times out sending SAI response */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 630 | friend function f_tc_lu_auth_sai_timeout(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 631 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 632 | |
| 633 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 634 | var PDU_DTAP_MT dtap_mt; |
| 635 | |
| 636 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 637 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 638 | |
| 639 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 640 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 641 | |
| 642 | /* Send Early Classmark, just for the fun of it */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 643 | if (pars.ran_is_geran) { |
| 644 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 645 | } |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 646 | |
| 647 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 648 | /* The HLR would normally return an auth vector here, but we fail to do so. */ |
| 649 | |
| 650 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 651 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 652 | } |
| 653 | testcase TC_lu_auth_sai_timeout() runs on MTC_CT { |
| 654 | var BSC_ConnHdlr vc_conn; |
| 655 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 656 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 657 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 658 | vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_timeout), 8); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 659 | vc_conn.done; |
| 660 | } |
| 661 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 662 | |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 663 | /* Test LU (with authentication enabled), where HLR rejects sending SAI error */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 664 | friend function f_tc_lu_auth_sai_err(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 665 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 666 | |
| 667 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 668 | var PDU_DTAP_MT dtap_mt; |
| 669 | |
| 670 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 671 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 672 | |
| 673 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 674 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 675 | |
| 676 | /* Send Early Classmark, just for the fun of it */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 677 | if (pars.ran_is_geran) { |
| 678 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 679 | } |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 680 | |
| 681 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 682 | GSUP.send(ts_GSUP_SAI_ERR(g_pars.imsi, 13)); |
| 683 | |
| 684 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 685 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 686 | } |
| 687 | testcase TC_lu_auth_sai_err() runs on MTC_CT { |
| 688 | var BSC_ConnHdlr vc_conn; |
| 689 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 690 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 691 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 692 | vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_err), 9); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 693 | vc_conn.done; |
| 694 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 695 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 696 | |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 697 | /* Test LU but BSC will send a clear request in the middle */ |
| 698 | private function f_tc_lu_clear_request(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 699 | f_init_handler(pars); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 700 | |
| 701 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 702 | var PDU_DTAP_MT dtap_mt; |
| 703 | |
| 704 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 705 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 706 | |
| 707 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 708 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 709 | |
| 710 | /* Send Early Classmark, just for the fun of it */ |
| 711 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 712 | |
| 713 | f_sleep(1.0); |
| 714 | /* send clear request in the middle of the LU */ |
| 715 | BSSAP.send(ts_BSSMAP_ClearRequest(0)); |
Neels Hofmeyr | 2b326fa | 2018-04-06 00:59:36 +0200 | [diff] [blame] | 716 | alt { |
| 717 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { repeat; } |
| 718 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) {} |
| 719 | } |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 720 | BSSAP.send(ts_BSSMAP_ClearComplete); |
Harald Welte | 89a3249 | 2018-01-27 19:07:28 +0100 | [diff] [blame] | 721 | alt { |
| 722 | /* See https://osmocom.org/issues/2862 */ |
Neels Hofmeyr | 2b326fa | 2018-04-06 00:59:36 +0200 | [diff] [blame] | 723 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 724 | setverdict(fail, "Got a second Clear Command, only one expected"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 725 | mtc.stop; |
Neels Hofmeyr | 2b326fa | 2018-04-06 00:59:36 +0200 | [diff] [blame] | 726 | repeat; |
| 727 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 728 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
Harald Welte | 89a3249 | 2018-01-27 19:07:28 +0100 | [diff] [blame] | 729 | } |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 730 | setverdict(pass); |
| 731 | } |
| 732 | testcase TC_lu_clear_request() runs on MTC_CT { |
| 733 | var BSC_ConnHdlr vc_conn; |
| 734 | f_init(); |
| 735 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 736 | vc_conn := f_start_handler(refers(f_tc_lu_clear_request), 10); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 737 | vc_conn.done; |
| 738 | } |
| 739 | |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 740 | /* Test LU but BSC will send a clear request in the middle */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 741 | friend function f_tc_lu_disconnect(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 742 | f_init_handler(pars); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 743 | |
| 744 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 745 | var PDU_DTAP_MT dtap_mt; |
| 746 | |
| 747 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 748 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 749 | |
| 750 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 751 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 752 | |
| 753 | /* Send Early Classmark, just for the fun of it */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 754 | if (pars.ran_is_geran) { |
| 755 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 756 | } |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 757 | |
| 758 | f_sleep(1.0); |
| 759 | /* send clear request in the middle of the LU */ |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 760 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 761 | setverdict(pass); |
Neels Hofmeyr | bb825c9 | 2019-03-06 15:35:50 +0100 | [diff] [blame] | 762 | f_sleep(1.0); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 763 | } |
| 764 | testcase TC_lu_disconnect() runs on MTC_CT { |
| 765 | var BSC_ConnHdlr vc_conn; |
| 766 | f_init(); |
| 767 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 768 | vc_conn := f_start_handler(refers(f_tc_lu_disconnect), 11); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 769 | vc_conn.done; |
| 770 | } |
| 771 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 772 | /* Test LU but with illegal mobile identity type = IMEI */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 773 | friend function f_tc_lu_by_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 774 | f_init_handler(pars); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 775 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 776 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imei(g_pars.imei) |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 777 | var PDU_DTAP_MT dtap_mt; |
| 778 | |
| 779 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 780 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 781 | |
| 782 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 783 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 784 | |
| 785 | /* Send Early Classmark, just for the fun of it */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 786 | if (pars.ran_is_geran) { |
| 787 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 788 | } |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 789 | /* wait for LU reject, ignore any ID REQ */ |
| 790 | alt { |
| 791 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 792 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req)) { repeat; } |
| 793 | } |
| 794 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 795 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 796 | } |
| 797 | testcase TC_lu_by_imei() runs on MTC_CT { |
| 798 | var BSC_ConnHdlr vc_conn; |
| 799 | f_init(); |
| 800 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 801 | vc_conn := f_start_handler(refers(f_tc_lu_by_imei), 12); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 802 | vc_conn.done; |
| 803 | } |
| 804 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 805 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 806 | /* Test LU by TMSI with unknown TMSI, expect (and answer) ID REQ. */ |
| 807 | private function f_tc_lu_tmsi_noauth_unknown(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Stefan Sperling | 04fc4bc | 2018-06-25 17:44:57 +0200 | [diff] [blame] | 808 | /* We piggyback a test for an MSC crash on overlong IMSI (OS#2864) onto this test. */ |
| 809 | var hexstring overlong_imsi := '012345789ABCDEF0123456789ABCDEF'H; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 810 | f_init_handler(pars); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 811 | |
| 812 | var PDU_ML3_MS_NW l3_lu := f_build_lu_tmsi('01020304'O); /* FIXME: Random */ |
| 813 | var PDU_DTAP_MT dtap_mt; |
| 814 | |
| 815 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 816 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 817 | |
| 818 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 819 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 820 | |
| 821 | /* Send Early Classmark, just for the fun of it */ |
| 822 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 823 | |
| 824 | /* Wait for + respond to ID REQ (IMSI) */ |
Oliver Smith | 3289845 | 2019-07-09 12:32:35 +0200 | [diff] [blame] | 825 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req(CM_ID_TYPE_IMSI))); |
Stefan Sperling | 04fc4bc | 2018-06-25 17:44:57 +0200 | [diff] [blame] | 826 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(overlong_imsi))); /* test for OS#2864 */ |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 827 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi))); |
| 828 | |
| 829 | /* Expect MSC to do UpdateLocation to HLR; respond to it */ |
| 830 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 831 | GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 832 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 833 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 834 | |
| 835 | alt { |
Harald Welte | 7ec4fa8 | 2018-01-27 10:57:40 +0100 | [diff] [blame] | 836 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 837 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl)); |
| 838 | } |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 839 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 840 | setverdict(fail, "Expected LU ACK, but received REJ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 841 | mtc.stop; |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 842 | } |
| 843 | } |
| 844 | |
Philipp Maier | 9b690e4 | 2018-12-21 11:50:03 +0100 | [diff] [blame] | 845 | /* Wait for MM-Information (if enabled) */ |
| 846 | f_expect_mm_info(); |
| 847 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 848 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 849 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 850 | } |
| 851 | testcase TC_lu_by_tmsi_noauth_unknown() runs on MTC_CT { |
| 852 | var BSC_ConnHdlr vc_conn; |
| 853 | f_init(); |
| 854 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 855 | vc_conn := f_start_handler(refers(f_tc_lu_tmsi_noauth_unknown), 13); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 856 | vc_conn.done; |
| 857 | } |
| 858 | |
| 859 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 860 | /* Test IMSI DETACH (MI=IMSI) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 861 | friend function f_tc_imsi_detach_by_imsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 862 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 863 | |
| 864 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 865 | |
| 866 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 867 | f_cl3_or_initial_ue(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 868 | |
| 869 | /* Send Early Classmark, just for the fun of it? */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 870 | if (pars.ran_is_geran) { |
| 871 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 872 | } |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 873 | |
| 874 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 875 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 876 | } |
| 877 | testcase TC_imsi_detach_by_imsi() runs on MTC_CT { |
| 878 | var BSC_ConnHdlr vc_conn; |
| 879 | f_init(); |
| 880 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 881 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imsi), 14); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 882 | vc_conn.done; |
| 883 | } |
| 884 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 885 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 886 | /* Test IMSI DETACH (MI=TMSI) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 887 | friend function f_tc_imsi_detach_by_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 888 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 889 | |
| 890 | var MobileIdentityLV mi := valueof(ts_MI_TMSI_LV('01020304'O)); |
| 891 | |
| 892 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 893 | f_cl3_or_initial_ue(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 894 | |
| 895 | /* Send Early Classmark, just for the fun of it? */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 896 | if (pars.ran_is_geran) { |
| 897 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 898 | } |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 899 | |
| 900 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 901 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 902 | } |
| 903 | testcase TC_imsi_detach_by_tmsi() runs on MTC_CT { |
| 904 | var BSC_ConnHdlr vc_conn; |
| 905 | f_init(); |
| 906 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 907 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_tmsi), 15); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 908 | vc_conn.done; |
| 909 | } |
| 910 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 911 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 912 | /* Test IMSI DETACH (MI=IMEI), which is illegal */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 913 | friend function f_tc_imsi_detach_by_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 914 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 915 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 916 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 917 | |
| 918 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 919 | f_cl3_or_initial_ue(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 920 | |
| 921 | /* Send Early Classmark, just for the fun of it? */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 922 | if (pars.ran_is_geran) { |
| 923 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 924 | } |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 925 | |
| 926 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 927 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 928 | } |
| 929 | testcase TC_imsi_detach_by_imei() runs on MTC_CT { |
| 930 | var BSC_ConnHdlr vc_conn; |
| 931 | f_init(); |
| 932 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 933 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imei), 16); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 934 | vc_conn.done; |
| 935 | } |
| 936 | |
| 937 | |
| 938 | /* helper function for an emergency call. caller passes in mobile identity to use */ |
| 939 | private function f_emerg_call(MobileIdentityLV mi) runs on BSC_ConnHdlr { |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 940 | var CallParameters cpars := valueof(t_CallParams('112'H, 0)); |
| 941 | cpars.emergency := true; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 942 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 943 | |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 944 | f_mo_call(cpars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 945 | } |
| 946 | |
| 947 | /* establish an emergency call by IMEI, no SIM inserted (and hence no IMSI) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 948 | friend function f_tc_emerg_call_imei_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 949 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 950 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 951 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 952 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_EMERG_CALL, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 953 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 954 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ('05'O))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 955 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 956 | } |
| 957 | testcase TC_emerg_call_imei_reject() runs on MTC_CT { |
| 958 | var BSC_ConnHdlr vc_conn; |
| 959 | f_init(); |
| 960 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 961 | vc_conn := f_start_handler(refers(f_tc_emerg_call_imei_reject), 17); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 962 | vc_conn.done; |
| 963 | } |
| 964 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 965 | |
Harald Welte | d5b9140 | 2018-01-24 18:48:16 +0100 | [diff] [blame] | 966 | /* establish an emergency call by IMSI, SIM inserted (and hence IMSI) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 967 | friend function f_tc_emerg_call_imsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 968 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 969 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 970 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 971 | /* Then issue emergency call identified by IMSI */ |
| 972 | f_emerg_call(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
| 973 | } |
| 974 | testcase TC_emerg_call_imsi() runs on MTC_CT { |
| 975 | var BSC_ConnHdlr vc_conn; |
| 976 | f_init(); |
| 977 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 978 | vc_conn := f_start_handler(refers(f_tc_emerg_call_imsi), 18); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 979 | vc_conn.done; |
| 980 | } |
| 981 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 982 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 983 | /* CM Service Request for VGCS -> reject */ |
| 984 | private function f_tc_cm_serv_req_vgcs_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 985 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 986 | |
| 987 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 988 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 989 | |
| 990 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 991 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VGCS, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 992 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 993 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ(int2oct(32,1)))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 994 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 995 | } |
| 996 | testcase TC_cm_serv_req_vgcs_reject() runs on MTC_CT { |
| 997 | var BSC_ConnHdlr vc_conn; |
| 998 | f_init(); |
| 999 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1000 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_vgcs_reject), 19); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1001 | vc_conn.done; |
| 1002 | } |
| 1003 | |
| 1004 | /* CM Service Request for VBS -> reject */ |
| 1005 | private function f_tc_cm_serv_req_vbs_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1006 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1007 | |
| 1008 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1009 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1010 | |
| 1011 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 1012 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VBS, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1013 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1014 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ(int2oct(32,1)))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1015 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1016 | } |
| 1017 | testcase TC_cm_serv_req_vbs_reject() runs on MTC_CT { |
| 1018 | var BSC_ConnHdlr vc_conn; |
| 1019 | f_init(); |
| 1020 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1021 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_vbs_reject), 20); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1022 | vc_conn.done; |
| 1023 | } |
| 1024 | |
| 1025 | /* CM Service Request for LCS -> reject */ |
| 1026 | private function f_tc_cm_serv_req_lcs_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1027 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1028 | |
| 1029 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1030 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1031 | |
| 1032 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 1033 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_LCS, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1034 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1035 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ(int2oct(32,1)))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1036 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1037 | } |
| 1038 | testcase TC_cm_serv_req_lcs_reject() runs on MTC_CT { |
| 1039 | var BSC_ConnHdlr vc_conn; |
| 1040 | f_init(); |
| 1041 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1042 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_lcs_reject), 21); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1043 | vc_conn.done; |
| 1044 | } |
| 1045 | |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1046 | /* CM Re-Establishment Request */ |
| 1047 | private function f_tc_cm_reest_req_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1048 | f_init_handler(pars); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1049 | |
| 1050 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1051 | f_perform_lu(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1052 | |
| 1053 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 1054 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REEST_REQ(0, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1055 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1056 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ(int2oct(32,1)))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1057 | f_expect_clear(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1058 | } |
| 1059 | testcase TC_cm_reest_req_reject() runs on MTC_CT { |
| 1060 | var BSC_ConnHdlr vc_conn; |
| 1061 | f_init(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1062 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1063 | vc_conn := f_start_handler(refers(f_tc_cm_reest_req_reject), 22); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1064 | vc_conn.done; |
| 1065 | } |
| 1066 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1067 | /* Test LU (with authentication enabled), with wrong response from MS */ |
| 1068 | private function f_tc_lu_auth_2G_fail(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1069 | f_init_handler(pars); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1070 | |
| 1071 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 1072 | |
| 1073 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 1074 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1075 | |
| 1076 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1077 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1078 | |
| 1079 | /* Send Early Classmark, just for the fun of it */ |
| 1080 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1081 | |
| 1082 | var AuthVector vec := f_gen_auth_vec_2g(); |
| 1083 | var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(vec.rand, vec.sres, vec.kc)); |
| 1084 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 1085 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 1086 | |
| 1087 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(vec.rand))); |
| 1088 | /* Send back wrong auth response */ |
| 1089 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G('00000000'O))); |
| 1090 | |
| 1091 | /* Expect GSUP AUTH FAIL REP to HLR */ |
| 1092 | GSUP.receive(tr_GSUP_AUTH_FAIL_IND(g_pars.imsi)); |
| 1093 | |
| 1094 | /* Expect LU REJECT with Cause == Illegal MS */ |
| 1095 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej('03'O))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1096 | f_expect_clear(); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1097 | } |
| 1098 | testcase TC_lu_auth_2G_fail() runs on MTC_CT { |
| 1099 | var BSC_ConnHdlr vc_conn; |
| 1100 | f_init(); |
| 1101 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1102 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1103 | vc_conn := f_start_handler(refers(f_tc_lu_auth_2G_fail), 23); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1104 | vc_conn.done; |
| 1105 | } |
| 1106 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1107 | /* A5/1 + A5/3 permitted on network side, and MS capable to do it */ |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1108 | private function f_tc_lu_imsi_auth_tmsi_encr_13_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1109 | pars.net.expect_auth := true; |
| 1110 | pars.net.expect_ciph := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1111 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1112 | f_perform_lu(); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1113 | } |
| 1114 | testcase TC_lu_imsi_auth_tmsi_encr_13_13() runs on MTC_CT { |
| 1115 | var BSC_ConnHdlr vc_conn; |
| 1116 | f_init(); |
| 1117 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1118 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 1119 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1120 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_13_13), 24); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1121 | vc_conn.done; |
| 1122 | } |
| 1123 | |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1124 | /* Test Complete L3 without payload */ |
| 1125 | private function f_tc_cl3_no_payload(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1126 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1127 | |
| 1128 | /* Send Complete L3 Info with empty L3 frame */ |
| 1129 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1130 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, ''O)))); |
| 1131 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1132 | timer T := 5.0; |
| 1133 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1134 | alt { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1135 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1136 | /* Expect LU REJECT with Cause == Illegal MS */ |
Harald Welte | bdb3c45 | 2018-03-18 22:43:06 +0100 | [diff] [blame] | 1137 | [] BSSAP.receive(tr_PDU_DTAP_MT(?)) { repeat; } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1138 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND) { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1139 | [] as_clear_cmd_compl_disc(); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1140 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1141 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1142 | mtc.stop; |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1143 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1144 | } |
| 1145 | setverdict(pass); |
| 1146 | } |
| 1147 | testcase TC_cl3_no_payload() runs on MTC_CT { |
| 1148 | var BSC_ConnHdlr vc_conn; |
| 1149 | f_init(); |
| 1150 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1151 | vc_conn := f_start_handler(refers(f_tc_cl3_no_payload), 25); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1152 | vc_conn.done; |
| 1153 | } |
| 1154 | |
| 1155 | /* Test Complete L3 with random payload */ |
| 1156 | private function f_tc_cl3_rnd_payload(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1157 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1158 | |
Daniel Willmann | aa14a38 | 2018-07-26 08:29:45 +0200 | [diff] [blame] | 1159 | /* length is limited by PDU_BSSAP length field which includes some |
| 1160 | * other fields beside l3info payload. So payl can only be 240 bytes |
| 1161 | * Since rnd() returns values < 1 multiply with 241 |
| 1162 | */ |
| 1163 | var integer len := float2int(rnd() * 241.0); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1164 | var octetstring payl := f_rnd_octstring(len); |
| 1165 | |
| 1166 | /* Send Complete L3 Info with empty L3 frame */ |
| 1167 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1168 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, payl)))); |
| 1169 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1170 | timer T := 5.0; |
| 1171 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1172 | alt { |
| 1173 | /* Immediate disconnect */ |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1174 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1175 | [] BSSAP.receive(tr_PDU_DTAP_MT(?)) { repeat; } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1176 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND) { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1177 | [] as_clear_cmd_compl_disc(); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1178 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1179 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1180 | mtc.stop; |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1181 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1182 | } |
| 1183 | setverdict(pass); |
| 1184 | } |
| 1185 | testcase TC_cl3_rnd_payload() runs on MTC_CT { |
| 1186 | var BSC_ConnHdlr vc_conn; |
| 1187 | f_init(); |
| 1188 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1189 | vc_conn := f_start_handler(refers(f_tc_cl3_rnd_payload), 26); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1190 | vc_conn.done; |
| 1191 | } |
| 1192 | |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1193 | /* Test Complete L3 with random payload */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1194 | friend function f_tc_establish_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1195 | f_init_handler(pars); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1196 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1197 | f_perform_lu(); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1198 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1199 | f_establish_fully(); |
Daniel Willmann | 898a7e0 | 2018-05-17 12:16:16 +0200 | [diff] [blame] | 1200 | f_expect_clear(10.0); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1201 | } |
| 1202 | testcase TC_establish_and_nothing() runs on MTC_CT { |
| 1203 | var BSC_ConnHdlr vc_conn; |
| 1204 | f_init(); |
| 1205 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1206 | vc_conn := f_start_handler(refers(f_tc_establish_and_nothing), 27); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1207 | vc_conn.done; |
| 1208 | } |
| 1209 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1210 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1211 | /* Test MO Call SETUP with no response from MNCC */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1212 | friend function f_tc_mo_setup_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Philipp Maier | 109e6aa | 2018-10-17 10:53:32 +0200 | [diff] [blame] | 1213 | f_init_handler(pars, 190.0); |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1214 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1215 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1216 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1217 | f_perform_lu(); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1218 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1219 | f_establish_fully(); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1220 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1221 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1222 | |
| 1223 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1224 | |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 1225 | var default ccrel := activate(as_optional_cc_rel(cpars)); |
| 1226 | |
Philipp Maier | 109e6aa | 2018-10-17 10:53:32 +0200 | [diff] [blame] | 1227 | f_expect_clear(185.0); |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 1228 | |
| 1229 | deactivate(ccrel); |
| 1230 | |
| 1231 | f_sleep(1.0); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1232 | } |
| 1233 | testcase TC_mo_setup_and_nothing() runs on MTC_CT { |
| 1234 | var BSC_ConnHdlr vc_conn; |
| 1235 | f_init(); |
| 1236 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1237 | vc_conn := f_start_handler(refers(f_tc_mo_setup_and_nothing), 28); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1238 | vc_conn.done; |
| 1239 | } |
| 1240 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1241 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1242 | /* Test MO Call with no response to RAN-side CRCX */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1243 | friend function f_tc_mo_crcx_ran_timeout(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1244 | f_init_handler(pars); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1245 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1246 | var MNCC_PDU mncc; |
| 1247 | var MgcpCommand mgcp_cmd; |
| 1248 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1249 | f_perform_lu(); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1250 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1251 | f_establish_fully(); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1252 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1253 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1254 | |
| 1255 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1256 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1257 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1258 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1259 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1260 | |
| 1261 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 1262 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1263 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1264 | /* never respond to this */ |
| 1265 | |
Philipp Maier | 8e58f59 | 2018-03-14 11:10:56 +0100 | [diff] [blame] | 1266 | /* When the connection with the MGW fails, the MSC will first request |
| 1267 | * a release via call control. We will answer this request normally. */ |
| 1268 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1269 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1270 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1271 | f_expect_clear(30.0); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1272 | } |
| 1273 | testcase TC_mo_crcx_ran_timeout() runs on MTC_CT { |
| 1274 | var BSC_ConnHdlr vc_conn; |
| 1275 | f_init(); |
| 1276 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1277 | vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_timeout), 29); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1278 | vc_conn.done; |
| 1279 | } |
| 1280 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1281 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1282 | /* Test MO Call with reject to RAN-side CRCX */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1283 | friend function f_tc_mo_crcx_ran_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1284 | f_init_handler(pars); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1285 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1286 | var MNCC_PDU mncc; |
| 1287 | var MgcpCommand mgcp_cmd; |
| 1288 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1289 | f_perform_lu(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1290 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1291 | f_establish_fully(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1292 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1293 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1294 | |
| 1295 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1296 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1297 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1298 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1299 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1300 | |
| 1301 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1302 | |
| 1303 | /* Detect if the received CRCX is a wildcarded CRCX request. If yes, |
| 1304 | * set an endpoint name that fits the pattern. If not, just use the |
| 1305 | * endpoint name from the request */ |
| 1306 | if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) { |
| 1307 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1308 | } else { |
| 1309 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1310 | } |
| 1311 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1312 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1313 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1314 | /* Respond to CRCX with error */ |
| 1315 | var MgcpResponse mgcp_rsp := { |
| 1316 | line := { |
| 1317 | code := "542", |
| 1318 | trans_id := mgcp_cmd.line.trans_id, |
| 1319 | string := "FORCED_FAIL" |
| 1320 | }, |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1321 | sdp := omit |
| 1322 | } |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1323 | var MgcpParameter mgcp_rsp_param := { |
| 1324 | code := "Z", |
| 1325 | val := cpars.mgcp_ep |
| 1326 | }; |
| 1327 | mgcp_rsp.params[0] := mgcp_rsp_param; |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1328 | MGCP.send(mgcp_rsp); |
| 1329 | |
| 1330 | timer T := 30.0; |
| 1331 | T.start; |
| 1332 | alt { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1333 | [] T.timeout { |
| 1334 | setverdict(fail, "Timeout waiting for channel release"); |
| 1335 | mtc.stop; |
| 1336 | } |
Daniel Willmann | 5868e62 | 2018-02-15 17:42:59 +0100 | [diff] [blame] | 1337 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))) { |
| 1338 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1339 | repeat; |
| 1340 | } |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1341 | [] MNCC.receive { repeat; } |
| 1342 | [] GSUP.receive { repeat; } |
Philipp Maier | c6e06f7 | 2018-04-11 18:12:23 +0200 | [diff] [blame] | 1343 | /* Note: As we did not respond properly to the CRCX from the MSC we |
| 1344 | * expect the MSC to omit any further MGCP operation (At least in the |
| 1345 | * the current implementation, there is no recovery mechanism implemented |
| 1346 | * and a DLCX can not be performed as the MSC does not know a specific |
| 1347 | * endpoint yet. */ |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1348 | [] MGCP.receive { |
| 1349 | setverdict(fail, "Unexpected MGCP message"); |
| 1350 | mtc.stop; |
| 1351 | } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1352 | [] as_clear_cmd_compl_disc(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1353 | } |
| 1354 | } |
| 1355 | testcase TC_mo_crcx_ran_reject() runs on MTC_CT { |
| 1356 | var BSC_ConnHdlr vc_conn; |
| 1357 | f_init(); |
| 1358 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1359 | vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_reject), 30); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1360 | vc_conn.done; |
| 1361 | } |
| 1362 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1363 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1364 | /* helper function to start a MT call: MNCC SETUP; Paging; DChan est.; DTAP SETUP */ |
| 1365 | private function f_mt_call_start(inout CallParameters cpars) runs on BSC_ConnHdlr { |
| 1366 | var MNCC_PDU mncc; |
| 1367 | var MgcpCommand mgcp_cmd; |
| 1368 | var OCT4 tmsi; |
| 1369 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1370 | f_perform_lu(); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1371 | if (isvalue(g_pars.tmsi)) { |
| 1372 | tmsi := g_pars.tmsi; |
| 1373 | } else { |
| 1374 | tmsi := 'FFFFFFFF'O; |
| 1375 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1376 | f_ran_register_imsi(g_pars.imsi, tmsi); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1377 | |
| 1378 | /* Allocate call reference and send SETUP via MNCC to MSC */ |
| 1379 | cpars.mncc_callref := f_rnd_int(2147483648); |
| 1380 | MNCC.send(ts_MNCC_SETUP_req(cpars.mncc_callref, hex2str(g_pars.msisdn), |
| 1381 | hex2str(cpars.called_party), hex2str(g_pars.imsi))); |
| 1382 | |
| 1383 | /* MSC->BSC: expect PAGING from MSC */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 1384 | f_expect_paging(); |
| 1385 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1386 | /* MS -> MSC: PAGING RESPONSE */ |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1387 | f_establish_fully(EST_TYPE_PAG_RESP); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1388 | |
| 1389 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1390 | |
| 1391 | /* MSC->MS: SETUP */ |
| 1392 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, *, cpars.called_party))); |
| 1393 | } |
| 1394 | |
| 1395 | /* Test MT Call */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1396 | friend function f_tc_mt_crcx_ran_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1397 | f_init_handler(pars); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1398 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1399 | var MNCC_PDU mncc; |
| 1400 | var MgcpCommand mgcp_cmd; |
| 1401 | |
| 1402 | f_mt_call_start(cpars); |
| 1403 | |
| 1404 | /* MS->MSC: CALL CONFIRMED */ |
| 1405 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1406 | |
| 1407 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1408 | |
| 1409 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1410 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1411 | |
| 1412 | /* Detect if the received CRCX is a wildcarded CRCX request. If yes, |
| 1413 | * set an endpoint name that fits the pattern. If not, just use the |
| 1414 | * endpoint name from the request */ |
| 1415 | if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) { |
| 1416 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1417 | } else { |
| 1418 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1419 | } |
| 1420 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1421 | /* Respond to CRCX with error */ |
| 1422 | var MgcpResponse mgcp_rsp := { |
| 1423 | line := { |
| 1424 | code := "542", |
| 1425 | trans_id := mgcp_cmd.line.trans_id, |
| 1426 | string := "FORCED_FAIL" |
| 1427 | }, |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1428 | sdp := omit |
| 1429 | } |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1430 | var MgcpParameter mgcp_rsp_param := { |
| 1431 | code := "Z", |
| 1432 | val := cpars.mgcp_ep |
| 1433 | }; |
| 1434 | mgcp_rsp.params[0] := mgcp_rsp_param; |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1435 | MGCP.send(mgcp_rsp); |
| 1436 | |
| 1437 | timer T := 30.0; |
| 1438 | T.start; |
| 1439 | alt { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1440 | [] T.timeout { |
| 1441 | setverdict(fail, "Timeout waiting for channel release"); |
| 1442 | mtc.stop; |
| 1443 | } |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1444 | [] MNCC.receive { repeat; } |
| 1445 | [] GSUP.receive { repeat; } |
| 1446 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1447 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1448 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1449 | repeat; |
| 1450 | } |
| 1451 | [] MGCP.receive { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1452 | [] as_clear_cmd_compl_disc(); |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 1453 | [] as_optional_cc_rel(cpars); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1454 | } |
| 1455 | } |
| 1456 | testcase TC_mt_crcx_ran_reject() runs on MTC_CT { |
| 1457 | var BSC_ConnHdlr vc_conn; |
| 1458 | f_init(); |
| 1459 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1460 | vc_conn := f_start_handler(refers(f_tc_mt_crcx_ran_reject), 31); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1461 | vc_conn.done; |
| 1462 | } |
| 1463 | |
| 1464 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1465 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1466 | /* Test MT Call T310 timer */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1467 | friend function f_tc_mt_t310(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | ad2952e | 2018-01-27 14:12:46 +0100 | [diff] [blame] | 1468 | f_init_handler(pars, 200.0); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1469 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1470 | var MNCC_PDU mncc; |
| 1471 | var MgcpCommand mgcp_cmd; |
| 1472 | |
| 1473 | f_mt_call_start(cpars); |
| 1474 | |
| 1475 | /* MS->MSC: CALL CONFIRMED */ |
| 1476 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1477 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1478 | |
| 1479 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1480 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1481 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1482 | /* FIXME: Respond to CRCX */ |
| 1483 | |
| 1484 | /* old libosmocore T310 default timeout is 180s. so let's wait 190 */ |
| 1485 | timer T := 190.0; |
| 1486 | T.start; |
| 1487 | alt { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1488 | [] T.timeout { |
| 1489 | setverdict(fail, "Timeout waiting for T310"); |
| 1490 | mtc.stop; |
| 1491 | } |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1492 | [] MNCC.receive(tr_MNCC_DISC_ind(cpars.mncc_callref)) { |
| 1493 | MNCC.send(ts_MNCC_REL_req(cpars.mncc_callref, valueof(ts_MNCC_cause(23)))); |
| 1494 | } |
| 1495 | } |
| 1496 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_DISC(cpars.transaction_id))); |
| 1497 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1498 | /* FIXME: We're sending this with TIflag 0: allocated by sender, which is wrong */ |
| 1499 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1500 | |
| 1501 | alt { |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1502 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1503 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1504 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1505 | repeat; |
| 1506 | } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1507 | [] as_clear_cmd_compl_disc(); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1508 | } |
| 1509 | } |
| 1510 | testcase TC_mt_t310() runs on MTC_CT { |
| 1511 | var BSC_ConnHdlr vc_conn; |
| 1512 | f_init(); |
| 1513 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1514 | vc_conn := f_start_handler(refers(f_tc_mt_t310), 32); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1515 | vc_conn.done; |
| 1516 | } |
| 1517 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1518 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1519 | /* Perform successful LU + MO call, then GSUP LocationCancel. Subscriber must be denied CM SERV */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1520 | friend function f_tc_gsup_cancel(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1521 | f_init_handler(pars); |
| 1522 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1523 | cpars.bss_rtp_port := 1110; |
| 1524 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1525 | cpars.mgcp_connection_id_mss := '33333'H; |
Daniel Willmann | 9b0235b | 2018-07-24 12:13:34 +0200 | [diff] [blame] | 1526 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1527 | |
| 1528 | /* Location Update to make subscriber known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1529 | f_perform_lu(); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1530 | |
| 1531 | /* First MO call should succeed */ |
| 1532 | f_mo_call(cpars); |
| 1533 | |
| 1534 | /* Cancel the subscriber in the VLR */ |
| 1535 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_WITHDRAW)); |
| 1536 | alt { |
| 1537 | [] GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)) { } |
| 1538 | [] GSUP.receive(tr_GSUP_CL_ERR(g_pars.imsi)) { |
| 1539 | setverdict(fail, "Received GSUP Location Cancel Error"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1540 | mtc.stop; |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1541 | } |
| 1542 | } |
| 1543 | |
| 1544 | /* Follow-up transactions should fail */ |
| 1545 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 1546 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1547 | f_cl3_or_initial_ue(l3_info); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1548 | alt { |
| 1549 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 1550 | [] BSSAP.receive { |
| 1551 | setverdict(fail, "Received unexpected BSSAP instead of CM SERV REJ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1552 | mtc.stop; |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1553 | } |
| 1554 | } |
Neels Hofmeyr | 0f7429a | 2019-03-07 22:28:41 +0100 | [diff] [blame] | 1555 | |
| 1556 | f_expect_clear(); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1557 | setverdict(pass); |
| 1558 | } |
| 1559 | testcase TC_gsup_cancel() runs on MTC_CT { |
| 1560 | var BSC_ConnHdlr vc_conn; |
| 1561 | f_init(); |
| 1562 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1563 | vc_conn := f_start_handler(refers(f_tc_gsup_cancel), 33); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1564 | vc_conn.done; |
| 1565 | } |
| 1566 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1567 | |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1568 | /* A5/1 only permitted on network side, and MS capable to do it */ |
| 1569 | private function f_tc_lu_imsi_auth_tmsi_encr_1_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1570 | pars.net.expect_auth := true; |
| 1571 | pars.net.expect_ciph := true; |
| 1572 | pars.net.kc_support := '02'O; /* A5/1 only */ |
| 1573 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1574 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1575 | } |
| 1576 | testcase TC_lu_imsi_auth_tmsi_encr_1_13() runs on MTC_CT { |
| 1577 | var BSC_ConnHdlr vc_conn; |
| 1578 | f_init(); |
| 1579 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1580 | f_vty_config(MSCVTY, "network", "encryption a5 1"); |
| 1581 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1582 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_1_13), 34); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1583 | vc_conn.done; |
| 1584 | } |
| 1585 | |
| 1586 | /* A5/3 only permitted on network side, and MS capable to do it */ |
| 1587 | private function f_tc_lu_imsi_auth_tmsi_encr_3_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1588 | pars.net.expect_auth := true; |
| 1589 | pars.net.expect_ciph := true; |
| 1590 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1591 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1592 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1593 | } |
| 1594 | testcase TC_lu_imsi_auth_tmsi_encr_3_13() runs on MTC_CT { |
| 1595 | var BSC_ConnHdlr vc_conn; |
| 1596 | f_init(); |
| 1597 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1598 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1599 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1600 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_13), 35); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1601 | vc_conn.done; |
| 1602 | } |
| 1603 | |
| 1604 | /* A5/3 only permitted on network side, and MS with only A5/1 support */ |
| 1605 | private function f_tc_lu_imsi_auth_tmsi_encr_3_1(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1606 | pars.net.expect_auth := true; |
| 1607 | pars.net.expect_ciph := true; |
| 1608 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1609 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1610 | f_init_handler(pars, 15.0); |
| 1611 | |
| 1612 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1613 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1614 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1615 | f_cl3_or_initial_ue(l3_lu); |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 1616 | if (pars.send_early_cm) { |
| 1617 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1618 | } else { |
| 1619 | pars.cm1.esind := '0'B; |
| 1620 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1621 | f_mm_auth(); |
| 1622 | alt { |
Daniel Willmann | 52918e5 | 2018-09-20 14:39:09 +0200 | [diff] [blame] | 1623 | [] BSSAP.receive(tr_BSSMAP_ClassmarkReq) { |
| 1624 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1625 | repeat; |
| 1626 | } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1627 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 1628 | f_expect_clear(); |
| 1629 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1630 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1631 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1632 | mtc.stop; |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1633 | } |
| 1634 | [] BSSAP.receive { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 1635 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1636 | mtc.stop; |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1637 | } |
| 1638 | } |
| 1639 | setverdict(pass); |
| 1640 | } |
| 1641 | testcase TC_lu_imsi_auth_tmsi_encr_3_1() runs on MTC_CT { |
| 1642 | var BSC_ConnHdlr vc_conn; |
| 1643 | f_init(); |
| 1644 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1645 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1646 | |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 1647 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), 360); |
| 1648 | vc_conn.done; |
| 1649 | } |
| 1650 | testcase TC_lu_imsi_auth_tmsi_encr_3_1_no_cm() runs on MTC_CT { |
| 1651 | var BSC_ConnHdlrPars pars; |
| 1652 | var BSC_ConnHdlr vc_conn; |
| 1653 | f_init(); |
| 1654 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1655 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1656 | |
| 1657 | pars := f_init_pars(361); |
| 1658 | pars.send_early_cm := false; |
| 1659 | vc_conn := f_start_handler_with_pars(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), pars); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1660 | vc_conn.done; |
| 1661 | } |
Neels Hofmeyr | 1b3c6e3 | 2018-03-01 17:52:21 +0100 | [diff] [blame] | 1662 | testcase TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() runs on MTC_CT { |
| 1663 | var BSC_ConnHdlr vc_conn; |
| 1664 | f_init(); |
| 1665 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1666 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1667 | |
| 1668 | /* Make sure the MSC category is on DEBUG level to trigger the log |
| 1669 | * message that is reported in OS#2947 to trigger the segfault */ |
| 1670 | f_vty_config(MSCVTY, "log stderr", "logging level msc debug"); |
| 1671 | |
| 1672 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), 362); |
| 1673 | vc_conn.done; |
| 1674 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1675 | |
| 1676 | /* A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1677 | private function f_tc_lu_imsi_auth_tmsi_encr_13_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1678 | pars.net.expect_auth := true; |
| 1679 | pars.net.expect_ciph := true; |
| 1680 | pars.net.kc_support := '0A'O; /* A5/1 + A5/3 */ |
| 1681 | pars.cm1.a5_1 := '1'B; |
| 1682 | pars.cm2.a5_1 := '1'B; |
| 1683 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1684 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1685 | f_init_handler(pars, 15.0); |
| 1686 | |
| 1687 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1688 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1689 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 1690 | f_cl3_or_initial_ue(l3_lu); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1691 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1692 | f_mm_auth(); |
| 1693 | alt { |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1694 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 1695 | f_expect_clear(); |
| 1696 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1697 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1698 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1699 | mtc.stop; |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1700 | } |
| 1701 | [] BSSAP.receive { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 1702 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1703 | mtc.stop; |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1704 | } |
| 1705 | } |
| 1706 | setverdict(pass); |
| 1707 | } |
| 1708 | testcase TC_lu_imsi_auth_tmsi_encr_13_2() runs on MTC_CT { |
| 1709 | var BSC_ConnHdlr vc_conn; |
| 1710 | f_init(); |
| 1711 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1712 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 1713 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1714 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_13_2), 37); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1715 | vc_conn.done; |
| 1716 | } |
| 1717 | |
| 1718 | /* A5/0 + A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1719 | private function f_tc_lu_imsi_auth_tmsi_encr_013_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1720 | pars.net.expect_auth := true; |
| 1721 | pars.net.expect_ciph := true; |
| 1722 | pars.net.kc_support := '0B'O; /* A5/1 + A5/3 */ |
| 1723 | pars.cm1.a5_1 := '1'B; |
| 1724 | pars.cm2.a5_1 := '1'B; |
| 1725 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1726 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1727 | f_init_handler(pars, 15.0); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1728 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1729 | } |
| 1730 | testcase TC_lu_imsi_auth_tmsi_encr_013_2() runs on MTC_CT { |
| 1731 | var BSC_ConnHdlr vc_conn; |
| 1732 | f_init(); |
| 1733 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1734 | f_vty_config(MSCVTY, "network", "encryption a5 0 1 3"); |
| 1735 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1736 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_013_2), 38); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1737 | vc_conn.done; |
| 1738 | } |
| 1739 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1740 | /* LU followed by MT call (including paging) */ |
| 1741 | private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1742 | f_init_handler(pars); |
Stefan Sperling | 26d57be | 2018-11-12 17:03:26 +0100 | [diff] [blame] | 1743 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1744 | cpars.bss_rtp_port := 1110; |
| 1745 | cpars.mgcp_connection_id_bss := '10004'H; |
| 1746 | cpars.mgcp_connection_id_mss := '10005'H; |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 1747 | cpars.use_osmux := pars.use_osmux; |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1748 | |
Philipp Maier | 4b2692d | 2018-03-14 16:37:48 +0100 | [diff] [blame] | 1749 | /* Note: This is an optional parameter. When the call-agent (MSC) does |
| 1750 | * supply a full endpoint name this setting will be overwritten. */ |
| 1751 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1752 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1753 | f_perform_lu(); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1754 | f_mt_call(cpars); |
| 1755 | } |
| 1756 | testcase TC_lu_and_mt_call() runs on MTC_CT { |
| 1757 | var BSC_ConnHdlr vc_conn; |
| 1758 | f_init(); |
| 1759 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1760 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call), 39); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1761 | vc_conn.done; |
| 1762 | } |
| 1763 | |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 1764 | testcase TC_lu_and_mt_call_osmux() runs on MTC_CT { |
| 1765 | var BSC_ConnHdlr vc_conn; |
| 1766 | f_init(1, false, true, true); |
Pau Espin Pedrol | a65697d | 2019-05-21 12:54:39 +0200 | [diff] [blame] | 1767 | |
| 1768 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call), 39, 0, true, true); |
| 1769 | vc_conn.done; |
| 1770 | } |
| 1771 | |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1772 | /* Test MO Call SETUP with DTMF */ |
| 1773 | private function f_tc_mo_setup_dtmf_dup(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1774 | f_init_handler(pars); |
| 1775 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1776 | cpars.bss_rtp_port := 1110; |
| 1777 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1778 | cpars.mgcp_connection_id_mss := '33333'H; |
| 1779 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1780 | f_perform_lu(); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1781 | f_mo_seq_dtmf_dup(cpars); |
| 1782 | } |
| 1783 | testcase TC_mo_setup_and_dtmf_dup() runs on MTC_CT { |
| 1784 | var BSC_ConnHdlr vc_conn; |
| 1785 | f_init(); |
| 1786 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1787 | vc_conn := f_start_handler(refers(f_tc_mo_setup_dtmf_dup), 39); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1788 | vc_conn.done; |
| 1789 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1790 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1791 | testcase TC_cr_before_reset() runs on MTC_CT { |
| 1792 | timer T := 4.0; |
| 1793 | var boolean reset_ack_seen := false; |
| 1794 | f_init_bssap_direct(); |
| 1795 | |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 1796 | f_ran_adapter_start(g_bssap[0]); |
Daniel Willmann | 42d1d5b | 2018-08-07 15:18:41 +0200 | [diff] [blame] | 1797 | |
Daniel Willmann | e801896 | 2018-08-21 14:18:00 +0200 | [diff] [blame] | 1798 | f_sleep(3.0); |
| 1799 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1800 | /* Make a blind connection attemt, to trigger the deadlock condition */ |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1801 | BSSAP_DIRECT.send(ts_BSSAP_CONNECT_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, 1, omit)); |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1802 | |
| 1803 | /* Send a BSSMAP reset */ |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1804 | BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_Reset(0))); |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1805 | T.start |
| 1806 | alt { |
| 1807 | [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_ResetAck)) { |
| 1808 | reset_ack_seen := true; |
| 1809 | repeat; |
| 1810 | } |
| 1811 | |
| 1812 | /* Acknowledge MSC sided reset requests */ |
| 1813 | [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1814 | BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_ResetAck)); |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1815 | repeat; |
| 1816 | } |
| 1817 | |
| 1818 | /* Ignore all other messages (e.g CR from the connection request) */ |
| 1819 | [] BSSAP_DIRECT.receive { repeat } |
| 1820 | |
| 1821 | /* If we got no BSSMAP RESET ACK back, then the MSC entered the |
| 1822 | * deadlock situation. The MSC is then unable to respond to any |
| 1823 | * further BSSMAP RESET or any other sort of traffic. */ |
| 1824 | [reset_ack_seen == true] T.timeout { setverdict(pass) } |
| 1825 | [reset_ack_seen == false] T.timeout { |
| 1826 | setverdict(fail, "no BSSMAP RESET ACK seen!"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1827 | mtc.stop; |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1828 | } |
| 1829 | } |
| 1830 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1831 | |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1832 | /* Test MO Call with no response to RAN-side CRCX or DTAP Release */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1833 | friend function f_tc_mo_release_timeout(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1834 | f_init_handler(pars); |
| 1835 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1836 | var MNCC_PDU mncc; |
| 1837 | var MgcpCommand mgcp_cmd; |
| 1838 | |
| 1839 | f_perform_lu(); |
| 1840 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1841 | f_establish_fully(); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1842 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1843 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1844 | |
| 1845 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1846 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1847 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1848 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1849 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1850 | |
| 1851 | /* Drop CRCX */ |
| 1852 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1853 | |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 1854 | var default ccrel := activate(as_optional_cc_rel(cpars)); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1855 | |
| 1856 | f_expect_clear(60.0); |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 1857 | |
| 1858 | deactivate(ccrel); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1859 | } |
| 1860 | testcase TC_mo_release_timeout() runs on MTC_CT { |
| 1861 | var BSC_ConnHdlr vc_conn; |
| 1862 | f_init(); |
| 1863 | |
| 1864 | vc_conn := f_start_handler(refers(f_tc_mo_release_timeout), 40); |
| 1865 | vc_conn.done; |
| 1866 | } |
| 1867 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1868 | |
Philipp Maier | 2a98a73 | 2018-03-19 16:06:12 +0100 | [diff] [blame] | 1869 | /* LU followed by MT call (including paging) */ |
| 1870 | private function f_tc_lu_and_mt_call_no_dlcx_resp(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1871 | f_init_handler(pars); |
Stefan Sperling | 26d57be | 2018-11-12 17:03:26 +0100 | [diff] [blame] | 1872 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
Philipp Maier | 2a98a73 | 2018-03-19 16:06:12 +0100 | [diff] [blame] | 1873 | cpars.bss_rtp_port := 1110; |
| 1874 | cpars.mgcp_connection_id_bss := '10004'H; |
| 1875 | cpars.mgcp_connection_id_mss := '10005'H; |
| 1876 | |
| 1877 | /* Note: This is an optional parameter. When the call-agent (MSC) does |
| 1878 | * supply a full endpoint name this setting will be overwritten. */ |
| 1879 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1880 | |
| 1881 | /* Intentionally disable the CRCX response */ |
| 1882 | cpars.mgw_drop_dlcx := true; |
| 1883 | |
| 1884 | /* Perform location update and call */ |
| 1885 | f_perform_lu(); |
| 1886 | f_mt_call(cpars); |
| 1887 | } |
| 1888 | testcase TC_lu_and_mt_call_no_dlcx_resp() runs on MTC_CT { |
| 1889 | var BSC_ConnHdlr vc_conn; |
| 1890 | f_init(); |
| 1891 | |
| 1892 | /* Perform an almost normal looking locationupdate + mt-call, but do |
| 1893 | * not respond to the DLCX at the end of the call */ |
| 1894 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call_no_dlcx_resp), 41); |
| 1895 | vc_conn.done; |
| 1896 | |
| 1897 | /* Wait a guard period until the MGCP layer in the MSC times out, |
| 1898 | * if the MSC is vulnerable to the use-after-free situation that is |
| 1899 | * fixed by I78f1b6a9149488a4ad3f120c1e190a83c07d4b89 then it should |
| 1900 | * segfault now */ |
| 1901 | f_sleep(6.0); |
| 1902 | |
| 1903 | /* Run the init procedures once more. If the MSC has crashed, this |
| 1904 | * this will fail */ |
| 1905 | f_init(); |
| 1906 | } |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1907 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1908 | /* Two BSSMAP resets from two different BSCs */ |
| 1909 | testcase TC_reset_two() runs on MTC_CT { |
| 1910 | var BSC_ConnHdlr vc_conn; |
| 1911 | f_init(2); |
| 1912 | f_sleep(2.0); |
| 1913 | setverdict(pass); |
| 1914 | } |
| 1915 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1916 | /* Two BSSMAP resets from two different BSCs plus one IuCS RANAP Reset */ |
| 1917 | testcase TC_reset_two_1iu() runs on MTC_CT { |
| 1918 | var BSC_ConnHdlr vc_conn; |
| 1919 | f_init(3); |
| 1920 | f_sleep(2.0); |
| 1921 | setverdict(pass); |
| 1922 | } |
| 1923 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 1924 | /*********************************************************************** |
| 1925 | * SMS Testing |
| 1926 | ***********************************************************************/ |
| 1927 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1928 | /* LU followed by MO SMS */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1929 | friend function f_tc_lu_and_mo_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1930 | var SmsParameters spars := valueof(t_SmsPars); |
| 1931 | |
| 1932 | f_init_handler(pars); |
| 1933 | |
| 1934 | /* Perform location update and call */ |
| 1935 | f_perform_lu(); |
| 1936 | |
| 1937 | f_establish_fully(EST_TYPE_MO_SMS); |
| 1938 | |
| 1939 | //spars.exp_rp_err := 96; /* invalid mandatory information */ |
| 1940 | f_mo_sms(spars); |
| 1941 | |
| 1942 | f_expect_clear(); |
| 1943 | } |
| 1944 | testcase TC_lu_and_mo_sms() runs on MTC_CT { |
| 1945 | var BSC_ConnHdlr vc_conn; |
| 1946 | f_init(); |
| 1947 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_sms), 42); |
| 1948 | vc_conn.done; |
| 1949 | } |
| 1950 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1951 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1952 | private function f_vty_sms_send(charstring imsi, charstring msisdn, charstring text) |
Neels Hofmeyr | 6aaeccf | 2019-03-06 15:32:26 +0100 | [diff] [blame] | 1953 | runs on BSC_ConnHdlr { |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1954 | f_vty_transceive(MSCVTY, "subscriber imsi "&imsi&" sms sender msisdn "&msisdn&" send "&text); |
| 1955 | } |
| 1956 | |
Neels Hofmeyr | 8256ed2 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 1957 | /* Remove still pending SMS */ |
| 1958 | private function f_vty_sms_clear(charstring imsi) |
| 1959 | runs on BSC_ConnHdlr { |
| 1960 | f_vty_transceive(MSCVTY, "subscriber imsi " & imsi & " sms delete-all"); |
| 1961 | f_vty_transceive(MSCVTY, "sms-queue clear"); |
| 1962 | } |
| 1963 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1964 | /* LU followed by MT SMS */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 1965 | friend function f_tc_lu_and_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1966 | var SmsParameters spars := valueof(t_SmsPars); |
| 1967 | var OCT4 tmsi; |
| 1968 | |
| 1969 | f_init_handler(pars); |
| 1970 | |
| 1971 | /* Perform location update and call */ |
| 1972 | f_perform_lu(); |
| 1973 | |
| 1974 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 1975 | if (isvalue(g_pars.tmsi)) { |
| 1976 | tmsi := g_pars.tmsi; |
| 1977 | } else { |
| 1978 | tmsi := 'FFFFFFFF'O; |
| 1979 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1980 | f_ran_register_imsi(g_pars.imsi, tmsi); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1981 | |
Neels Hofmeyr | 6aaeccf | 2019-03-06 15:32:26 +0100 | [diff] [blame] | 1982 | f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS"); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1983 | |
| 1984 | /* MSC->BSC: expect PAGING from MSC */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 1985 | f_expect_paging(); |
| 1986 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1987 | /* Establish DTAP / BSSAP / SCCP connection */ |
| 1988 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 1989 | |
| 1990 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 1991 | f_mt_sms(spars); |
| 1992 | |
| 1993 | f_expect_clear(); |
| 1994 | } |
| 1995 | testcase TC_lu_and_mt_sms() runs on MTC_CT { |
| 1996 | var BSC_ConnHdlrPars pars; |
| 1997 | var BSC_ConnHdlr vc_conn; |
| 1998 | f_init(); |
| 1999 | pars := f_init_pars(43); |
| 2000 | vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2001 | vc_conn.done; |
| 2002 | } |
| 2003 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2004 | |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2005 | /* Paging for MT SMS but no response */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2006 | friend function f_tc_lu_and_mt_sms_paging_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2007 | var SmsParameters spars := valueof(t_SmsPars); |
| 2008 | var OCT4 tmsi; |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2009 | f_init_handler(pars, 150.0); |
| 2010 | |
| 2011 | /* Perform location update */ |
| 2012 | f_perform_lu(); |
| 2013 | |
| 2014 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 2015 | if (isvalue(g_pars.tmsi)) { |
| 2016 | tmsi := g_pars.tmsi; |
| 2017 | } else { |
| 2018 | tmsi := 'FFFFFFFF'O; |
| 2019 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2020 | f_ran_register_imsi(g_pars.imsi, tmsi); |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2021 | |
Neels Hofmeyr | 6aaeccf | 2019-03-06 15:32:26 +0100 | [diff] [blame] | 2022 | f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 2023 | |
Neels Hofmeyr | 1623774 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 2024 | /* Expect the MSC to page exactly once */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2025 | f_expect_paging(); |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2026 | |
| 2027 | /* Wait some time to make sure the MSC is not delivering any further |
| 2028 | * paging messages or anything else that could be unexpected. */ |
| 2029 | timer T := 20.0; |
| 2030 | T.start |
| 2031 | alt { |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2032 | [pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2033 | { |
| 2034 | setverdict(fail, "paging seems not to stop!"); |
| 2035 | mtc.stop; |
| 2036 | } |
Harald Welte | 62113fc | 2019-05-09 13:04:02 +0200 | [diff] [blame] | 2037 | [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) { |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2038 | setverdict(fail, "paging seems not to stop!"); |
| 2039 | mtc.stop; |
| 2040 | } |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2041 | [] BSSAP.receive { |
| 2042 | setverdict(fail, "unexpected BSSAP message received"); |
| 2043 | self.stop; |
| 2044 | } |
| 2045 | [] T.timeout { |
| 2046 | setverdict(pass); |
| 2047 | } |
| 2048 | } |
| 2049 | |
Neels Hofmeyr | 8256ed2 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 2050 | f_vty_sms_clear(hex2str(g_pars.imsi)); |
| 2051 | |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2052 | setverdict(pass); |
| 2053 | } |
| 2054 | testcase TC_lu_and_mt_sms_paging_and_nothing() runs on MTC_CT { |
| 2055 | var BSC_ConnHdlrPars pars; |
| 2056 | var BSC_ConnHdlr vc_conn; |
| 2057 | f_init(); |
Philipp Maier | a99ad26 | 2019-01-22 15:35:42 +0100 | [diff] [blame] | 2058 | pars := f_init_pars(1843); |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2059 | vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms_paging_and_nothing), pars); |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 2060 | vc_conn.done; |
| 2061 | } |
| 2062 | |
Alexander Couzens | fc02f24 | 2019-09-12 03:43:18 +0200 | [diff] [blame] | 2063 | /* LU followed by MT SMS with repeated paging */ |
| 2064 | friend function f_tc_lu_and_mt_sms_paging_repeated(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 2065 | var SmsParameters spars := valueof(t_SmsPars); |
| 2066 | var OCT4 tmsi; |
| 2067 | |
| 2068 | f_init_handler(pars); |
| 2069 | |
| 2070 | /* Perform location update and call */ |
| 2071 | f_perform_lu(); |
| 2072 | |
| 2073 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 2074 | if (isvalue(g_pars.tmsi)) { |
| 2075 | tmsi := g_pars.tmsi; |
| 2076 | } else { |
| 2077 | tmsi := 'FFFFFFFF'O; |
| 2078 | } |
| 2079 | f_ran_register_imsi(g_pars.imsi, tmsi); |
| 2080 | |
| 2081 | f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 2082 | |
| 2083 | /* MSC->BSC: expect PAGING from MSC */ |
| 2084 | f_expect_paging(); |
| 2085 | |
| 2086 | /* MSC->BSC: expect PAGING from MSC */ |
| 2087 | f_expect_paging(); |
| 2088 | |
| 2089 | /* Establish DTAP / BSSAP / SCCP connection */ |
| 2090 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2091 | |
| 2092 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 2093 | f_mt_sms(spars); |
| 2094 | |
| 2095 | f_expect_clear(); |
| 2096 | } |
| 2097 | testcase TC_lu_and_mt_sms_paging_repeated() runs on MTC_CT { |
| 2098 | var BSC_ConnHdlrPars pars; |
| 2099 | var BSC_ConnHdlr vc_conn; |
| 2100 | f_init(); |
| 2101 | pars := f_init_pars(1844); |
| 2102 | vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms_paging_repeated), pars); |
| 2103 | vc_conn.done; |
| 2104 | } |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2105 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2106 | /* mobile originated SMS from MS/BTS/BSC side to SMPP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2107 | friend function f_tc_smpp_mo_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2108 | var SmsParameters spars := valueof(t_SmsPars); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2109 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2110 | f_init_handler(pars); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2111 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2112 | /* Perform location update so IMSI is known + registered in MSC/VLR */ |
| 2113 | f_perform_lu(); |
| 2114 | f_establish_fully(EST_TYPE_MO_SMS); |
| 2115 | |
| 2116 | f_mo_sms(spars); |
| 2117 | |
| 2118 | var SMPP_PDU smpp; |
| 2119 | var template SMPP_PDU tr_smpp := tr_SMPP(c_SMPP_command_id_deliver_sm, ESME_ROK); |
| 2120 | tr_smpp.body.deliver_sm := { |
| 2121 | service_type := "CMT", |
| 2122 | source_addr_ton := network_specific, |
| 2123 | source_addr_npi := isdn, |
| 2124 | source_addr := hex2str(pars.msisdn), |
| 2125 | dest_addr_ton := f_sm_ton_from_gsm(spars.tp.da.tP_DA_NoPad.tP_TypeOfNumber), |
| 2126 | dest_addr_npi := f_sm_npi_from_gsm(spars.tp.da.tP_DA_NoPad.tP_NumberingPlanID), |
| 2127 | destination_addr := hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue), |
| 2128 | esm_class := '00000001'B, |
| 2129 | protocol_id := 0, |
| 2130 | priority_flag := 0, |
| 2131 | schedule_delivery_time := "", |
| 2132 | replace_if_present := 0, |
| 2133 | data_coding := '00000001'B, |
| 2134 | sm_default_msg_id := 0, |
| 2135 | sm_length := ?, |
| 2136 | short_message := spars.tp.ud, |
| 2137 | opt_pars := { |
| 2138 | { |
| 2139 | tag := user_message_reference, |
| 2140 | len := 2, |
| 2141 | opt_value := { |
| 2142 | int2_val := oct2int(spars.tp.msg_ref) |
| 2143 | } |
| 2144 | } |
| 2145 | } |
| 2146 | }; |
| 2147 | alt { |
| 2148 | [] SMPP.receive(tr_smpp) -> value smpp { |
| 2149 | SMPP.send(ts_SMPP_DELIVER_SM_resp(ESME_ROK, smpp.header.seq_num)); |
| 2150 | } |
| 2151 | [] SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)) { repeat; } |
| 2152 | } |
| 2153 | |
| 2154 | f_expect_clear(); |
| 2155 | } |
| 2156 | testcase TC_smpp_mo_sms() runs on MTC_CT { |
| 2157 | var BSC_ConnHdlr vc_conn; |
| 2158 | f_init(); |
| 2159 | f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "default-route"); |
| 2160 | vc_conn := f_start_handler(refers(f_tc_smpp_mo_sms), 44); |
| 2161 | vc_conn.done; |
| 2162 | f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "no default-route"); |
| 2163 | } |
| 2164 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2165 | |
Vadim Yanitskiy | 103d09f | 2018-11-12 02:50:23 +0700 | [diff] [blame] | 2166 | /* Test MO-SMS from MS/BTS/BSC towards HLR (via GSUP) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2167 | friend function f_tc_gsup_mo_sms(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 103d09f | 2018-11-12 02:50:23 +0700 | [diff] [blame] | 2168 | runs on BSC_ConnHdlr { |
| 2169 | var SmsParameters spars := valueof(t_SmsPars); |
| 2170 | var GSUP_PDU gsup_msg_rx; |
| 2171 | var octetstring sm_tpdu; |
| 2172 | |
| 2173 | f_init_handler(pars); |
| 2174 | |
| 2175 | /* We need to inspect GSUP activity */ |
| 2176 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2177 | |
| 2178 | /* Perform location update */ |
| 2179 | f_perform_lu(); |
| 2180 | |
| 2181 | /* Send CM Service Request for SMS */ |
| 2182 | f_establish_fully(EST_TYPE_MO_SMS); |
| 2183 | |
| 2184 | /* Prepare expected SM-RP-UI (SM TPDU) */ |
| 2185 | enc_TPDU_RP_DATA_MS_SGSN_fast( |
| 2186 | valueof(ts_SMS_SUBMIT(spars.tp.msg_ref, |
| 2187 | spars.tp.da, spars.tp.pid, spars.tp.dcs, |
| 2188 | spars.tp.udl, spars.tp.ud)), |
| 2189 | sm_tpdu); |
| 2190 | |
| 2191 | var template GSUP_PDU mo_forwardSM := tr_GSUP_MO_FORWARD_SM_REQ( |
| 2192 | imsi := g_pars.imsi, |
| 2193 | sm_rp_mr := spars.rp.msg_ref, |
| 2194 | /* FIXME: extract SM-RP-DA from spars.rp.dest */ |
| 2195 | sm_rp_da := tr_GSUP_SM_RP_DA_SMSC_ADDR(?), |
| 2196 | /* FIXME: MSISDN coding troubles */ |
| 2197 | sm_rp_oa := tr_GSUP_SM_RP_OA_MSISDN(?), |
| 2198 | /* TODO: can we use decmatch here? */ |
| 2199 | sm_rp_ui := sm_tpdu |
| 2200 | ); |
| 2201 | |
| 2202 | /* Submit an SMS on DTAP and expect MO-forwardSM-Req on GSUP */ |
| 2203 | f_mo_sms_submit(spars); |
| 2204 | alt { |
| 2205 | [] GSUP.receive(mo_forwardSM) -> value gsup_msg_rx { |
| 2206 | log("RX MO-forwardSM-Req"); |
| 2207 | log(gsup_msg_rx); |
| 2208 | setverdict(pass); |
| 2209 | } |
| 2210 | [] GSUP.receive { |
| 2211 | log("RX unexpected GSUP message"); |
| 2212 | setverdict(fail); |
| 2213 | mtc.stop; |
| 2214 | } |
| 2215 | } |
| 2216 | |
| 2217 | /* Trigger RP-ACK by sending MO-forwardSM-Res */ |
| 2218 | GSUP.send(valueof(ts_GSUP_MO_FORWARD_SM_RES( |
| 2219 | imsi := g_pars.imsi, |
| 2220 | sm_rp_mr := spars.rp.msg_ref))); |
| 2221 | /* Expect RP-ACK on DTAP */ |
| 2222 | f_mo_sms_wait_rp_ack(spars); |
| 2223 | |
| 2224 | f_expect_clear(); |
| 2225 | } |
| 2226 | testcase TC_gsup_mo_sms() runs on MTC_CT { |
| 2227 | var BSC_ConnHdlr vc_conn; |
| 2228 | f_init(); |
| 2229 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2230 | vc_conn := f_start_handler(refers(f_tc_gsup_mo_sms), 88); |
| 2231 | vc_conn.done; |
| 2232 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2233 | } |
| 2234 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2235 | |
Vadim Yanitskiy | 9cc019a | 2018-11-15 02:06:07 +0700 | [diff] [blame] | 2236 | /* Test MO-SMMA from MS/BTS/BSC towards HLR (via GSUP) */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2237 | friend function f_tc_gsup_mo_smma(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 9cc019a | 2018-11-15 02:06:07 +0700 | [diff] [blame] | 2238 | runs on BSC_ConnHdlr { |
| 2239 | var SmsParameters spars := valueof(t_SmsPars); |
| 2240 | var GSUP_PDU gsup_msg_rx; |
| 2241 | |
| 2242 | f_init_handler(pars); |
| 2243 | |
| 2244 | /* We need to inspect GSUP activity */ |
| 2245 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2246 | |
| 2247 | /* Perform location update */ |
| 2248 | f_perform_lu(); |
| 2249 | |
| 2250 | /* Send CM Service Request for SMS */ |
| 2251 | f_establish_fully(EST_TYPE_MO_SMS); |
| 2252 | |
| 2253 | var template GSUP_PDU mo_ReadyForSM := tr_GSUP_MO_READY_FOR_SM_REQ( |
| 2254 | imsi := g_pars.imsi, |
| 2255 | sm_rp_mr := spars.rp.msg_ref, |
| 2256 | sm_alert_rsn := GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL |
| 2257 | ); |
| 2258 | |
| 2259 | /* Submit an SMS on DTAP and expect MO-forwardSM-Req on GSUP */ |
| 2260 | f_mo_smma(spars); |
| 2261 | alt { |
| 2262 | [] GSUP.receive(mo_ReadyForSM) -> value gsup_msg_rx { |
| 2263 | log("RX MO-ReadyForSM-Req"); |
| 2264 | log(gsup_msg_rx); |
| 2265 | setverdict(pass); |
| 2266 | } |
| 2267 | [] GSUP.receive { |
| 2268 | log("RX unexpected GSUP message"); |
| 2269 | setverdict(fail); |
| 2270 | mtc.stop; |
| 2271 | } |
| 2272 | } |
| 2273 | |
| 2274 | /* Trigger RP-ACK by sending MO-forwardSM-Res */ |
| 2275 | GSUP.send(valueof(ts_GSUP_MO_READY_FOR_SM_RES( |
| 2276 | imsi := g_pars.imsi, |
| 2277 | sm_rp_mr := spars.rp.msg_ref))); |
| 2278 | /* Expect RP-ACK on DTAP */ |
| 2279 | f_mo_sms_wait_rp_ack(spars); |
| 2280 | |
| 2281 | f_expect_clear(); |
| 2282 | } |
| 2283 | testcase TC_gsup_mo_smma() runs on MTC_CT { |
| 2284 | var BSC_ConnHdlr vc_conn; |
| 2285 | f_init(); |
| 2286 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2287 | vc_conn := f_start_handler(refers(f_tc_gsup_mo_smma), 89); |
| 2288 | vc_conn.done; |
| 2289 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2290 | } |
| 2291 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2292 | |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2293 | /* Helper for sending MT SMS over GSUP */ |
| 2294 | private function f_gsup_forwardSM_req(SmsParameters spars, OCT1 mms := '00'O) |
| 2295 | runs on BSC_ConnHdlr { |
| 2296 | GSUP.send(ts_GSUP_MT_FORWARD_SM_REQ( |
| 2297 | imsi := g_pars.imsi, |
| 2298 | /* NOTE: MSC should assign RP-MR itself */ |
| 2299 | sm_rp_mr := 'FF'O, |
| 2300 | /* FIXME: extract SM-RP-DA from spars.rp.dest */ |
| 2301 | /* TODO: fix encoding of ts_GSUP_SM_RP_DA_IMSI */ |
| 2302 | sm_rp_da := valueof(ts_GSUP_SM_RP_DA_MSISDN(g_pars.msisdn)), |
| 2303 | sm_rp_oa := valueof(ts_GSUP_SM_RP_OA_SMSC_ADDR(g_pars.msisdn)), |
| 2304 | /* Encoded SMS TPDU (taken from Wireshark) |
| 2305 | * FIXME: we should encode spars somehow */ |
| 2306 | sm_rp_ui := '00068021436500008111328130858200'O, |
| 2307 | sm_rp_mms := mms |
| 2308 | )); |
| 2309 | } |
| 2310 | |
| 2311 | /* Test successful MT-SMS (RP-ACK) over GSUP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2312 | friend function f_tc_gsup_mt_sms_ack(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2313 | runs on BSC_ConnHdlr { |
| 2314 | var SmsParameters spars := valueof(t_SmsPars); |
| 2315 | |
| 2316 | f_init_handler(pars); |
| 2317 | |
| 2318 | /* We need to inspect GSUP activity */ |
| 2319 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2320 | |
| 2321 | /* Perform location update */ |
| 2322 | f_perform_lu(); |
| 2323 | |
| 2324 | /* Register an 'expect' for given IMSI (+TMSI) */ |
| 2325 | if (isvalue(g_pars.tmsi)) { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2326 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2327 | } else { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2328 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2329 | } |
| 2330 | |
| 2331 | var template GSUP_PDU mt_forwardSM_res := tr_GSUP_MT_FORWARD_SM_RES( |
| 2332 | imsi := g_pars.imsi, |
| 2333 | /* NOTE: MSC should assign RP-MR itself */ |
| 2334 | sm_rp_mr := ? |
| 2335 | ); |
| 2336 | |
| 2337 | /* Submit a MT SMS on GSUP */ |
| 2338 | f_gsup_forwardSM_req(spars); |
| 2339 | |
| 2340 | /* Expect Paging Request and Establish DTAP / BSSAP / SCCP connection */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 2341 | f_expect_paging(); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2342 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2343 | |
| 2344 | /* Wait for MT SMS on DTAP */ |
| 2345 | f_mt_sms_expect(spars); |
| 2346 | |
| 2347 | /* Send RP-ACK and expect MT-forwardSM-Res on GSUP */ |
| 2348 | f_mt_sms_send_rp_ack(spars); |
| 2349 | alt { |
| 2350 | [] GSUP.receive(mt_forwardSM_res) { |
| 2351 | log("RX MT-forwardSM-Res (RP-ACK)"); |
| 2352 | setverdict(pass); |
| 2353 | } |
| 2354 | [] GSUP.receive { |
| 2355 | log("RX unexpected GSUP message"); |
| 2356 | setverdict(fail); |
| 2357 | mtc.stop; |
| 2358 | } |
| 2359 | } |
| 2360 | |
| 2361 | f_expect_clear(); |
| 2362 | } |
| 2363 | testcase TC_gsup_mt_sms_ack() runs on MTC_CT { |
| 2364 | var BSC_ConnHdlrPars pars; |
| 2365 | var BSC_ConnHdlr vc_conn; |
| 2366 | f_init(); |
| 2367 | pars := f_init_pars(90); |
| 2368 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2369 | vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_ack), pars); |
| 2370 | vc_conn.done; |
| 2371 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2372 | } |
| 2373 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2374 | |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2375 | /* Test rejected MT-SMS (RP-ERROR) over GSUP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2376 | friend function f_tc_gsup_mt_sms_err(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2377 | runs on BSC_ConnHdlr { |
| 2378 | var SmsParameters spars := valueof(t_SmsPars); |
| 2379 | var OCT1 sm_rp_cause := '78'O; /* dummy RP-Cause value */ |
| 2380 | |
| 2381 | f_init_handler(pars); |
| 2382 | |
| 2383 | /* We need to inspect GSUP activity */ |
| 2384 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2385 | |
| 2386 | /* Perform location update */ |
| 2387 | f_perform_lu(); |
| 2388 | |
| 2389 | /* Register an 'expect' for given IMSI (+TMSI) */ |
| 2390 | if (isvalue(g_pars.tmsi)) { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2391 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2392 | } else { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2393 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2394 | } |
| 2395 | |
| 2396 | var template GSUP_PDU mt_forwardSM_err := tr_GSUP_MT_FORWARD_SM_ERR( |
| 2397 | imsi := g_pars.imsi, |
| 2398 | /* NOTE: MSC should assign RP-MR itself */ |
| 2399 | sm_rp_mr := ?, |
| 2400 | sm_rp_cause := sm_rp_cause |
| 2401 | ); |
| 2402 | |
| 2403 | /* Submit a MT SMS on GSUP */ |
| 2404 | f_gsup_forwardSM_req(spars); |
| 2405 | |
| 2406 | /* Expect Paging Request and Establish DTAP / BSSAP / SCCP connection */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 2407 | f_expect_paging(); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 2408 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2409 | |
| 2410 | /* Wait for MT SMS on DTAP */ |
| 2411 | f_mt_sms_expect(spars); |
| 2412 | |
| 2413 | /* Send RP-ERROR and expect MT-forwardSM-Err on GSUP */ |
| 2414 | f_mt_sms_send_rp_error(spars, oct2int(sm_rp_cause)); |
| 2415 | alt { |
| 2416 | [] GSUP.receive(mt_forwardSM_err) { |
| 2417 | log("RX MT-forwardSM-Err (RP-ERROR)"); |
| 2418 | setverdict(pass); |
| 2419 | mtc.stop; |
| 2420 | } |
| 2421 | [] GSUP.receive { |
| 2422 | log("RX unexpected GSUP message"); |
| 2423 | setverdict(fail); |
| 2424 | mtc.stop; |
| 2425 | } |
| 2426 | } |
| 2427 | |
| 2428 | f_expect_clear(); |
| 2429 | } |
| 2430 | testcase TC_gsup_mt_sms_err() runs on MTC_CT { |
| 2431 | var BSC_ConnHdlrPars pars; |
| 2432 | var BSC_ConnHdlr vc_conn; |
| 2433 | f_init(); |
| 2434 | pars := f_init_pars(91); |
| 2435 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2436 | vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_err), pars); |
| 2437 | vc_conn.done; |
| 2438 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2439 | } |
| 2440 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2441 | |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 2442 | /* Test SM-RP-MR assignment for MT-SMS over GSUP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2443 | friend function f_tc_gsup_mt_sms_rp_mr(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 2444 | runs on BSC_ConnHdlr { |
| 2445 | var SmsParameters spars1 := valueof(t_SmsPars); /* 1st SMS */ |
| 2446 | var SmsParameters spars2 := valueof(t_SmsPars); /* 2nd SMS */ |
| 2447 | |
| 2448 | f_init_handler(pars); |
| 2449 | |
| 2450 | /* We need to inspect GSUP activity */ |
| 2451 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2452 | |
| 2453 | /* Perform location update */ |
| 2454 | f_perform_lu(); |
| 2455 | |
| 2456 | /* Register an 'expect' for given IMSI (+TMSI) */ |
| 2457 | if (isvalue(g_pars.tmsi)) { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2458 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 2459 | } else { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2460 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 2461 | } |
| 2462 | |
| 2463 | /* Submit the 1st MT SMS on GSUP */ |
| 2464 | log("TX MT-forwardSM-Req for the 1st SMS"); |
| 2465 | f_gsup_forwardSM_req(spars1); |
| 2466 | |
| 2467 | /* Expect Paging Request and Establish DTAP / BSSAP / SCCP connection */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 2468 | f_expect_paging(); |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 2469 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2470 | |
| 2471 | /* Wait for 1st MT SMS on DTAP */ |
| 2472 | f_mt_sms_expect(spars1); |
| 2473 | log("RX the 1st SMS on DTAP, DTAP TID is ", spars1.tid, |
| 2474 | ", SM-RP-MR is ", spars1.rp.msg_ref); |
| 2475 | |
| 2476 | /* Submit the 2nd MT SMS on GSUP */ |
| 2477 | log("TX MT-forwardSM-Req for the 2nd SMS"); |
| 2478 | f_gsup_forwardSM_req(spars2); |
| 2479 | |
| 2480 | /* Wait for 2nd MT SMS on DTAP */ |
| 2481 | f_mt_sms_expect(spars2); |
| 2482 | log("RX the 2nd SMS on DTAP, DTAP TID is ", spars2.tid, |
| 2483 | ", SM-RP-MR is ", spars2.rp.msg_ref); |
| 2484 | |
| 2485 | /* Both transaction IDs shall be different */ |
| 2486 | if (spars1.tid == spars2.tid) { |
| 2487 | log("Both DTAP transaction IDs shall be different"); |
| 2488 | setverdict(fail); |
| 2489 | } |
| 2490 | |
| 2491 | /* Both SM-RP-MR values shall be different */ |
| 2492 | if (spars1.rp.msg_ref == spars2.rp.msg_ref) { |
| 2493 | log("Both SM-RP-MR values shall be different"); |
| 2494 | setverdict(fail); |
| 2495 | } |
| 2496 | |
| 2497 | /* Both SM-RP-MR values shall be assigned */ |
| 2498 | if (spars1.rp.msg_ref == 'FF'O) { |
| 2499 | log("Unassigned SM-RP-MR value for the 1st SMS"); |
| 2500 | setverdict(fail); |
| 2501 | } |
| 2502 | if (spars2.rp.msg_ref == 'FF'O) { |
| 2503 | log("Unassigned SM-RP-MR value for the 2nd SMS"); |
| 2504 | setverdict(fail); |
| 2505 | } |
| 2506 | |
| 2507 | /* Send the 1st RP-ACK and expect MT-forwardSM-Res on GSUP */ |
| 2508 | f_mt_sms_send_rp_ack(spars1); |
| 2509 | alt { |
| 2510 | [] GSUP.receive(tr_GSUP_MT_FORWARD_SM_RES( |
| 2511 | imsi := g_pars.imsi, |
| 2512 | sm_rp_mr := spars1.rp.msg_ref |
| 2513 | )) { |
| 2514 | log("RX MT-forwardSM-Res (RP-ACK)"); |
| 2515 | setverdict(pass); |
| 2516 | } |
| 2517 | [] GSUP.receive { |
| 2518 | log("RX unexpected GSUP message"); |
| 2519 | setverdict(fail); |
| 2520 | mtc.stop; |
| 2521 | } |
| 2522 | } |
| 2523 | |
| 2524 | /* Send the 2nd RP-ACK and expect MT-forwardSM-Res on GSUP */ |
| 2525 | f_mt_sms_send_rp_ack(spars2); |
| 2526 | alt { |
| 2527 | [] GSUP.receive(tr_GSUP_MT_FORWARD_SM_RES( |
| 2528 | imsi := g_pars.imsi, |
| 2529 | sm_rp_mr := spars2.rp.msg_ref |
| 2530 | )) { |
| 2531 | log("RX MT-forwardSM-Res (RP-ACK)"); |
| 2532 | setverdict(pass); |
| 2533 | } |
| 2534 | [] GSUP.receive { |
| 2535 | log("RX unexpected GSUP message"); |
| 2536 | setverdict(fail); |
| 2537 | mtc.stop; |
| 2538 | } |
| 2539 | } |
| 2540 | |
| 2541 | f_expect_clear(); |
| 2542 | } |
| 2543 | testcase TC_gsup_mt_sms_rp_mr() runs on MTC_CT { |
| 2544 | var BSC_ConnHdlrPars pars; |
| 2545 | var BSC_ConnHdlr vc_conn; |
| 2546 | f_init(); |
| 2547 | pars := f_init_pars(92); |
| 2548 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2549 | vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_rp_mr), pars); |
| 2550 | vc_conn.done; |
| 2551 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2552 | } |
| 2553 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2554 | |
Vadim Yanitskiy | 5ac49cc | 2019-01-24 16:57:31 +0700 | [diff] [blame] | 2555 | /* Test SM-RP-MR assignment for MT-SMS over GSUP */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2556 | friend function f_tc_gsup_mo_mt_sms_rp_mr(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 5ac49cc | 2019-01-24 16:57:31 +0700 | [diff] [blame] | 2557 | runs on BSC_ConnHdlr { |
| 2558 | var SmsParameters spars_mo := valueof(t_SmsPars); /* MO SMMA */ |
| 2559 | var SmsParameters spars_mt := valueof(t_SmsPars); /* MT SMS */ |
| 2560 | |
| 2561 | f_init_handler(pars); |
| 2562 | |
| 2563 | /* We need to inspect GSUP activity */ |
| 2564 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2565 | |
| 2566 | /* Perform location update */ |
| 2567 | f_perform_lu(); |
| 2568 | |
| 2569 | /* Register an 'expect' for given IMSI (+TMSI) */ |
| 2570 | if (isvalue(g_pars.tmsi)) { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2571 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | 5ac49cc | 2019-01-24 16:57:31 +0700 | [diff] [blame] | 2572 | } else { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2573 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
Vadim Yanitskiy | 5ac49cc | 2019-01-24 16:57:31 +0700 | [diff] [blame] | 2574 | } |
| 2575 | |
| 2576 | /* Send CM Service Request for MO SMMA */ |
| 2577 | f_establish_fully(EST_TYPE_MO_SMS); |
| 2578 | |
| 2579 | /* Submit MO SMMA on DTAP */ |
| 2580 | log("Submit MO SMMA on DTAP, SM-RP-MR is '00'O"); |
| 2581 | spars_mo.rp.msg_ref := '00'O; |
| 2582 | f_mo_smma(spars_mo); |
| 2583 | |
| 2584 | /* Expect MO-forwardSM-Req for MO SMMA on GSUP */ |
| 2585 | alt { |
| 2586 | [] GSUP.receive(tr_GSUP_MO_READY_FOR_SM_REQ( |
| 2587 | imsi := g_pars.imsi, |
| 2588 | sm_rp_mr := spars_mo.rp.msg_ref, |
| 2589 | sm_alert_rsn := GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL |
| 2590 | )) { |
| 2591 | log("RX MO-ReadyForSM-Req, SM-RP-MR is '00'O"); |
| 2592 | setverdict(pass); |
| 2593 | } |
| 2594 | [] GSUP.receive { |
| 2595 | log("RX unexpected GSUP message"); |
| 2596 | setverdict(fail); |
| 2597 | mtc.stop; |
| 2598 | } |
| 2599 | } |
| 2600 | |
| 2601 | /* Submit MT SMS on GSUP */ |
| 2602 | log("TX MT-forwardSM-Req for the MT SMS"); |
| 2603 | f_gsup_forwardSM_req(spars_mt); |
| 2604 | |
| 2605 | /* Wait for MT SMS on DTAP */ |
| 2606 | f_mt_sms_expect(spars_mt); |
| 2607 | log("RX MT SMS on DTAP, DTAP TID is ", spars_mt.tid, |
| 2608 | ", SM-RP-MR is ", spars_mt.rp.msg_ref); |
| 2609 | |
| 2610 | /* Both SM-RP-MR values shall be different */ |
| 2611 | if (spars_mo.rp.msg_ref == spars_mt.rp.msg_ref) { |
| 2612 | log("Both SM-RP-MR values shall be different"); |
| 2613 | setverdict(fail); |
| 2614 | } |
| 2615 | |
| 2616 | /* SM-RP-MR value for MT SMS shall be assigned */ |
| 2617 | if (spars_mt.rp.msg_ref == 'FF'O) { |
| 2618 | log("Unassigned SM-RP-MR value for the MT SMS"); |
| 2619 | setverdict(fail); |
| 2620 | } |
| 2621 | |
| 2622 | /* Trigger RP-ACK for MO SMMA by sending MO-forwardSM-Res */ |
| 2623 | GSUP.send(valueof(ts_GSUP_MO_READY_FOR_SM_RES( |
| 2624 | imsi := g_pars.imsi, |
| 2625 | sm_rp_mr := spars_mo.rp.msg_ref))); |
| 2626 | /* Expect RP-ACK for MO SMMA on DTAP */ |
| 2627 | f_mo_sms_wait_rp_ack(spars_mo); |
| 2628 | |
| 2629 | /* Send RP-ACK for MT SMS and expect MT-forwardSM-Res on GSUP */ |
| 2630 | f_mt_sms_send_rp_ack(spars_mt); |
| 2631 | alt { |
| 2632 | [] GSUP.receive(tr_GSUP_MT_FORWARD_SM_RES( |
| 2633 | imsi := g_pars.imsi, |
| 2634 | sm_rp_mr := spars_mt.rp.msg_ref |
| 2635 | )) { |
| 2636 | log("RX MT-forwardSM-Res (RP-ACK)"); |
| 2637 | setverdict(pass); |
| 2638 | } |
| 2639 | [] GSUP.receive { |
| 2640 | log("RX unexpected GSUP message"); |
| 2641 | setverdict(fail); |
| 2642 | mtc.stop; |
| 2643 | } |
| 2644 | } |
| 2645 | |
| 2646 | f_expect_clear(); |
| 2647 | } |
| 2648 | testcase TC_gsup_mo_mt_sms_rp_mr() runs on MTC_CT { |
| 2649 | var BSC_ConnHdlrPars pars; |
| 2650 | var BSC_ConnHdlr vc_conn; |
| 2651 | f_init(); |
| 2652 | pars := f_init_pars(93); |
| 2653 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2654 | vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mo_mt_sms_rp_mr), pars); |
| 2655 | vc_conn.done; |
| 2656 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2657 | } |
| 2658 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2659 | |
Vadim Yanitskiy | 1cd11a0 | 2018-12-03 02:43:35 +0700 | [diff] [blame] | 2660 | /* Test multi-part MT-SMS over GSUP */ |
| 2661 | private function f_tc_gsup_mt_multi_part_sms(charstring id, BSC_ConnHdlrPars pars) |
| 2662 | runs on BSC_ConnHdlr { |
| 2663 | var SmsParameters spars := valueof(t_SmsPars); |
| 2664 | |
| 2665 | f_init_handler(pars); |
| 2666 | |
| 2667 | /* We need to inspect GSUP activity */ |
| 2668 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2669 | |
| 2670 | /* Perform location update */ |
| 2671 | f_perform_lu(); |
| 2672 | |
| 2673 | /* Register an 'expect' for given IMSI (+TMSI) */ |
| 2674 | if (isvalue(g_pars.tmsi)) { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2675 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | 1cd11a0 | 2018-12-03 02:43:35 +0700 | [diff] [blame] | 2676 | } else { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2677 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
Vadim Yanitskiy | 1cd11a0 | 2018-12-03 02:43:35 +0700 | [diff] [blame] | 2678 | } |
| 2679 | |
| 2680 | var template GSUP_PDU mt_forwardSM_res := tr_GSUP_MT_FORWARD_SM_RES( |
| 2681 | imsi := g_pars.imsi, |
| 2682 | /* NOTE: MSC should assign RP-MR itself */ |
| 2683 | sm_rp_mr := ? |
| 2684 | ); |
| 2685 | |
| 2686 | /* Send 4 messages (NOTE: SM-RP-UI remains unchanged) */ |
| 2687 | for (var integer i := 3; i >= 0; i := i-1) { |
| 2688 | /* Submit a MT SMS on GSUP (MMS is decremented) */ |
| 2689 | f_gsup_forwardSM_req(spars, int2oct(i, 1)); |
| 2690 | |
| 2691 | /* Expect Paging Request and Establish connection */ |
| 2692 | if (i == 3) { /* ... only once! */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2693 | f_expect_paging(); |
Vadim Yanitskiy | 1cd11a0 | 2018-12-03 02:43:35 +0700 | [diff] [blame] | 2694 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2695 | } |
| 2696 | |
| 2697 | /* Wait for MT SMS on DTAP */ |
| 2698 | f_mt_sms_expect(spars); |
| 2699 | |
| 2700 | /* Send RP-ACK and expect MT-forwardSM-Res on GSUP */ |
| 2701 | f_mt_sms_send_rp_ack(spars); |
| 2702 | alt { |
| 2703 | [] GSUP.receive(mt_forwardSM_res) { |
| 2704 | log("RX MT-forwardSM-Res (RP-ACK)"); |
| 2705 | setverdict(pass); |
| 2706 | } |
| 2707 | [] GSUP.receive { |
| 2708 | log("RX unexpected GSUP message"); |
| 2709 | setverdict(fail); |
| 2710 | mtc.stop; |
| 2711 | } |
| 2712 | } |
| 2713 | |
| 2714 | /* Keep some 'distance' between transmissions */ |
| 2715 | f_sleep(1.5); |
| 2716 | } |
| 2717 | |
| 2718 | f_expect_clear(); |
| 2719 | } |
| 2720 | testcase TC_gsup_mt_multi_part_sms() runs on MTC_CT { |
| 2721 | var BSC_ConnHdlrPars pars; |
| 2722 | var BSC_ConnHdlr vc_conn; |
| 2723 | f_init(); |
| 2724 | pars := f_init_pars(91); |
| 2725 | f_vty_config(MSCVTY, "msc", "sms-over-gsup"); |
| 2726 | vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_multi_part_sms), pars); |
| 2727 | vc_conn.done; |
| 2728 | f_vty_config(MSCVTY, "msc", "no sms-over-gsup"); |
| 2729 | } |
| 2730 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2731 | /* convert GSM L3 TON to SMPP_TON enum */ |
| 2732 | function f_sm_ton_from_gsm(BIT3 ton) return SMPP_TON { |
| 2733 | select (ton) { |
| 2734 | case ('000'B) { return unknown; } |
| 2735 | case ('001'B) { return international; } |
| 2736 | case ('010'B) { return national; } |
| 2737 | case ('011'B) { return network_specific; } |
| 2738 | case ('100'B) { return subscriber_number; } |
| 2739 | case ('101'B) { return alphanumeric; } |
| 2740 | case ('110'B) { return abbreviated; } |
| 2741 | } |
| 2742 | setverdict(fail, "Unknown TON ", ton); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2743 | mtc.stop; |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2744 | } |
| 2745 | /* convert GSM L3 NPI to SMPP_NPI enum */ |
| 2746 | function f_sm_npi_from_gsm(BIT4 npi) return SMPP_NPI { |
| 2747 | select (npi) { |
| 2748 | case ('0000'B) { return unknown; } |
| 2749 | case ('0001'B) { return isdn; } |
| 2750 | case ('0011'B) { return data; } |
| 2751 | case ('0100'B) { return telex; } |
| 2752 | case ('0110'B) { return land_mobile; } |
| 2753 | case ('1000'B) { return national; } |
| 2754 | case ('1001'B) { return private_; } |
| 2755 | case ('1010'B) { return ermes; } |
| 2756 | } |
| 2757 | setverdict(fail, "Unknown NPI ", npi); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2758 | mtc.stop; |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2759 | } |
| 2760 | |
| 2761 | /* build a SMPP_SM from SmsParameters */ |
| 2762 | function f_mt_sm_from_spars(SmsParameters spars) |
| 2763 | runs on BSC_ConnHdlr return SMPP_SM { |
| 2764 | var SMPP_SM sm := { |
| 2765 | service_type := "CMT", |
| 2766 | source_addr_ton := f_sm_ton_from_gsm(spars.tp.da.tP_DA_NoPad.tP_TypeOfNumber), |
| 2767 | source_addr_npi := f_sm_npi_from_gsm(spars.tp.da.tP_DA_NoPad.tP_NumberingPlanID), |
| 2768 | source_addr := hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue), |
| 2769 | dest_addr_ton := international, |
| 2770 | dest_addr_npi := isdn, |
| 2771 | destination_addr := hex2str(g_pars.msisdn), |
| 2772 | esm_class := '00000001'B, |
| 2773 | protocol_id := 0, |
| 2774 | priority_flag := 0, |
| 2775 | schedule_delivery_time := "", |
| 2776 | validity_period := "", |
| 2777 | registered_delivery := '00000000'B, |
| 2778 | replace_if_present := 0, |
| 2779 | data_coding := '00000001'B, |
| 2780 | sm_default_msg_id := 0, |
| 2781 | sm_length := spars.tp.udl, |
| 2782 | short_message := spars.tp.ud, |
| 2783 | opt_pars := {} |
| 2784 | }; |
| 2785 | return sm; |
| 2786 | } |
| 2787 | |
| 2788 | /* helper function to encode SMS from 'spars', send it via SMPP to MSC; receive it on MS side */ |
| 2789 | private function f_smpp_mt_sms(SmsParameters spars, boolean trans_mode) runs on BSC_ConnHdlr { |
| 2790 | var SMPP_SM sm := f_mt_sm_from_spars(spars); |
| 2791 | if (trans_mode) { |
| 2792 | sm.esm_class := '00000010'B; |
| 2793 | } |
| 2794 | |
| 2795 | /* actually cause MSC to send a SMS via SUBMIT-SM from SMPP side */ |
| 2796 | SMPP.send(ts_SMPP_SUBMIT_SM(sm)); |
| 2797 | if (not match(sm.esm_class, tr_ESM_CLASS_TRANSACTION)) { |
| 2798 | /* if we're not in SMPP transaction mode, we expect the SMPP-level ACK |
| 2799 | * before we expect the SMS delivery on the BSC/radio side */ |
| 2800 | SMPP.receive(tr_SMPP(c_SMPP_command_id_submit_sm_resp, ESME_ROK)); |
| 2801 | } |
| 2802 | |
| 2803 | /* MSC->BSC: expect PAGING from MSC */ |
Harald Welte | e035e3e | 2019-04-21 17:32:05 +0200 | [diff] [blame] | 2804 | f_expect_paging(); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2805 | /* Establish DTAP / BSSAP / SCCP connection */ |
| 2806 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2807 | SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)); |
| 2808 | |
| 2809 | f_mt_sms(spars); |
| 2810 | |
| 2811 | if (match(sm.esm_class, tr_ESM_CLASS_TRANSACTION)) { |
| 2812 | SMPP.receive(tr_SMPP(c_SMPP_command_id_submit_sm_resp, ESME_ROK)); |
| 2813 | } |
| 2814 | f_expect_clear(); |
| 2815 | } |
| 2816 | |
| 2817 | /* mobile terminated SMS, from SMPP to BSC/BTS/MS */ |
| 2818 | private function f_tc_smpp_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 2819 | f_init_handler(pars); |
| 2820 | |
| 2821 | /* Perform location update so IMSI is known + registered in MSC/VLR */ |
| 2822 | f_perform_lu(); |
| 2823 | SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)); |
| 2824 | |
| 2825 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 2826 | var OCT4 tmsi; |
| 2827 | if (isvalue(g_pars.tmsi)) { |
| 2828 | tmsi := g_pars.tmsi; |
| 2829 | } else { |
| 2830 | tmsi := 'FFFFFFFF'O; |
| 2831 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2832 | f_ran_register_imsi(g_pars.imsi, tmsi); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2833 | |
| 2834 | var SmsParameters spars := valueof(t_SmsPars); |
| 2835 | /* TODO: test with more intelligent user data; test different coding schemes */ |
| 2836 | spars.tp.ud := '00'O; |
| 2837 | spars.tp.udl := 1; |
| 2838 | |
| 2839 | /* first test the non-transaction store+forward mode */ |
| 2840 | f_smpp_mt_sms(spars, false); |
| 2841 | |
| 2842 | /* then test the transaction mode */ |
| 2843 | f_smpp_mt_sms(spars, true); |
| 2844 | } |
| 2845 | testcase TC_smpp_mt_sms() runs on MTC_CT { |
| 2846 | var BSC_ConnHdlr vc_conn; |
| 2847 | f_init(); |
| 2848 | vc_conn := f_start_handler(refers(f_tc_smpp_mt_sms), 45); |
| 2849 | vc_conn.done; |
| 2850 | } |
| 2851 | |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2852 | /*********************************************************************** |
| 2853 | * USSD Testing |
| 2854 | ***********************************************************************/ |
| 2855 | |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2856 | private altstep as_unexp_gsup_or_bssap_msg() |
| 2857 | runs on BSC_ConnHdlr { |
| 2858 | [] GSUP.receive { |
| 2859 | setverdict(fail, "Unknown/unexpected GSUP received"); |
| 2860 | self.stop; |
| 2861 | } |
| 2862 | [] BSSAP.receive { |
| 2863 | setverdict(fail, "Unknown/unexpected BSSAP message received"); |
| 2864 | self.stop; |
| 2865 | } |
| 2866 | } |
| 2867 | |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 2868 | private function f_expect_gsup_msg(template GSUP_PDU msg, |
| 2869 | float T_val := 2.0) |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2870 | runs on BSC_ConnHdlr return GSUP_PDU { |
| 2871 | var GSUP_PDU gsup_msg_complete; |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 2872 | timer T := T_val; |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2873 | |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 2874 | T.start; |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2875 | alt { |
| 2876 | [] GSUP.receive(msg) -> value gsup_msg_complete { |
| 2877 | setverdict(pass); |
| 2878 | } |
| 2879 | /* We don't expect anything else */ |
| 2880 | [] as_unexp_gsup_or_bssap_msg(); |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 2881 | [] T.timeout { |
| 2882 | setverdict(fail, "Timeout waiting for GSUP message: ", msg); |
| 2883 | } |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2884 | } |
| 2885 | |
| 2886 | return gsup_msg_complete; |
| 2887 | } |
| 2888 | |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 2889 | private function f_expect_mt_dtap_msg(template PDU_ML3_NW_MS msg, |
| 2890 | float T_val := 2.0) |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2891 | runs on BSC_ConnHdlr return PDU_ML3_NW_MS { |
| 2892 | var PDU_DTAP_MT bssap_msg_complete; |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 2893 | timer T := T_val; |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2894 | |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 2895 | T.start; |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2896 | alt { |
| 2897 | [] BSSAP.receive(tr_PDU_DTAP_MT(msg)) -> value bssap_msg_complete { |
| 2898 | setverdict(pass); |
| 2899 | } |
| 2900 | /* We don't expect anything else */ |
| 2901 | [] as_unexp_gsup_or_bssap_msg(); |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 2902 | [] T.timeout { |
| 2903 | setverdict(fail, "Timeout waiting for BSSAP message: ", msg); |
| 2904 | } |
Vadim Yanitskiy | ce8cc37 | 2018-06-21 01:46:33 +0700 | [diff] [blame] | 2905 | } |
| 2906 | |
| 2907 | return bssap_msg_complete.dtap; |
| 2908 | } |
| 2909 | |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 2910 | /* LU followed by MO USSD request */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2911 | friend function f_tc_lu_and_mo_ussd_single_request(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2912 | runs on BSC_ConnHdlr { |
| 2913 | f_init_handler(pars); |
| 2914 | |
| 2915 | /* Perform location update */ |
| 2916 | f_perform_lu(); |
| 2917 | |
| 2918 | /* Send CM Service Request for SS/USSD */ |
| 2919 | f_establish_fully(EST_TYPE_SS_ACT); |
| 2920 | |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 2921 | /* We need to inspect GSUP activity */ |
| 2922 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 2923 | |
| 2924 | var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( |
| 2925 | invoke_id := 5, /* Phone may not start from 0 or 1 */ |
| 2926 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 2927 | ussd_string := "*#100#" |
| 2928 | ); |
| 2929 | |
| 2930 | var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( |
| 2931 | invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */ |
| 2932 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 2933 | ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" |
| 2934 | ) |
| 2935 | |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2936 | /* Compose a new SS/REGISTER message with request */ |
| 2937 | var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER( |
| 2938 | tid := 1, /* We just need a single transaction */ |
| 2939 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 2940 | facility := valueof(facility_req) |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2941 | ); |
| 2942 | |
| 2943 | /* Compose SS/RELEASE_COMPLETE template with expected response */ |
| 2944 | var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 2945 | tid := 1, /* Response should arrive within the same transaction */ |
| 2946 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 2947 | facility := valueof(facility_rsp) |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2948 | ); |
| 2949 | |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 2950 | /* Compose expected MSC -> HLR message */ |
| 2951 | var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ( |
| 2952 | imsi := g_pars.imsi, |
| 2953 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 2954 | ss := valueof(facility_req) |
| 2955 | ); |
| 2956 | |
| 2957 | /* To be used for sending response with correct session ID */ |
| 2958 | var GSUP_PDU gsup_req_complete; |
| 2959 | |
| 2960 | /* Request own number */ |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2961 | BSSAP.send(ts_PDU_DTAP_MO(ussd_req)); |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 2962 | /* Expect GSUP message containing the SS payload */ |
| 2963 | gsup_req_complete := f_expect_gsup_msg(gsup_req); |
| 2964 | |
| 2965 | /* Compose the response from HLR using received session ID */ |
| 2966 | var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ( |
| 2967 | imsi := g_pars.imsi, |
| 2968 | sid := gsup_req_complete.ies[1].val.session_id, |
| 2969 | state := OSMO_GSUP_SESSION_STATE_END, |
| 2970 | ss := valueof(facility_rsp) |
| 2971 | ); |
| 2972 | |
| 2973 | /* Finally, HLR terminates the session */ |
| 2974 | GSUP.send(gsup_rsp); |
| 2975 | /* Expect RELEASE_COMPLETE message with the response */ |
| 2976 | f_expect_mt_dtap_msg(ussd_rsp); |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2977 | |
| 2978 | f_expect_clear(); |
| 2979 | } |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 2980 | testcase TC_lu_and_mo_ussd_single_request() runs on MTC_CT { |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2981 | var BSC_ConnHdlr vc_conn; |
| 2982 | f_init(); |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 2983 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_single_request), 46); |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 2984 | vc_conn.done; |
| 2985 | } |
| 2986 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2987 | |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 2988 | /* LU followed by MT USSD notification */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 2989 | friend function f_tc_lu_and_mt_ussd_notification(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 2990 | runs on BSC_ConnHdlr { |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 2991 | timer T := 5.0; |
| 2992 | |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 2993 | f_init_handler(pars); |
| 2994 | |
| 2995 | /* Perform location update */ |
| 2996 | f_perform_lu(); |
| 2997 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 2998 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 2999 | |
| 3000 | /* We need to inspect GSUP activity */ |
| 3001 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3002 | |
| 3003 | /* Facility IE with network-originated USSD notification */ |
| 3004 | var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( |
| 3005 | op_code := SS_OP_CODE_USS_NOTIFY, |
| 3006 | ussd_string := "Mahlzeit!" |
| 3007 | ); |
| 3008 | |
| 3009 | /* Facility IE with acknowledgment to the USSD notification */ |
| 3010 | var template OCTN facility_rsp := enc_SS_FacilityInformation( |
| 3011 | /* In case of USSD notification, Return Result is empty */ |
| 3012 | valueof(ts_SS_USSD_FACILITY_RETURN_RESULT_EMPTY()) |
| 3013 | ); |
| 3014 | |
| 3015 | /* Compose a new MT SS/REGISTER message with USSD notification */ |
| 3016 | var template PDU_ML3_NW_MS ussd_ntf := tr_ML3_MT_SS_REGISTER( |
| 3017 | tid := 0, /* FIXME: most likely, it should be 0 */ |
| 3018 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3019 | facility := valueof(facility_req) |
| 3020 | ); |
| 3021 | |
| 3022 | /* Compose HLR -> MSC GSUP message */ |
| 3023 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3024 | imsi := g_pars.imsi, |
| 3025 | sid := '20000101'O, |
| 3026 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3027 | ss := valueof(facility_req) |
| 3028 | ); |
| 3029 | |
| 3030 | /* Send it to MSC and expect Paging Request */ |
| 3031 | GSUP.send(gsup_req); |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 3032 | T.start; |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 3033 | alt { |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3034 | [pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) { |
| 3035 | setverdict(pass); |
| 3036 | } |
Harald Welte | 62113fc | 2019-05-09 13:04:02 +0200 | [diff] [blame] | 3037 | [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) { |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 3038 | setverdict(pass); |
| 3039 | } |
| 3040 | /* We don't expect anything else */ |
| 3041 | [] as_unexp_gsup_or_bssap_msg(); |
Vadim Yanitskiy | d1e1ce5 | 2019-06-15 03:40:59 +0700 | [diff] [blame] | 3042 | [] T.timeout { |
| 3043 | setverdict(fail, "Timeout waiting for Paging Request"); |
| 3044 | } |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 3045 | } |
| 3046 | |
| 3047 | /* Send Paging Response and expect USSD notification */ |
| 3048 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 3049 | /* Expect MT REGISTER message with USSD notification */ |
| 3050 | f_expect_mt_dtap_msg(ussd_ntf); |
| 3051 | |
| 3052 | /* Compose a new MO SS/FACILITY message with empty response */ |
| 3053 | var template (value) PDU_ML3_MS_NW ussd_rsp := ts_ML3_MO_SS_FACILITY( |
| 3054 | tid := 0, /* FIXME: it shall match the request tid */ |
| 3055 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 3056 | facility := valueof(facility_rsp) |
| 3057 | ); |
| 3058 | |
| 3059 | /* Compose expected MSC -> HLR GSUP message */ |
| 3060 | var template GSUP_PDU gsup_rsp := tr_GSUP_PROC_SS_REQ( |
| 3061 | imsi := g_pars.imsi, |
| 3062 | sid := '20000101'O, |
| 3063 | state := OSMO_GSUP_SESSION_STATE_CONTINUE, |
| 3064 | ss := valueof(facility_rsp) |
| 3065 | ); |
| 3066 | |
| 3067 | /* MS sends response to the notification */ |
| 3068 | BSSAP.send(ts_PDU_DTAP_MO(ussd_rsp)); |
| 3069 | /* Expect GSUP message containing the SS payload */ |
| 3070 | f_expect_gsup_msg(gsup_rsp); |
| 3071 | |
| 3072 | /* Compose expected MT SS/RELEASE COMPLETE message */ |
| 3073 | var template PDU_ML3_NW_MS ussd_term := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3074 | tid := 0, /* FIXME: it shall match the request tid */ |
| 3075 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3076 | facility := omit |
| 3077 | ); |
| 3078 | |
| 3079 | /* Compose MSC -> HLR GSUP message */ |
| 3080 | var template GSUP_PDU gsup_term := ts_GSUP_PROC_SS_REQ( |
| 3081 | imsi := g_pars.imsi, |
| 3082 | sid := '20000101'O, |
| 3083 | state := OSMO_GSUP_SESSION_STATE_END |
| 3084 | ); |
| 3085 | |
| 3086 | /* Finally, HLR terminates the session */ |
| 3087 | GSUP.send(gsup_term) |
| 3088 | /* Expect MT RELEASE COMPLETE without Facility IE */ |
| 3089 | f_expect_mt_dtap_msg(ussd_term); |
| 3090 | |
| 3091 | f_expect_clear(); |
| 3092 | } |
| 3093 | testcase TC_lu_and_mt_ussd_notification() runs on MTC_CT { |
| 3094 | var BSC_ConnHdlr vc_conn; |
| 3095 | f_init(); |
| 3096 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_ussd_notification), 47); |
| 3097 | vc_conn.done; |
| 3098 | } |
| 3099 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3100 | |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 3101 | /* LU followed by MT call and MO USSD request during this call */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3102 | friend function f_tc_lu_and_mo_ussd_during_mt_call(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3103 | runs on BSC_ConnHdlr { |
| 3104 | f_init_handler(pars); |
| 3105 | |
| 3106 | /* Call parameters taken from f_tc_lu_and_mt_call */ |
| 3107 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 3108 | cpars.mgcp_connection_id_bss := '10004'H; |
| 3109 | cpars.mgcp_connection_id_mss := '10005'H; |
| 3110 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 3111 | cpars.bss_rtp_port := 1110; |
| 3112 | |
| 3113 | /* Perform location update */ |
| 3114 | f_perform_lu(); |
| 3115 | |
| 3116 | /* Establish a MT call */ |
| 3117 | f_mt_call_establish(cpars); |
| 3118 | |
| 3119 | /* Hold the call for some time */ |
| 3120 | f_sleep(1.0); |
| 3121 | |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 3122 | var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( |
| 3123 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 3124 | ussd_string := "*#100#" |
| 3125 | ); |
| 3126 | |
| 3127 | var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( |
| 3128 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 3129 | ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" |
| 3130 | ) |
| 3131 | |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3132 | /* Compose a new SS/REGISTER message with request */ |
| 3133 | var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER( |
| 3134 | tid := 1, /* We just need a single transaction */ |
| 3135 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 3136 | facility := valueof(facility_req) |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3137 | ); |
| 3138 | |
| 3139 | /* Compose SS/RELEASE_COMPLETE template with expected response */ |
| 3140 | var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3141 | tid := 1, /* Response should arrive within the same transaction */ |
| 3142 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 3143 | facility := valueof(facility_rsp) |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3144 | ); |
| 3145 | |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 3146 | /* Compose expected MSC -> HLR message */ |
| 3147 | var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ( |
| 3148 | imsi := g_pars.imsi, |
| 3149 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3150 | ss := valueof(facility_req) |
| 3151 | ); |
| 3152 | |
| 3153 | /* To be used for sending response with correct session ID */ |
| 3154 | var GSUP_PDU gsup_req_complete; |
| 3155 | |
| 3156 | /* Request own number */ |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3157 | BSSAP.send(ts_PDU_DTAP_MO(ussd_req)); |
Vadim Yanitskiy | 747689e | 2018-06-19 00:14:28 +0700 | [diff] [blame] | 3158 | /* Expect GSUP message containing the SS payload */ |
| 3159 | gsup_req_complete := f_expect_gsup_msg(gsup_req); |
| 3160 | |
| 3161 | /* Compose the response from HLR using received session ID */ |
| 3162 | var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ( |
| 3163 | imsi := g_pars.imsi, |
| 3164 | sid := gsup_req_complete.ies[1].val.session_id, |
| 3165 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3166 | ss := valueof(facility_rsp) |
| 3167 | ); |
| 3168 | |
| 3169 | /* Finally, HLR terminates the session */ |
| 3170 | GSUP.send(gsup_rsp); |
| 3171 | /* Expect RELEASE_COMPLETE message with the response */ |
| 3172 | f_expect_mt_dtap_msg(ussd_rsp); |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3173 | |
| 3174 | /* Hold the call for some time */ |
| 3175 | f_sleep(1.0); |
| 3176 | |
| 3177 | /* Release the call (does Clear Complete itself) */ |
| 3178 | f_call_hangup(cpars, true); |
| 3179 | } |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 3180 | testcase TC_lu_and_mo_ussd_during_mt_call() runs on MTC_CT { |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3181 | var BSC_ConnHdlr vc_conn; |
| 3182 | f_init(); |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 3183 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_during_mt_call), 48); |
Vadim Yanitskiy | 0aaf48d | 2018-06-06 07:02:47 +0700 | [diff] [blame] | 3184 | vc_conn.done; |
| 3185 | } |
| 3186 | |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 3187 | /* BSSMAP Clear Request in the middle of a call, see OS#3062 */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3188 | friend function f_tc_mo_cc_bssmap_clear(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 3189 | f_init_handler(pars); |
| 3190 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 3191 | var MNCC_PDU mncc; |
| 3192 | var MgcpCommand mgcp_cmd; |
| 3193 | |
| 3194 | f_perform_lu(); |
| 3195 | |
| 3196 | f_establish_fully(); |
| 3197 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 3198 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3199 | |
| 3200 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 3201 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 3202 | cpars.mncc_callref := mncc.u.signal.callref; |
| 3203 | log("mncc_callref=", cpars.mncc_callref); |
| 3204 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 3205 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 3206 | |
| 3207 | MNCC.send(ts_MNCC_ALERT_req(cpars.mncc_callref)); |
| 3208 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_ALERTING(cpars.transaction_id))); |
| 3209 | MGCP.receive(tr_CRCX); |
| 3210 | |
| 3211 | f_sleep(1.0); |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3212 | if (pars.ran_is_geran) { |
| 3213 | BSSAP.send(ts_BSSMAP_ClearRequest(0)); |
| 3214 | } else { |
| 3215 | BSSAP.send(ts_RANAP_IuReleaseRequest(ts_RanapCause_om_intervention)); |
| 3216 | } |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 3217 | |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 3218 | var default ccrel := activate(as_optional_cc_rel(cpars)); |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 3219 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3220 | if (pars.ran_is_geran) { |
| 3221 | interleave { |
| 3222 | [] MNCC.receive(tr_MNCC_REL_ind(?, ?)) { }; |
| 3223 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 3224 | BSSAP.send(ts_BSSMAP_ClearComplete); |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3225 | }; |
| 3226 | } |
| 3227 | } else { |
| 3228 | interleave { |
| 3229 | [] MNCC.receive(tr_MNCC_REL_ind(?, ?)) { }; |
| 3230 | [] BSSAP.receive(tr_RANAP_IuReleaseCommand(?)) { |
| 3231 | BSSAP.send(ts_RANAP_IuReleaseComplete); |
| 3232 | }; |
| 3233 | } |
Neels Hofmeyr | de76f05 | 2019-02-26 05:02:46 +0100 | [diff] [blame] | 3234 | } |
| 3235 | |
| 3236 | deactivate(ccrel); |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 3237 | |
| 3238 | f_sleep(1.0); |
| 3239 | } |
| 3240 | testcase TC_mo_cc_bssmap_clear() runs on MTC_CT { |
| 3241 | var BSC_ConnHdlr vc_conn; |
| 3242 | f_init(); |
| 3243 | |
| 3244 | vc_conn := f_start_handler(refers(f_tc_mo_cc_bssmap_clear), 43); |
| 3245 | vc_conn.done; |
| 3246 | } |
| 3247 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3248 | |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 3249 | /* LU followed by MT call and MT USSD request during this call */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3250 | friend function f_tc_lu_and_mt_ussd_during_mt_call(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 3251 | runs on BSC_ConnHdlr { |
| 3252 | f_init_handler(pars); |
| 3253 | |
| 3254 | /* Call parameters taken from f_tc_lu_and_mt_call */ |
| 3255 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 3256 | cpars.mgcp_connection_id_bss := '10004'H; |
| 3257 | cpars.mgcp_connection_id_mss := '10005'H; |
| 3258 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 3259 | cpars.bss_rtp_port := 1110; |
| 3260 | |
| 3261 | /* Perform location update */ |
| 3262 | f_perform_lu(); |
| 3263 | |
| 3264 | /* Establish a MT call */ |
| 3265 | f_mt_call_establish(cpars); |
| 3266 | |
| 3267 | /* Hold the call for some time */ |
| 3268 | f_sleep(1.0); |
| 3269 | |
| 3270 | var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( |
| 3271 | op_code := SS_OP_CODE_USS_REQUEST, |
| 3272 | ussd_string := "Please type anything..." |
| 3273 | ); |
| 3274 | |
| 3275 | var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( |
| 3276 | op_code := SS_OP_CODE_USS_REQUEST, |
| 3277 | ussd_string := "Nope." |
| 3278 | ) |
| 3279 | |
| 3280 | /* Compose MT SS/REGISTER message with network-originated request */ |
| 3281 | var template (value) PDU_ML3_NW_MS ussd_req := ts_ML3_MT_SS_REGISTER( |
| 3282 | tid := 0, /* FIXME: most likely, it should be 0 */ |
| 3283 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3284 | facility := valueof(facility_req) |
| 3285 | ); |
| 3286 | |
| 3287 | /* Compose HLR -> MSC GSUP message */ |
| 3288 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3289 | imsi := g_pars.imsi, |
| 3290 | sid := '20000101'O, |
| 3291 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3292 | ss := valueof(facility_req) |
| 3293 | ); |
| 3294 | |
| 3295 | /* Send it to MSC */ |
| 3296 | GSUP.send(gsup_req); |
| 3297 | /* Expect MT REGISTER message with USSD request */ |
| 3298 | f_expect_mt_dtap_msg(ussd_req); |
| 3299 | |
| 3300 | /* Compose a new MO SS/FACILITY message with response */ |
| 3301 | var template (value) PDU_ML3_MS_NW ussd_rsp := ts_ML3_MO_SS_FACILITY( |
| 3302 | tid := 0, /* FIXME: it shall match the request tid */ |
| 3303 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 3304 | facility := valueof(facility_rsp) |
| 3305 | ); |
| 3306 | |
| 3307 | /* Compose expected MSC -> HLR GSUP message */ |
| 3308 | var template GSUP_PDU gsup_rsp := tr_GSUP_PROC_SS_REQ( |
| 3309 | imsi := g_pars.imsi, |
| 3310 | sid := '20000101'O, |
| 3311 | state := OSMO_GSUP_SESSION_STATE_CONTINUE, |
| 3312 | ss := valueof(facility_rsp) |
| 3313 | ); |
| 3314 | |
| 3315 | /* MS sends response */ |
| 3316 | BSSAP.send(ts_PDU_DTAP_MO(ussd_rsp)); |
| 3317 | f_expect_gsup_msg(gsup_rsp); |
| 3318 | |
| 3319 | /* Compose expected MT SS/RELEASE COMPLETE message */ |
| 3320 | var template PDU_ML3_NW_MS ussd_term := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3321 | tid := 0, /* FIXME: it shall match the request tid */ |
| 3322 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3323 | facility := omit |
| 3324 | ); |
| 3325 | |
| 3326 | /* Compose MSC -> HLR GSUP message */ |
| 3327 | var template GSUP_PDU gsup_term := ts_GSUP_PROC_SS_REQ( |
| 3328 | imsi := g_pars.imsi, |
| 3329 | sid := '20000101'O, |
| 3330 | state := OSMO_GSUP_SESSION_STATE_END |
| 3331 | ); |
| 3332 | |
| 3333 | /* Finally, HLR terminates the session */ |
| 3334 | GSUP.send(gsup_term); |
| 3335 | /* Expect MT RELEASE COMPLETE without Facility IE */ |
| 3336 | f_expect_mt_dtap_msg(ussd_term); |
| 3337 | |
| 3338 | /* Hold the call for some time */ |
| 3339 | f_sleep(1.0); |
| 3340 | |
| 3341 | /* Release the call (does Clear Complete itself) */ |
| 3342 | f_call_hangup(cpars, true); |
| 3343 | } |
| 3344 | testcase TC_lu_and_mt_ussd_during_mt_call() runs on MTC_CT { |
| 3345 | var BSC_ConnHdlr vc_conn; |
| 3346 | f_init(); |
| 3347 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_ussd_during_mt_call), 49); |
| 3348 | vc_conn.done; |
| 3349 | } |
| 3350 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3351 | |
Vadim Yanitskiy | 2daf52d | 2018-06-21 04:19:58 +0700 | [diff] [blame] | 3352 | /* LU followed by MO USSD request and MO Release during transaction */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3353 | friend function f_tc_lu_and_mo_ussd_mo_release(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 2daf52d | 2018-06-21 04:19:58 +0700 | [diff] [blame] | 3354 | runs on BSC_ConnHdlr { |
| 3355 | f_init_handler(pars); |
| 3356 | |
| 3357 | /* Perform location update */ |
| 3358 | f_perform_lu(); |
| 3359 | |
| 3360 | /* Send CM Service Request for SS/USSD */ |
| 3361 | f_establish_fully(EST_TYPE_SS_ACT); |
| 3362 | |
| 3363 | /* We need to inspect GSUP activity */ |
| 3364 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3365 | |
| 3366 | var template OCTN facility_ms_req := f_USSD_FACILITY_IE_INVOKE( |
| 3367 | invoke_id := 1, /* Initial request */ |
| 3368 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 3369 | ussd_string := "*6766*266#" |
| 3370 | ); |
| 3371 | |
| 3372 | var template OCTN facility_net_req := f_USSD_FACILITY_IE_INVOKE( |
| 3373 | invoke_id := 2, /* Counter request */ |
| 3374 | op_code := SS_OP_CODE_USS_REQUEST, |
| 3375 | ussd_string := "Password?!?" |
| 3376 | ) |
| 3377 | |
| 3378 | /* Compose MO SS/REGISTER message with request */ |
| 3379 | var template (value) PDU_ML3_MS_NW ussd_ms_req := ts_ML3_MO_SS_REGISTER( |
| 3380 | tid := 1, /* We just need a single transaction */ |
| 3381 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3382 | facility := valueof(facility_ms_req) |
| 3383 | ); |
| 3384 | |
| 3385 | /* Compose expected MSC -> HLR message */ |
| 3386 | var template GSUP_PDU gsup_ms_req := tr_GSUP_PROC_SS_REQ( |
| 3387 | imsi := g_pars.imsi, |
| 3388 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3389 | ss := valueof(facility_ms_req) |
| 3390 | ); |
| 3391 | |
| 3392 | /* To be used for sending response with correct session ID */ |
| 3393 | var GSUP_PDU gsup_ms_req_complete; |
| 3394 | |
| 3395 | /* Initiate a new transaction */ |
| 3396 | BSSAP.send(ts_PDU_DTAP_MO(ussd_ms_req)); |
| 3397 | /* Expect GSUP request with original Facility IE */ |
| 3398 | gsup_ms_req_complete := f_expect_gsup_msg(gsup_ms_req); |
| 3399 | |
| 3400 | /* Compose the response from HLR using received session ID */ |
| 3401 | var template (value) GSUP_PDU gsup_net_req := ts_GSUP_PROC_SS_REQ( |
| 3402 | imsi := g_pars.imsi, |
| 3403 | sid := gsup_ms_req_complete.ies[1].val.session_id, |
| 3404 | state := OSMO_GSUP_SESSION_STATE_CONTINUE, |
| 3405 | ss := valueof(facility_net_req) |
| 3406 | ); |
| 3407 | |
| 3408 | /* Compose expected MT SS/FACILITY template with counter request */ |
| 3409 | var template PDU_ML3_NW_MS ussd_net_req := tr_ML3_MT_SS_FACILITY( |
| 3410 | tid := 1, /* Response should arrive within the same transaction */ |
| 3411 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 3412 | facility := valueof(facility_net_req) |
| 3413 | ); |
| 3414 | |
| 3415 | /* Send response over GSUP */ |
| 3416 | GSUP.send(gsup_net_req); |
| 3417 | /* Expect MT SS/FACILITY message with counter request */ |
| 3418 | f_expect_mt_dtap_msg(ussd_net_req); |
| 3419 | |
| 3420 | /* Compose MO SS/RELEASE COMPLETE */ |
| 3421 | var template (value) PDU_ML3_MS_NW ussd_abort := ts_ML3_MO_SS_RELEASE_COMPLETE( |
| 3422 | tid := 1, /* Response should arrive within the same transaction */ |
| 3423 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3424 | facility := omit |
| 3425 | /* TODO: cause? */ |
| 3426 | ); |
| 3427 | |
| 3428 | /* Compose expected HLR -> MSC abort message */ |
| 3429 | var template GSUP_PDU gsup_abort := tr_GSUP_PROC_SS_REQ( |
| 3430 | imsi := g_pars.imsi, |
| 3431 | sid := gsup_ms_req_complete.ies[1].val.session_id, |
| 3432 | state := OSMO_GSUP_SESSION_STATE_END |
| 3433 | ); |
| 3434 | |
| 3435 | /* Abort transaction */ |
| 3436 | BSSAP.send(ts_PDU_DTAP_MO(ussd_abort)); |
| 3437 | /* Expect GSUP message indicating abort */ |
| 3438 | f_expect_gsup_msg(gsup_abort); |
| 3439 | |
| 3440 | f_expect_clear(); |
| 3441 | } |
| 3442 | testcase TC_lu_and_mo_ussd_mo_release() runs on MTC_CT { |
| 3443 | var BSC_ConnHdlr vc_conn; |
| 3444 | f_init(); |
| 3445 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_mo_release), 50); |
| 3446 | vc_conn.done; |
| 3447 | } |
| 3448 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3449 | |
Vadim Yanitskiy | 0e392dd | 2018-11-29 00:47:54 +0700 | [diff] [blame] | 3450 | /* LU followed by MO USSD request and MT Release due to timeout */ |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3451 | friend function f_tc_lu_and_ss_session_timeout(charstring id, BSC_ConnHdlrPars pars) |
Vadim Yanitskiy | 0e392dd | 2018-11-29 00:47:54 +0700 | [diff] [blame] | 3452 | runs on BSC_ConnHdlr { |
| 3453 | f_init_handler(pars); |
| 3454 | |
| 3455 | /* Perform location update */ |
| 3456 | f_perform_lu(); |
| 3457 | |
| 3458 | /* Send CM Service Request for SS/USSD */ |
| 3459 | f_establish_fully(EST_TYPE_SS_ACT); |
| 3460 | |
| 3461 | /* We need to inspect GSUP activity */ |
| 3462 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3463 | |
| 3464 | var template OCTN facility_ms_req := f_USSD_FACILITY_IE_INVOKE( |
| 3465 | invoke_id := 1, |
| 3466 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 3467 | ussd_string := "#release_me"); |
| 3468 | |
| 3469 | /* Compose MO SS/REGISTER message with request */ |
| 3470 | var template (value) PDU_ML3_MS_NW ussd_ms_req := ts_ML3_MO_SS_REGISTER( |
| 3471 | tid := 1, /* An arbitrary transaction identifier */ |
| 3472 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3473 | facility := valueof(facility_ms_req)); |
| 3474 | |
| 3475 | /* Compose expected MSC -> HLR message */ |
| 3476 | var template GSUP_PDU gsup_ms_req := tr_GSUP_PROC_SS_REQ( |
| 3477 | imsi := g_pars.imsi, |
| 3478 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3479 | ss := valueof(facility_ms_req)); |
| 3480 | |
| 3481 | /* To be used for sending response with correct session ID */ |
| 3482 | var GSUP_PDU gsup_ms_req_complete; |
| 3483 | |
| 3484 | /* Initiate a new SS transaction */ |
| 3485 | BSSAP.send(ts_PDU_DTAP_MO(ussd_ms_req)); |
| 3486 | /* Expect GSUP request with original Facility IE */ |
| 3487 | gsup_ms_req_complete := f_expect_gsup_msg(gsup_ms_req); |
| 3488 | |
| 3489 | /* Don't respond, wait for timeout */ |
| 3490 | f_sleep(3.0); |
| 3491 | |
| 3492 | var template PDU_ML3_NW_MS dtap_rel := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3493 | tid := 1, /* Should match the request's tid */ |
| 3494 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 3495 | cause := *, /* TODO: expect some specific value */ |
| 3496 | facility := omit); |
| 3497 | |
| 3498 | var template GSUP_PDU gsup_rel := tr_GSUP_PROC_SS_ERR( |
| 3499 | imsi := g_pars.imsi, |
| 3500 | sid := gsup_ms_req_complete.ies[1].val.session_id, |
| 3501 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3502 | cause := ?); /* TODO: expect some specific value */ |
| 3503 | |
| 3504 | /* Expect release on both interfaces */ |
| 3505 | interleave { |
| 3506 | [] BSSAP.receive(tr_PDU_DTAP_MT(dtap_rel)) { }; |
| 3507 | [] GSUP.receive(gsup_rel) { }; |
| 3508 | } |
| 3509 | |
| 3510 | f_expect_clear(); |
| 3511 | setverdict(pass); |
| 3512 | } |
| 3513 | testcase TC_lu_and_ss_session_timeout() runs on MTC_CT { |
| 3514 | var BSC_ConnHdlr vc_conn; |
| 3515 | f_init(); |
Vadim Yanitskiy | 36d28dd | 2018-12-03 02:45:45 +0700 | [diff] [blame] | 3516 | f_vty_config(MSCVTY, "msc", "ncss guard-timeout 3"); |
Vadim Yanitskiy | 0e392dd | 2018-11-29 00:47:54 +0700 | [diff] [blame] | 3517 | vc_conn := f_start_handler(refers(f_tc_lu_and_ss_session_timeout), 51); |
| 3518 | vc_conn.done; |
Vadim Yanitskiy | 36d28dd | 2018-12-03 02:45:45 +0700 | [diff] [blame] | 3519 | f_vty_config(MSCVTY, "msc", "ncss guard-timeout 0"); |
Vadim Yanitskiy | 0e392dd | 2018-11-29 00:47:54 +0700 | [diff] [blame] | 3520 | } |
| 3521 | |
Vadim Yanitskiy | 0e6c9f5 | 2019-06-15 01:01:28 +0700 | [diff] [blame] | 3522 | /* MT (network-originated) USSD for unknown subscriber */ |
| 3523 | friend function f_tc_mt_ussd_for_unknown_subscr(charstring id, BSC_ConnHdlrPars pars) |
| 3524 | runs on BSC_ConnHdlr { |
| 3525 | var hexstring imsi := '000000000000000'H; /* Some unknown IMSI */ |
| 3526 | var OCT4 sid := '20000222'O; |
Vadim Yanitskiy | 0e6c9f5 | 2019-06-15 01:01:28 +0700 | [diff] [blame] | 3527 | |
| 3528 | f_init_handler(pars); |
| 3529 | f_ran_register_imsi(imsi, 'FFFFFFFF'O); |
| 3530 | f_create_gsup_expect(hex2str(imsi)); |
| 3531 | |
| 3532 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3533 | imsi := imsi, |
| 3534 | sid := sid, |
| 3535 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3536 | ss := f_rnd_octstring(23) |
| 3537 | ); |
| 3538 | |
| 3539 | /* Error with cause GMM_CAUSE_IMSI_UNKNOWN */ |
| 3540 | var template GSUP_PDU gsup_rsp := tr_GSUP_PROC_SS_ERR( |
| 3541 | imsi := imsi, |
| 3542 | sid := sid, |
| 3543 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3544 | cause := 2 /* FIXME: introduce an enumerated type! */ |
| 3545 | ); |
| 3546 | |
| 3547 | /* Initiate a MT USSD notification */ |
| 3548 | GSUP.send(gsup_req); |
| 3549 | |
| 3550 | /* Expect GSUP PROC_SS_ERROR message */ |
Vadim Yanitskiy | 851798c | 2019-06-15 14:22:28 +0700 | [diff] [blame] | 3551 | f_expect_gsup_msg(gsup_rsp); |
Vadim Yanitskiy | 0e6c9f5 | 2019-06-15 01:01:28 +0700 | [diff] [blame] | 3552 | } |
| 3553 | testcase TC_mt_ussd_for_unknown_subscr() runs on MTC_CT { |
| 3554 | var BSC_ConnHdlr vc_conn; |
| 3555 | f_init(); |
| 3556 | vc_conn := f_start_handler(refers(f_tc_mt_ussd_for_unknown_subscr), 0); |
| 3557 | vc_conn.done; |
| 3558 | } |
| 3559 | |
Vadim Yanitskiy | c3c07d4 | 2019-06-17 23:00:44 +0700 | [diff] [blame] | 3560 | /* MO (mobile-originated) SS/USSD for unknown transaction */ |
| 3561 | friend function f_tc_mo_ussd_for_unknown_trans(charstring id, BSC_ConnHdlrPars pars) |
| 3562 | runs on BSC_ConnHdlr { |
| 3563 | f_init_handler(pars); |
| 3564 | |
| 3565 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
| 3566 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3567 | |
| 3568 | /* Perform location update */ |
| 3569 | f_perform_lu(); |
| 3570 | |
| 3571 | /* Send CM Service Request for SS/USSD */ |
| 3572 | f_establish_fully(EST_TYPE_SS_ACT); |
| 3573 | |
| 3574 | /* GSM 04.80 FACILITY message for a non-existing transaction */ |
| 3575 | var template (value) PDU_ML3_MS_NW mo_ss_fac := ts_ML3_MO_SS_FACILITY( |
| 3576 | tid := 1, /* An arbitrary transaction identifier */ |
| 3577 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3578 | facility := f_rnd_octstring(23) /* We don't care about the Facility IE */ |
| 3579 | ); |
| 3580 | |
| 3581 | /* GSM 04.80 RELEASE COMPLETE message for a non-existing transaction */ |
| 3582 | var template (value) PDU_ML3_MS_NW mo_ss_rel := ts_ML3_MO_SS_RELEASE_COMPLETE( |
| 3583 | tid := 1, /* An arbitrary transaction identifier */ |
| 3584 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3585 | facility := f_rnd_octstring(23) /* We don't care about the Facility IE */ |
| 3586 | ); |
| 3587 | |
| 3588 | /* Expected response from the network */ |
| 3589 | var template PDU_ML3_NW_MS mt_ss_rel := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3590 | tid := 1, /* Same as in the FACILITY message */ |
| 3591 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 3592 | facility := omit |
| 3593 | ); |
| 3594 | |
| 3595 | /* Send GSM 04.80 FACILITY for non-existing transaction */ |
| 3596 | BSSAP.send(ts_PDU_DTAP_MO(mo_ss_fac)); |
| 3597 | |
| 3598 | /* Expect GSM 04.80 RELEASE COMPLETE message */ |
| 3599 | f_expect_mt_dtap_msg(mt_ss_rel); |
| 3600 | f_expect_clear(); |
| 3601 | |
| 3602 | /* Send another CM Service Request for SS/USSD */ |
| 3603 | f_establish_fully(EST_TYPE_SS_ACT); |
| 3604 | |
| 3605 | /* Send GSM 04.80 RELEASE COMPLETE for non-existing transaction */ |
| 3606 | BSSAP.send(ts_PDU_DTAP_MO(mo_ss_rel)); |
| 3607 | |
| 3608 | /* Expect GSM 04.80 RELEASE COMPLETE message */ |
| 3609 | f_expect_mt_dtap_msg(mt_ss_rel); |
| 3610 | f_expect_clear(); |
| 3611 | } |
| 3612 | testcase TC_mo_ussd_for_unknown_trans() runs on MTC_CT { |
| 3613 | var BSC_ConnHdlr vc_conn; |
| 3614 | f_init(); |
| 3615 | vc_conn := f_start_handler(refers(f_tc_mo_ussd_for_unknown_trans), 111); |
| 3616 | vc_conn.done; |
| 3617 | } |
| 3618 | |
Vadim Yanitskiy | d612d28 | 2019-06-15 14:46:03 +0700 | [diff] [blame] | 3619 | /* MT (network-originated) USSD for unknown session */ |
| 3620 | friend function f_tc_proc_ss_for_unknown_session(charstring id, BSC_ConnHdlrPars pars) |
| 3621 | runs on BSC_ConnHdlr { |
| 3622 | var OCT4 sid := '20000333'O; |
| 3623 | |
| 3624 | f_init_handler(pars); |
| 3625 | |
| 3626 | /* Perform location update */ |
| 3627 | f_perform_lu(); |
| 3628 | |
| 3629 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
| 3630 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3631 | |
| 3632 | /* Request referencing a non-existing SS session */ |
| 3633 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3634 | imsi := g_pars.imsi, |
| 3635 | sid := sid, |
| 3636 | state := OSMO_GSUP_SESSION_STATE_CONTINUE, |
| 3637 | ss := f_rnd_octstring(23) |
| 3638 | ); |
| 3639 | |
| 3640 | /* Error with some cause value */ |
| 3641 | var template GSUP_PDU gsup_rsp := tr_GSUP_PROC_SS_ERR( |
| 3642 | imsi := g_pars.imsi, |
| 3643 | sid := sid, |
| 3644 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3645 | cause := ? /* FIXME: introduce an enumerated type! */ |
| 3646 | ); |
| 3647 | |
| 3648 | /* Initiate a MT USSD notification */ |
| 3649 | GSUP.send(gsup_req); |
| 3650 | |
| 3651 | /* Expect GSUP PROC_SS_ERROR message */ |
| 3652 | f_expect_gsup_msg(gsup_rsp); |
| 3653 | } |
| 3654 | testcase TC_proc_ss_for_unknown_session() runs on MTC_CT { |
| 3655 | var BSC_ConnHdlr vc_conn; |
| 3656 | f_init(); |
| 3657 | vc_conn := f_start_handler(refers(f_tc_proc_ss_for_unknown_session), 110); |
| 3658 | vc_conn.done; |
| 3659 | } |
| 3660 | |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 3661 | /* MT (network-originated) USSD and no response to Paging Request */ |
| 3662 | friend function f_tc_proc_ss_paging_fail(charstring id, BSC_ConnHdlrPars pars) |
| 3663 | runs on BSC_ConnHdlr { |
| 3664 | timer TP := 2.0; /* Paging timer */ |
| 3665 | |
| 3666 | f_init_handler(pars); |
| 3667 | |
| 3668 | /* Perform location update */ |
| 3669 | f_perform_lu(); |
| 3670 | |
| 3671 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
| 3672 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3673 | |
| 3674 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3675 | imsi := g_pars.imsi, |
| 3676 | sid := '20000444'O, |
| 3677 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3678 | ss := f_rnd_octstring(23) |
| 3679 | ); |
| 3680 | |
| 3681 | /* Error with some cause value */ |
| 3682 | var template GSUP_PDU gsup_rsp := tr_GSUP_PROC_SS_ERR( |
| 3683 | imsi := g_pars.imsi, |
| 3684 | sid := '20000444'O, |
| 3685 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3686 | cause := ? /* FIXME: introduce an enumerated type! */ |
| 3687 | ); |
| 3688 | |
| 3689 | /* Initiate a MT USSD notification */ |
| 3690 | GSUP.send(gsup_req); |
| 3691 | |
| 3692 | /* Send it to MSC and expect Paging Request */ |
| 3693 | TP.start; |
| 3694 | alt { |
| 3695 | [pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) { |
| 3696 | setverdict(pass); |
| 3697 | } |
| 3698 | [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) { |
| 3699 | setverdict(pass); |
| 3700 | } |
| 3701 | /* We don't expect anything else */ |
| 3702 | [] as_unexp_gsup_or_bssap_msg(); |
| 3703 | [] TP.timeout { |
| 3704 | setverdict(fail, "Timeout waiting for Paging Request"); |
| 3705 | } |
| 3706 | } |
| 3707 | |
Vadim Yanitskiy | d24b525 | 2019-10-02 00:04:51 +0700 | [diff] [blame] | 3708 | /* Wait up to 20 seconds for GSUP PROC_SS_ERROR message. |
| 3709 | * OsmoMSC waits for Paging Response 10 seconds by default. */ |
| 3710 | f_expect_gsup_msg(gsup_rsp, T_val := 20.0); |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 3711 | } |
| 3712 | testcase TC_proc_ss_paging_fail() runs on MTC_CT { |
| 3713 | var BSC_ConnHdlr vc_conn; |
| 3714 | f_init(); |
| 3715 | vc_conn := f_start_handler(refers(f_tc_proc_ss_paging_fail), 101); |
| 3716 | vc_conn.done; |
| 3717 | } |
| 3718 | |
Vadim Yanitskiy | 29ba8d6 | 2019-06-16 15:19:41 +0700 | [diff] [blame] | 3719 | /* MT (network-originated) USSD followed by immediate abort */ |
| 3720 | friend function f_tc_proc_ss_abort(charstring id, BSC_ConnHdlrPars pars) |
| 3721 | runs on BSC_ConnHdlr { |
| 3722 | var octetstring facility := f_rnd_octstring(23); |
| 3723 | var OCT4 sid := '20000555'O; |
| 3724 | timer TP := 2.0; |
| 3725 | |
| 3726 | f_init_handler(pars); |
| 3727 | |
| 3728 | /* Perform location update */ |
| 3729 | f_perform_lu(); |
| 3730 | |
| 3731 | f_ran_register_imsi(g_pars.imsi, 'FFFFFFFF'O); |
| 3732 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3733 | |
| 3734 | /* PROC_SS_REQ initiates a mobile-originated SS/USSD session */ |
| 3735 | var template (value) GSUP_PDU gsup_req := ts_GSUP_PROC_SS_REQ( |
| 3736 | imsi := g_pars.imsi, sid := sid, |
| 3737 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 3738 | ss := facility |
| 3739 | ); |
| 3740 | |
| 3741 | /* On the MS side, we expect GSM 04.80 REGISTER message */ |
| 3742 | var template PDU_ML3_NW_MS dtap_reg := tr_ML3_MT_SS_REGISTER( |
| 3743 | tid := 0, /* Most likely, it should be 0 */ |
| 3744 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3745 | facility := facility |
| 3746 | ); |
| 3747 | |
| 3748 | /* PROC_SS_ERR with SESSION_STATE_END terminates the SS/USSD session */ |
| 3749 | var template (value) GSUP_PDU gsup_abort := ts_GSUP_PROC_SS_ERR( |
| 3750 | imsi := g_pars.imsi, sid := sid, |
| 3751 | state := OSMO_GSUP_SESSION_STATE_END, |
| 3752 | cause := 0 /* FIXME: introduce an enumerated type! */ |
| 3753 | ); |
| 3754 | |
| 3755 | /* On the MS side, we expect GSM 04.80 REGISTER message */ |
| 3756 | var template PDU_ML3_NW_MS dtap_rel := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 3757 | tid := 0, /* Most likely, it should be 0 */ |
| 3758 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 3759 | cause := *, /* FIXME: expect some specific cause value */ |
| 3760 | facility := omit |
| 3761 | ); |
| 3762 | |
| 3763 | /* Initiate a MT USSD with random payload */ |
| 3764 | GSUP.send(gsup_req); |
| 3765 | |
| 3766 | /* Expect Paging Request */ |
| 3767 | TP.start; |
| 3768 | alt { |
| 3769 | [pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) { |
| 3770 | setverdict(pass); |
| 3771 | } |
| 3772 | [not pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) { |
| 3773 | setverdict(pass); |
| 3774 | } |
| 3775 | /* We don't expect anything else */ |
| 3776 | [] as_unexp_gsup_or_bssap_msg(); |
| 3777 | [] TP.timeout { |
| 3778 | setverdict(fail, "Timeout waiting for Paging Request"); |
| 3779 | } |
| 3780 | } |
| 3781 | |
| 3782 | /* Send Paging Response and establish connection */ |
| 3783 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 3784 | /* Expect MT REGISTER message with random facility */ |
| 3785 | f_expect_mt_dtap_msg(dtap_reg); |
| 3786 | |
| 3787 | /* HLR/EUSE decides to abort the session even |
| 3788 | * before getting any response from the MS */ |
| 3789 | /* Initiate a MT USSD with random payload */ |
| 3790 | GSUP.send(gsup_abort); |
| 3791 | |
| 3792 | /* Expect RELEASE COMPLETE on ths MS side */ |
| 3793 | f_expect_mt_dtap_msg(dtap_rel); |
| 3794 | |
| 3795 | f_expect_clear(); |
| 3796 | } |
| 3797 | testcase TC_proc_ss_abort() runs on MTC_CT { |
| 3798 | var BSC_ConnHdlr vc_conn; |
| 3799 | f_init(); |
| 3800 | vc_conn := f_start_handler(refers(f_tc_proc_ss_abort), 102); |
| 3801 | vc_conn.done; |
| 3802 | } |
| 3803 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 3804 | |
Stefan Sperling | 89eb1f3 | 2018-12-17 15:06:20 +0100 | [diff] [blame] | 3805 | /* A5/1 only permitted on network side; attempt an invalid CIPHER MODE COMPLETE with A5/3 which MSC should reject. */ |
| 3806 | private function f_tc_cipher_complete_with_invalid_cipher(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 3807 | pars.net.expect_auth := true; |
| 3808 | pars.net.expect_ciph := true; |
| 3809 | pars.net.kc_support := '02'O; /* A5/1 only */ |
| 3810 | f_init_handler(pars); |
| 3811 | |
| 3812 | g_pars.vec := f_gen_auth_vec_2g(); |
| 3813 | |
| 3814 | /* Can't use f_perform_lu() directly. Code below is based on it. */ |
| 3815 | |
| 3816 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 3817 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3818 | |
| 3819 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 3820 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
Harald Welte | dceacc7 | 2019-04-21 20:58:35 +0200 | [diff] [blame] | 3821 | f_cl3_or_initial_ue(l3_lu); |
Stefan Sperling | 89eb1f3 | 2018-12-17 15:06:20 +0100 | [diff] [blame] | 3822 | |
| 3823 | f_mm_auth(); |
| 3824 | |
| 3825 | var OCT1 a5_net := f_alg_mask_from_cm(g_pars.cm2); |
| 3826 | var OCT1 a5_intersect := g_pars.net.kc_support and4b a5_net; |
| 3827 | alt { |
| 3828 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(a5_intersect, g_pars.vec.kc)) { |
| 3829 | BSSAP.send(ts_BSSMAP_CipherModeCompl(int2oct(4 /* "accept" A5/3 */, 1))); |
| 3830 | } |
| 3831 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?, g_pars.vec.kc)) { |
| 3832 | setverdict(fail, "Wrong ciphering algorithm mask in CiphModCmd"); |
| 3833 | mtc.stop; |
| 3834 | } |
| 3835 | [] BSSAP.receive { |
| 3836 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
| 3837 | mtc.stop; |
| 3838 | } |
| 3839 | } |
| 3840 | |
| 3841 | /* Expect LU reject from MSC. */ |
| 3842 | alt { |
| 3843 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 3844 | setverdict(pass); |
| 3845 | } |
| 3846 | [] BSSAP.receive { |
| 3847 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
| 3848 | mtc.stop; |
| 3849 | } |
| 3850 | } |
Stefan Sperling | c620b35 | 2018-12-18 17:23:36 +0100 | [diff] [blame] | 3851 | f_expect_clear(); |
Stefan Sperling | 89eb1f3 | 2018-12-17 15:06:20 +0100 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | testcase TC_cipher_complete_with_invalid_cipher() runs on MTC_CT { |
| 3855 | var BSC_ConnHdlr vc_conn; |
| 3856 | f_init(); |
| 3857 | f_vty_config(MSCVTY, "network", "encryption a5 1"); |
| 3858 | |
| 3859 | vc_conn := f_start_handler(refers(f_tc_cipher_complete_with_invalid_cipher), 52); |
| 3860 | vc_conn.done; |
| 3861 | } |
| 3862 | |
Harald Welte | b2284bd | 2019-05-10 11:30:43 +0200 | [diff] [blame] | 3863 | /* Location Update with invalid (non-matching) MCC/MNC reported on BSSMAP level from BSC */ |
| 3864 | friend function f_tc_lu_with_invalid_mcc_mnc(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 3865 | f_init_handler(pars); |
| 3866 | |
| 3867 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 3868 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3869 | |
| 3870 | /* modify the cell ID which will be used to construct the COMPLELTE L3 or InitialUE */ |
| 3871 | g_pars.cell_id := valueof(ts_CellId_CGI('333'H, '22'H, 23, 42)); |
| 3872 | |
| 3873 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 3874 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 3875 | f_cl3_or_initial_ue(l3_lu); |
| 3876 | |
| 3877 | /* Expect LU reject from MSC. */ |
| 3878 | alt { |
| 3879 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 3880 | setverdict(pass); |
| 3881 | } |
| 3882 | [] BSSAP.receive { |
| 3883 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
| 3884 | mtc.stop; |
| 3885 | } |
| 3886 | } |
| 3887 | f_expect_clear(); |
| 3888 | } |
| 3889 | testcase TC_lu_with_invalid_mcc_mnc() runs on MTC_CT { |
| 3890 | var BSC_ConnHdlr vc_conn; |
| 3891 | f_init(); |
| 3892 | vc_conn := f_start_handler(refers(f_tc_lu_with_invalid_mcc_mnc), 54); |
| 3893 | vc_conn.done; |
| 3894 | } |
| 3895 | |
Stefan Sperling | a2d59c6 | 2018-12-18 16:32:44 +0100 | [diff] [blame] | 3896 | private function f_tc_cipher_complete_without_alg(charstring id, BSC_ConnHdlrPars pars, octetstring kc_support) runs on BSC_ConnHdlr { |
| 3897 | pars.net.expect_auth := true; |
| 3898 | pars.net.expect_ciph := true; |
| 3899 | pars.net.kc_support := kc_support; |
| 3900 | f_init_handler(pars); |
| 3901 | |
| 3902 | g_pars.vec := f_gen_auth_vec_2g(); |
| 3903 | |
| 3904 | /* Can't use f_perform_lu() directly. Code below is based on it. */ |
| 3905 | |
| 3906 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 3907 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 3908 | |
| 3909 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 3910 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 3911 | f_cl3_or_initial_ue(l3_lu); |
| 3912 | |
| 3913 | f_mm_auth(); |
| 3914 | |
| 3915 | var OCT1 a5_net := f_alg_mask_from_cm(g_pars.cm2); |
| 3916 | var OCT1 a5_intersect := g_pars.net.kc_support and4b a5_net; |
| 3917 | alt { |
| 3918 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(a5_intersect, g_pars.vec.kc)) { |
| 3919 | BSSAP.send(ts_BSSMAP_CipherModeComplAlg(omit)); |
| 3920 | } |
| 3921 | [] BSSAP.receive(tr_BSSMAP_ClassmarkReq) { |
| 3922 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 3923 | repeat; |
| 3924 | } |
| 3925 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?, g_pars.vec.kc)) { |
| 3926 | setverdict(fail, "Wrong ciphering algorithm mask in CiphModCmd"); |
| 3927 | mtc.stop; |
| 3928 | } |
| 3929 | [] BSSAP.receive { |
| 3930 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
| 3931 | mtc.stop; |
| 3932 | } |
| 3933 | } |
| 3934 | |
| 3935 | /* TODO: Verify MSC is using the best cipher available! How? */ |
| 3936 | |
| 3937 | f_msc_lu_hlr(); |
| 3938 | f_accept_reject_lu(); |
| 3939 | f_expect_clear(); |
| 3940 | setverdict(pass); |
| 3941 | } |
| 3942 | |
| 3943 | /* A5/1 only permitted on network side; attempt CIPHER MODE COMPLETE without specifying the accepted algorithm. */ |
| 3944 | private function f_tc_cipher_complete_1_without_cipher(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 3945 | f_tc_cipher_complete_without_alg(id, pars, '02'O /* A5/1 only */); |
| 3946 | } |
| 3947 | |
| 3948 | /* A5/3 only permitted on network side; attempt CIPHER MODE COMPLETE without specifying the accepted algorithm. */ |
| 3949 | private function f_tc_cipher_complete_3_without_cipher(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 3950 | f_tc_cipher_complete_without_alg(id, pars, '08'O /* A5/3 only */); |
| 3951 | } |
| 3952 | |
| 3953 | /* A5/1 + A5/3 permitted on network side; attempt CIPHER MODE COMPLETE without specifying the accepted algorithm. */ |
| 3954 | private function f_tc_cipher_complete_13_without_cipher(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 3955 | f_tc_cipher_complete_without_alg(id, pars, '0A'O /* A5/1 and A5/3 enabled */); |
| 3956 | } |
| 3957 | |
| 3958 | testcase TC_cipher_complete_1_without_cipher() runs on MTC_CT { |
| 3959 | var BSC_ConnHdlr vc_conn; |
| 3960 | f_init(); |
| 3961 | f_vty_config(MSCVTY, "network", "encryption a5 1"); |
| 3962 | |
| 3963 | vc_conn := f_start_handler(refers(f_tc_cipher_complete_1_without_cipher), 53); |
| 3964 | vc_conn.done; |
| 3965 | } |
| 3966 | |
| 3967 | testcase TC_cipher_complete_3_without_cipher() runs on MTC_CT { |
| 3968 | var BSC_ConnHdlr vc_conn; |
| 3969 | f_init(); |
| 3970 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 3971 | |
| 3972 | vc_conn := f_start_handler(refers(f_tc_cipher_complete_3_without_cipher), 54); |
| 3973 | vc_conn.done; |
| 3974 | } |
| 3975 | |
| 3976 | testcase TC_cipher_complete_13_without_cipher() runs on MTC_CT { |
| 3977 | var BSC_ConnHdlr vc_conn; |
| 3978 | f_init(); |
| 3979 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 3980 | |
| 3981 | vc_conn := f_start_handler(refers(f_tc_cipher_complete_13_without_cipher), 55); |
| 3982 | vc_conn.done; |
| 3983 | } |
Harald Welte | b2284bd | 2019-05-10 11:30:43 +0200 | [diff] [blame] | 3984 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 3985 | /* TODO (SMS): |
| 3986 | * different user data lengths |
| 3987 | * SMPP transaction mode with unsuccessful delivery |
| 3988 | * queued MT-SMS with no paging response + later delivery |
| 3989 | * different data coding schemes |
| 3990 | * multi-part SMS |
| 3991 | * user-data headers |
| 3992 | * TP-PID for SMS to SIM |
| 3993 | * behavior if SMS memory is full + RP-SMMA |
| 3994 | * delivery reports |
| 3995 | * SMPP osmocom extensions |
| 3996 | * more-messages-to-send |
| 3997 | * SMS during ongoing call (SACCH/SAPI3) |
| 3998 | */ |
| 3999 | |
| 4000 | /* TODO (General): |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 4001 | * continue to send repeated MO signalling messages to keep channel open: does MSC tmeout? |
| 4002 | * malformed messages (missing IE, invalid message type): properly rejected? |
| 4003 | * MT call while LU or is ongoing: Do we use existing lchan or page while lchan active? |
| 4004 | * 3G/2G auth permutations |
| 4005 | * encryption algorithms vs. classmark vs. vty config |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 4006 | * send new transaction after/during clear (like SMS, ...) |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 4007 | * too long L3 INFO in DTAP |
| 4008 | * too long / padded BSSAP |
| 4009 | * too long / short TLV values |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 4010 | */ |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 4011 | |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 4012 | /*********************************************************************** |
| 4013 | * SGsAP Testing |
| 4014 | ***********************************************************************/ |
| 4015 | |
Philipp Maier | 948747b | 2019-04-02 15:22:33 +0200 | [diff] [blame] | 4016 | /* Check if a subscriber exists in the VLR */ |
| 4017 | private function f_ctrl_subscr_in_vlr(charstring imsi_or_msisdn) runs on BSC_ConnHdlr return boolean { |
| 4018 | |
| 4019 | var CtrlValue active_subsribers; |
| 4020 | var integer rc; |
| 4021 | active_subsribers := f_ctrl_get(IPA_CTRL, "subscriber-list-active-v1"); |
| 4022 | |
| 4023 | rc := f_strstr(active_subsribers, imsi_or_msisdn); |
| 4024 | if (rc < 0) { |
| 4025 | return false; |
| 4026 | } |
| 4027 | |
| 4028 | return true; |
| 4029 | } |
| 4030 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4031 | /* Perform a location updatye at the A-Interface and run some checks to confirm |
| 4032 | * that everything is back to normal. */ |
| 4033 | private function f_sgsap_bssmap_screening() runs on BSC_ConnHdlr { |
| 4034 | var SmsParameters spars := valueof(t_SmsPars); |
| 4035 | |
| 4036 | /* Perform a location update, the SGs association is expected to fall |
| 4037 | * back to NULL */ |
| 4038 | f_perform_lu(); |
| 4039 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4040 | |
| 4041 | /* Trigger a paging request and expect the paging on BSSMAP, this is |
| 4042 | * to make sure that pagings are sent throught the A-Interface again |
| 4043 | * and not throught the SGs interface.*/ |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4044 | f_ran_register_imsi(g_pars.imsi, g_pars.tmsi); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4045 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4046 | |
| 4047 | alt { |
Harald Welte | e13cfb2 | 2019-04-23 16:52:02 +0200 | [diff] [blame] | 4048 | [g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); { |
| 4049 | setverdict(pass); |
| 4050 | } |
Harald Welte | 62113fc | 2019-05-09 13:04:02 +0200 | [diff] [blame] | 4051 | [not g_pars.ran_is_geran] BSSAP.receive(tr_RANAP_Paging(cs_domain, imsi_hex2oct(g_pars.imsi))) { |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4052 | setverdict(pass); |
| 4053 | } |
| 4054 | [] SGsAP.receive { |
| 4055 | setverdict(fail, "Received unexpected message on SGs"); |
| 4056 | } |
| 4057 | } |
| 4058 | |
| 4059 | /* Send an SMS to make sure that also payload messages are routed |
| 4060 | * throught the A-Interface again */ |
| 4061 | f_establish_fully(EST_TYPE_MO_SMS); |
| 4062 | f_mo_sms(spars); |
| 4063 | f_expect_clear(); |
| 4064 | } |
| 4065 | |
| 4066 | private function f_tc_sgsap_reset(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4067 | var charstring vlr_name; |
| 4068 | f_init_handler(pars); |
| 4069 | |
| 4070 | vlr_name := f_sgsap_reset_mme(mp_mme_name); |
| 4071 | log("VLR name: ", vlr_name); |
| 4072 | setverdict(pass); |
Neels Hofmeyr | c0b520d | 2019-03-06 15:35:50 +0100 | [diff] [blame] | 4073 | f_sleep(1.0); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4074 | } |
| 4075 | |
| 4076 | testcase TC_sgsap_reset() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4077 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4078 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4079 | f_init(1, true); |
| 4080 | pars := f_init_pars(11810, true); |
| 4081 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_reset), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4082 | vc_conn.done; |
| 4083 | } |
| 4084 | |
| 4085 | /* like f_mm_auth() but for SGs */ |
| 4086 | function f_mm_auth_sgs() runs on BSC_ConnHdlr { |
| 4087 | if (g_pars.net.expect_auth) { |
| 4088 | g_pars.vec := f_gen_auth_vec_3g(); |
| 4089 | var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand, |
| 4090 | g_pars.vec.sres, |
| 4091 | g_pars.vec.kc, |
| 4092 | g_pars.vec.ik, |
| 4093 | g_pars.vec.ck, |
| 4094 | g_pars.vec.autn, |
| 4095 | g_pars.vec.res)); |
| 4096 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 4097 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 4098 | SGsAP.receive(tr_ML3_MT_MM_AUTH_REQ_3G(g_pars.vec.rand, g_pars.vec.autn)); |
| 4099 | SGsAP.send(ts_ML3_MT_MM_AUTH_RESP_3G(g_pars.vec.sres, g_pars.vec.res)); |
| 4100 | } |
| 4101 | } |
| 4102 | |
| 4103 | /* like f_perform_lu(), but on SGs rather than BSSAP */ |
| 4104 | function f_sgs_perform_lu() runs on BSC_ConnHdlr { |
| 4105 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4106 | var PDU_SGsAP lur; |
| 4107 | var PDU_SGsAP lua; |
| 4108 | var PDU_SGsAP mm_info; |
| 4109 | var octetstring mm_info_dtap; |
| 4110 | |
| 4111 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 4112 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 4113 | |
| 4114 | lur := valueof(ts_SGsAP_LU_REQ(g_pars.imsi, mme_name, IMSI_attach, |
| 4115 | ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4116 | /* Old LAI, if MS sends it */ |
| 4117 | /* TMSI status, if MS has no valid TMSI */ |
| 4118 | /* IMEISV, if it supports "automatic device detection" */ |
| 4119 | /* TAI, if available in MME */ |
| 4120 | /* E-CGI, if available in MME */ |
| 4121 | SGsAP.send(lur); |
| 4122 | |
| 4123 | /* FIXME: is this really done over SGs? The Ue is already authenticated |
| 4124 | * via the MME ... */ |
| 4125 | f_mm_auth_sgs(); |
| 4126 | |
| 4127 | /* Expect MSC to perform LU with HLR */ |
| 4128 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 4129 | GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 4130 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 4131 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 4132 | |
| 4133 | alt { |
| 4134 | [] SGsAP.receive(tr_SGsAP_LU_ACCEPT(g_pars.imsi, ?)) -> value lua { |
| 4135 | if (isvalue(lua.sGsAP_LOCATION_UPDATE_ACCEPT.newTMSIorIMSI.iD.iD.tmsi_ptmsi.octets)) { |
| 4136 | g_pars.tmsi :=lua.sGsAP_LOCATION_UPDATE_ACCEPT.newTMSIorIMSI.iD.iD.tmsi_ptmsi.octets |
| 4137 | SGsAP.send(ts_SGsAP_TMSI_REALL_CMPL(g_pars.imsi)); |
| 4138 | } |
| 4139 | setverdict(pass); |
| 4140 | } |
| 4141 | [] SGsAP.receive(tr_SGsAP_LU_REJECT(g_pars.imsi, ?, ?)) { |
| 4142 | setverdict(fail, "Received LU-REJECT instead of ACCEPT"); |
| 4143 | } |
| 4144 | [] SGsAP.receive { |
| 4145 | setverdict(fail, "Received unexpected message on SGs"); |
| 4146 | } |
| 4147 | } |
| 4148 | |
| 4149 | /* Check MM information */ |
| 4150 | if (mp_mm_info == true) { |
| 4151 | SGsAP.receive(tr_SGsAP_MM_INFO_REQ(g_pars.imsi, ?)) -> value mm_info; |
| 4152 | mm_info_dtap := '0532'O & mm_info.sGsAP_MM_INFORMATION_REQUEST.mM_Information.information; |
| 4153 | if (not match(dec_PDU_ML3_NW_MS(mm_info_dtap), tr_ML3_MT_MM_Info)) { |
| 4154 | setverdict(fail, "Unexpected MM Information"); |
| 4155 | } |
| 4156 | } |
| 4157 | |
| 4158 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4159 | } |
| 4160 | |
| 4161 | private function f_tc_sgsap_lu(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4162 | f_init_handler(pars); |
| 4163 | f_sgs_perform_lu(); |
| 4164 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4165 | |
| 4166 | f_sgsap_bssmap_screening(); |
| 4167 | |
| 4168 | setverdict(pass); |
| 4169 | } |
| 4170 | testcase TC_sgsap_lu() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4171 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4172 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4173 | f_init(1, true); |
| 4174 | pars := f_init_pars(11811, true); |
| 4175 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4176 | vc_conn.done; |
| 4177 | } |
| 4178 | |
| 4179 | /* Do LU by IMSI, refuse it on GSUP and expect LU REJ back to MS */ |
| 4180 | private function f_tc_sgsap_lu_imsi_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4181 | f_init_handler(pars); |
| 4182 | var PDU_SGsAP lur; |
| 4183 | |
| 4184 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 4185 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4186 | lur := valueof(ts_SGsAP_LU_REQ(g_pars.imsi, mme_name, IMSI_attach, |
| 4187 | ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4188 | SGsAP.send(lur); |
| 4189 | |
| 4190 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 4191 | GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23)); |
| 4192 | alt { |
| 4193 | [] SGsAP.receive(tr_SGsAP_LU_REJECT(g_pars.imsi, ?, ?)) { |
| 4194 | setverdict(pass); |
| 4195 | } |
| 4196 | [] SGsAP.receive(tr_SGsAP_LU_ACCEPT(g_pars.imsi, ?)) { |
| 4197 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
| 4198 | mtc.stop; |
| 4199 | } |
| 4200 | [] SGsAP.receive { |
| 4201 | setverdict(fail, "Received unexpected message on SGs"); |
| 4202 | } |
| 4203 | } |
| 4204 | |
| 4205 | f_sgsap_bssmap_screening(); |
| 4206 | |
| 4207 | setverdict(pass); |
| 4208 | } |
| 4209 | testcase TC_sgsap_lu_imsi_reject() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4210 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4211 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4212 | f_init(1, true); |
| 4213 | pars := f_init_pars(11812, true); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4214 | |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4215 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu_imsi_reject), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4216 | vc_conn.done; |
| 4217 | } |
| 4218 | |
| 4219 | /* Do LU by IMSI, but then remain silent so that Ts6-1 times out */ |
| 4220 | private function f_tc_sgsap_lu_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4221 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4222 | var PDU_SGsAP lur; |
| 4223 | |
| 4224 | f_init_handler(pars); |
| 4225 | |
| 4226 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 4227 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 4228 | |
| 4229 | lur := valueof(ts_SGsAP_LU_REQ(g_pars.imsi, mme_name, IMSI_attach, |
| 4230 | ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4231 | /* Old LAI, if MS sends it */ |
| 4232 | /* TMSI status, if MS has no valid TMSI */ |
| 4233 | /* IMEISV, if it supports "automatic device detection" */ |
| 4234 | /* TAI, if available in MME */ |
| 4235 | /* E-CGI, if available in MME */ |
| 4236 | SGsAP.send(lur); |
| 4237 | |
| 4238 | /* FIXME: is this really done over SGs? The Ue is already authenticated |
| 4239 | * via the MME ... */ |
| 4240 | f_mm_auth_sgs(); |
| 4241 | |
| 4242 | /* Expect MSC to perform LU with HLR */ |
| 4243 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 4244 | GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 4245 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 4246 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 4247 | |
| 4248 | alt { |
| 4249 | [] SGsAP.receive(tr_SGsAP_LU_ACCEPT(g_pars.imsi, ?)) { |
| 4250 | setverdict(pass); |
| 4251 | } |
| 4252 | [] SGsAP.receive(tr_SGsAP_LU_REJECT(g_pars.imsi, ?, ?)) { |
| 4253 | setverdict(fail, "Received LU-REJECT instead of ACCEPT"); |
| 4254 | } |
| 4255 | [] SGsAP.receive { |
| 4256 | setverdict(fail, "Received unexpected message on SGs"); |
| 4257 | } |
| 4258 | } |
| 4259 | |
| 4260 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4261 | |
| 4262 | /* Wait until the VLR has abort the TMSI reallocation procedure */ |
| 4263 | f_sleep(45.0); |
| 4264 | |
| 4265 | /* The outcome does not change the SGs state, see also 5.2.3.4 */ |
| 4266 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4267 | |
| 4268 | f_sgsap_bssmap_screening(); |
| 4269 | |
| 4270 | setverdict(pass); |
| 4271 | } |
| 4272 | testcase TC_sgsap_lu_and_nothing() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4273 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4274 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4275 | f_init(1, true); |
| 4276 | pars := f_init_pars(11813, true); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4277 | |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4278 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu_and_nothing), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4279 | vc_conn.done; |
| 4280 | } |
| 4281 | |
| 4282 | private function f_tc_sgsap_expl_imsi_det_eps(charstring id, BSC_ConnHdlrPars pars) |
| 4283 | runs on BSC_ConnHdlr { |
| 4284 | f_init_handler(pars); |
| 4285 | f_sgs_perform_lu(); |
| 4286 | f_sleep(3.0); |
| 4287 | |
| 4288 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4289 | SGsAP.send(ts_SGsAP_EPS_DETACH_IND(g_pars.imsi, mme_name, UE_initiated)); |
| 4290 | SGsAP.receive(tr_SGsAP_EPS_DETACH_ACK(g_pars.imsi)); |
| 4291 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4292 | |
| 4293 | f_sgsap_bssmap_screening(); |
| 4294 | |
| 4295 | setverdict(pass); |
| 4296 | } |
| 4297 | testcase TC_sgsap_expl_imsi_det_eps() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4298 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4299 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4300 | f_init(1, true); |
| 4301 | pars := f_init_pars(11814, true); |
| 4302 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_expl_imsi_det_eps), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4303 | vc_conn.done; |
| 4304 | } |
| 4305 | |
Philipp Maier | fc19f17 | 2019-03-21 11:17:54 +0100 | [diff] [blame] | 4306 | private function f_tc_sgsap_impl_imsi_det_eps(charstring id, BSC_ConnHdlrPars pars) |
| 4307 | runs on BSC_ConnHdlr { |
| 4308 | f_init_handler(pars); |
| 4309 | f_sgs_perform_lu(); |
| 4310 | f_sleep(3.0); |
| 4311 | |
| 4312 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4313 | SGsAP.send(ts_SGsAP_EPS_DETACH_IND(g_pars.imsi, mme_name, network_initiated)); |
| 4314 | SGsAP.receive(tr_SGsAP_EPS_DETACH_ACK(g_pars.imsi)); |
| 4315 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4316 | |
| 4317 | f_sgsap_bssmap_screening(); |
| 4318 | |
| 4319 | setverdict(pass); |
| 4320 | } |
| 4321 | testcase TC_sgsap_impl_imsi_det_eps() runs on MTC_CT { |
| 4322 | var BSC_ConnHdlrPars pars; |
| 4323 | var BSC_ConnHdlr vc_conn; |
| 4324 | f_init(1, true); |
| 4325 | pars := f_init_pars(11814, true); |
| 4326 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_impl_imsi_det_eps), pars); |
| 4327 | vc_conn.done; |
| 4328 | } |
| 4329 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4330 | private function f_tc_sgsap_expl_imsi_det_noneps(charstring id, BSC_ConnHdlrPars pars) |
| 4331 | runs on BSC_ConnHdlr { |
| 4332 | f_init_handler(pars); |
| 4333 | f_sgs_perform_lu(); |
| 4334 | f_sleep(3.0); |
| 4335 | |
| 4336 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4337 | SGsAP.send(ts_SGsAP_IMSI_DETACH_IND(g_pars.imsi, mme_name, combined_UE_initiated)); |
| 4338 | SGsAP.receive(tr_SGsAP_IMSI_DETACH_ACK(g_pars.imsi)); |
Philipp Maier | d08e7e7 | 2019-04-02 15:27:10 +0200 | [diff] [blame] | 4339 | |
| 4340 | if (f_ctrl_subscr_in_vlr(hex2str(g_pars.imsi))) { |
| 4341 | setverdict(fail, "subscriber not removed from VLR"); |
| 4342 | } |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4343 | |
| 4344 | f_sgsap_bssmap_screening(); |
| 4345 | |
| 4346 | setverdict(pass); |
| 4347 | } |
| 4348 | testcase TC_sgsap_expl_imsi_det_noneps() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4349 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4350 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4351 | f_init(1, true); |
| 4352 | pars := f_init_pars(11815, true); |
| 4353 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_expl_imsi_det_noneps), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4354 | vc_conn.done; |
| 4355 | } |
| 4356 | |
Philipp Maier | 5d81270 | 2019-03-21 10:51:26 +0100 | [diff] [blame] | 4357 | private function f_tc_sgsap_impl_imsi_det_noneps(charstring id, BSC_ConnHdlrPars pars) |
| 4358 | runs on BSC_ConnHdlr { |
| 4359 | f_init_handler(pars); |
| 4360 | f_sgs_perform_lu(); |
| 4361 | f_sleep(3.0); |
| 4362 | |
| 4363 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 4364 | SGsAP.send(ts_SGsAP_IMSI_DETACH_IND(g_pars.imsi, mme_name, implicit_network_initiated)); |
| 4365 | SGsAP.receive(tr_SGsAP_IMSI_DETACH_ACK(g_pars.imsi)); |
| 4366 | |
| 4367 | if (f_ctrl_subscr_in_vlr(hex2str(g_pars.imsi))) { |
| 4368 | setverdict(fail, "subscriber not removed from VLR"); |
| 4369 | } |
| 4370 | |
| 4371 | f_sgsap_bssmap_screening(); |
| 4372 | |
| 4373 | setverdict(pass); |
| 4374 | } |
| 4375 | testcase TC_sgsap_impl_imsi_det_noneps() runs on MTC_CT { |
| 4376 | var BSC_ConnHdlrPars pars; |
| 4377 | var BSC_ConnHdlr vc_conn; |
| 4378 | f_init(1, true); |
| 4379 | pars := f_init_pars(11815, true); |
| 4380 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_impl_imsi_det_noneps), pars); |
| 4381 | vc_conn.done; |
| 4382 | } |
| 4383 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4384 | /* Trigger a paging request via VTY and send a paging reject in response */ |
| 4385 | private function f_tc_sgsap_paging_rej(charstring id, BSC_ConnHdlrPars pars) |
| 4386 | runs on BSC_ConnHdlr { |
| 4387 | f_init_handler(pars); |
| 4388 | f_sgs_perform_lu(); |
| 4389 | f_sleep(1.0); |
| 4390 | |
| 4391 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4392 | var template PDU_SGsAP exp_resp := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, CS_call_indicator, omit); |
| 4393 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4394 | exp_resp.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4395 | |
| 4396 | /* Initiate paging via VTY */ |
| 4397 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4398 | alt { |
| 4399 | [] SGsAP.receive(exp_resp) { |
| 4400 | setverdict(pass); |
| 4401 | } |
| 4402 | [] SGsAP.receive { |
| 4403 | setverdict(fail, "Received unexpected message on SGs"); |
| 4404 | } |
| 4405 | } |
| 4406 | |
| 4407 | /* Now reject the paging */ |
| 4408 | SGsAP.send(ts_SGsAP_PAGING_REJ(g_pars.imsi, IMSI_unknown)); |
| 4409 | |
| 4410 | /* Wait for the states inside the MSC to settle and check the state |
| 4411 | * of the SGs Association */ |
| 4412 | f_sleep(1.0); |
| 4413 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4414 | |
| 4415 | /* FIXME: At the moment we send an IMSI_unknown as cause code, which is fine, |
| 4416 | * but we also need to cover tha case where the cause code indicates an |
| 4417 | * "IMSI detached for EPS services". In those cases the VLR is expected to |
| 4418 | * try paging on tha A/Iu interface. This will be another testcase similar to |
| 4419 | * this one, but extended with checks for the presence of the A/Iu paging |
| 4420 | * messages. */ |
| 4421 | |
| 4422 | f_sgsap_bssmap_screening(); |
| 4423 | |
| 4424 | setverdict(pass); |
| 4425 | } |
| 4426 | testcase TC_sgsap_paging_rej() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4427 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4428 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4429 | f_init(1, true); |
| 4430 | pars := f_init_pars(11816, true); |
| 4431 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_rej), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4432 | vc_conn.done; |
| 4433 | } |
| 4434 | |
| 4435 | /* Trigger a paging request via VTY and send a paging reject that indicates |
| 4436 | * that the subscriber intentionally rejected the call. */ |
| 4437 | private function f_tc_sgsap_paging_subscr_rej(charstring id, BSC_ConnHdlrPars pars) |
| 4438 | runs on BSC_ConnHdlr { |
| 4439 | f_init_handler(pars); |
| 4440 | f_sgs_perform_lu(); |
| 4441 | f_sleep(1.0); |
| 4442 | |
| 4443 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4444 | var template PDU_SGsAP exp_resp := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, CS_call_indicator, omit); |
| 4445 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4446 | exp_resp.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4447 | |
| 4448 | /* Initiate paging via VTY */ |
| 4449 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4450 | alt { |
| 4451 | [] SGsAP.receive(exp_resp) { |
| 4452 | setverdict(pass); |
| 4453 | } |
| 4454 | [] SGsAP.receive { |
| 4455 | setverdict(fail, "Received unexpected message on SGs"); |
| 4456 | } |
| 4457 | } |
| 4458 | |
| 4459 | /* Now reject the paging */ |
| 4460 | SGsAP.send(ts_SGsAP_PAGING_REJ(g_pars.imsi, user_rejected_mobile_terminating_CS_fallback_call)); |
| 4461 | |
| 4462 | /* Wait for the states inside the MSC to settle and check the state |
| 4463 | * of the SGs Association */ |
| 4464 | f_sleep(1.0); |
| 4465 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4466 | |
| 4467 | /* FIXME: The VLR is supposed to trigger an User Determined User Busy (UDUB) as specified |
| 4468 | * in 3GPP TS 24.082, this is not yet implemented in the MSC or in this tests, we need |
| 4469 | * to check back how this works and how it can be tested */ |
| 4470 | |
| 4471 | f_sgsap_bssmap_screening(); |
| 4472 | |
| 4473 | setverdict(pass); |
| 4474 | } |
| 4475 | testcase TC_sgsap_paging_subscr_rej() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4476 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4477 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4478 | f_init(1, true); |
| 4479 | pars := f_init_pars(11817, true); |
| 4480 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_subscr_rej), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4481 | vc_conn.done; |
| 4482 | } |
| 4483 | |
| 4484 | /* Trigger a paging request via VTY and send an UE unreacable messge in response */ |
| 4485 | private function f_tc_sgsap_paging_ue_unr(charstring id, BSC_ConnHdlrPars pars) |
| 4486 | runs on BSC_ConnHdlr { |
| 4487 | f_init_handler(pars); |
| 4488 | f_sgs_perform_lu(); |
| 4489 | f_sleep(1.0); |
| 4490 | |
| 4491 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4492 | var template PDU_SGsAP exp_resp := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, CS_call_indicator, omit); |
| 4493 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4494 | exp_resp.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4495 | |
| 4496 | /* Initiate paging via VTY */ |
| 4497 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4498 | alt { |
| 4499 | [] SGsAP.receive(exp_resp) { |
| 4500 | setverdict(pass); |
| 4501 | } |
| 4502 | [] SGsAP.receive { |
| 4503 | setverdict(fail, "Received unexpected message on SGs"); |
| 4504 | } |
| 4505 | } |
| 4506 | |
| 4507 | /* Now pretend that the UE is unreachable */ |
| 4508 | SGsAP.send(ts_SGsAP_UE_UNREACHABLE(g_pars.imsi, UE_unreachable)); |
| 4509 | |
| 4510 | /* Wait for the states inside the MSC to settle and check the state |
| 4511 | * of the SGs Association. */ |
| 4512 | f_sleep(1.0); |
| 4513 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4514 | |
| 4515 | f_sgsap_bssmap_screening(); |
| 4516 | |
| 4517 | setverdict(pass); |
| 4518 | } |
| 4519 | testcase TC_sgsap_paging_ue_unr() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4520 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4521 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4522 | f_init(1, true); |
| 4523 | pars := f_init_pars(11818, true); |
| 4524 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_ue_unr), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4525 | vc_conn.done; |
| 4526 | } |
| 4527 | |
| 4528 | /* Trigger a paging request via VTY but don't respond to it */ |
| 4529 | private function f_tc_sgsap_paging_and_nothing(charstring id, BSC_ConnHdlrPars pars) |
| 4530 | runs on BSC_ConnHdlr { |
| 4531 | f_init_handler(pars); |
| 4532 | f_sgs_perform_lu(); |
| 4533 | f_sleep(1.0); |
| 4534 | |
| 4535 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4536 | var template PDU_SGsAP exp_resp := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, CS_call_indicator, omit); |
Philipp Maier | 3421810 | 2019-09-24 09:15:49 +0200 | [diff] [blame] | 4537 | var template PDU_SGsAP exp_serv_abrt := ts_SGsAP_SERVICE_ABORT_REQ(g_pars.imsi); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4538 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4539 | exp_resp.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4540 | |
| 4541 | /* Initiate paging via VTY */ |
| 4542 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4543 | alt { |
| 4544 | [] SGsAP.receive(exp_resp) { |
| 4545 | setverdict(pass); |
| 4546 | } |
| 4547 | [] SGsAP.receive { |
| 4548 | setverdict(fail, "Received unexpected message on SGs"); |
| 4549 | } |
| 4550 | } |
| 4551 | |
Philipp Maier | 3421810 | 2019-09-24 09:15:49 +0200 | [diff] [blame] | 4552 | /* While we are doing nothing, expect an SGsAP-SERVICE-ABORT-REQUEST |
| 4553 | * after some time */ |
| 4554 | timer T := 10.0; |
| 4555 | T.start |
| 4556 | alt { |
| 4557 | [] SGsAP.receive(exp_serv_abrt) |
| 4558 | { |
| 4559 | setverdict(pass); |
| 4560 | } |
| 4561 | [] SGsAP.receive { |
| 4562 | setverdict(fail, "unexpected SGsAP message received"); |
| 4563 | self.stop; |
| 4564 | } |
| 4565 | [] T.timeout { |
| 4566 | setverdict(fail, "MSC did not send SGsAP-SERVICE-ABORT-REQUEST"); |
| 4567 | self.stop; |
| 4568 | } |
| 4569 | } |
| 4570 | |
| 4571 | /* The SGs association must remain unchanged. */ |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4572 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4573 | |
| 4574 | f_sgsap_bssmap_screening(); |
| 4575 | |
| 4576 | setverdict(pass); |
| 4577 | } |
| 4578 | testcase TC_sgsap_paging_and_nothing() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4579 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4580 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4581 | f_init(1, true); |
| 4582 | pars := f_init_pars(11819, true); |
| 4583 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_and_nothing), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4584 | vc_conn.done; |
| 4585 | } |
| 4586 | |
| 4587 | /* Trigger a paging request via VTY and slip in an LU */ |
| 4588 | private function f_tc_sgsap_paging_and_lu(charstring id, BSC_ConnHdlrPars pars) |
| 4589 | runs on BSC_ConnHdlr { |
| 4590 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4591 | f_init_handler(pars); |
| 4592 | |
| 4593 | /* First we prepar the situation, where the SGs association is in state |
| 4594 | * NULL and the confirmed by radio contact indicator is set to false |
| 4595 | * as well. This can be archived by performing an SGs LU and then |
| 4596 | * resetting the VLR */ |
| 4597 | f_sgs_perform_lu(); |
| 4598 | f_sgsap_reset_mme(mp_mme_name); |
| 4599 | f_sleep(1.0); |
| 4600 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4601 | |
| 4602 | /* Perform a paging, expect the paging messages on the SGs interface */ |
| 4603 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 4604 | alt { |
| 4605 | [] SGsAP.receive(tr_SGsAP_PAGING_REQ(pars.imsi, vlr_name, CS_call_indicator, omit)) { |
| 4606 | setverdict(pass); |
| 4607 | } |
| 4608 | [] SGsAP.receive { |
| 4609 | setverdict(fail, "Received unexpected message on SGs"); |
| 4610 | } |
| 4611 | } |
| 4612 | |
| 4613 | /* Perform the LU as normal */ |
| 4614 | f_sgs_perform_lu(); |
| 4615 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4616 | |
| 4617 | /* Expect a new paging request right after the LU */ |
| 4618 | alt { |
| 4619 | [] SGsAP.receive(tr_SGsAP_PAGING_REQ(pars.imsi, vlr_name, CS_call_indicator, omit)) { |
| 4620 | setverdict(pass); |
| 4621 | } |
| 4622 | [] SGsAP.receive { |
| 4623 | setverdict(fail, "Received unexpected message on SGs"); |
| 4624 | } |
| 4625 | } |
| 4626 | |
| 4627 | /* Test is done now, lets round everything up by rejecting the paging |
| 4628 | * cleanly. */ |
| 4629 | SGsAP.send(ts_SGsAP_PAGING_REJ(g_pars.imsi, user_rejected_mobile_terminating_CS_fallback_call)); |
| 4630 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4631 | |
| 4632 | f_sgsap_bssmap_screening(); |
| 4633 | |
| 4634 | setverdict(pass); |
| 4635 | } |
| 4636 | testcase TC_sgsap_paging_and_lu() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4637 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4638 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4639 | f_init(1, true); |
| 4640 | pars := f_init_pars(11820, true); |
| 4641 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_and_lu), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4642 | vc_conn.done; |
| 4643 | } |
| 4644 | |
| 4645 | /* Send unexpected unit-data through the SGs interface */ |
| 4646 | private function f_tc_sgsap_unexp_ud(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4647 | f_init_handler(pars); |
| 4648 | f_sleep(1.0); |
| 4649 | |
| 4650 | /* This simulates what happens when a subscriber without SGs |
| 4651 | * association gets unitdata via the SGs interface. */ |
| 4652 | |
| 4653 | /* Make sure the subscriber exists and the SGs association |
| 4654 | * is in NULL state */ |
| 4655 | f_perform_lu(); |
| 4656 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4657 | |
| 4658 | /* Send some random unit data, the MSC/VLR should send a release |
| 4659 | * immediately. */ |
| 4660 | SGsAP.send(ts_SGsAP_UL_UD(pars.imsi,'1234'O)); |
| 4661 | SGsAP.receive(tr_SGsAP_RELEASE_REQ(pars.imsi, IMSI_detached_for_EPS_nonEPS_services)); |
| 4662 | |
| 4663 | f_sgsap_bssmap_screening(); |
| 4664 | |
| 4665 | setverdict(pass); |
| 4666 | } |
| 4667 | testcase TC_sgsap_unexp_ud() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4668 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4669 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4670 | f_init(1, true); |
| 4671 | pars := f_init_pars(11821, true); |
| 4672 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_unexp_ud), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4673 | vc_conn.done; |
| 4674 | } |
| 4675 | |
| 4676 | /* Send unsolicited unit-data through the SGs interface */ |
| 4677 | private function f_tc_sgsap_unsol_ud(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4678 | f_init_handler(pars); |
| 4679 | f_sleep(1.0); |
| 4680 | |
| 4681 | /* This simulates what happens when the MME attempts to send unitdata |
| 4682 | * to a subscriber that is completely unknown to the VLR */ |
| 4683 | |
| 4684 | /* Send some random unit data, the MSC/VLR should send a release |
| 4685 | * immediately. */ |
| 4686 | SGsAP.send(ts_SGsAP_UL_UD(pars.imsi,'1234'O)); |
| 4687 | SGsAP.receive(tr_SGsAP_RELEASE_REQ(pars.imsi, IMSI_unknown)); |
| 4688 | |
| 4689 | f_sgsap_bssmap_screening(); |
| 4690 | |
| 4691 | setverdict(pass); |
| 4692 | } |
| 4693 | testcase TC_sgsap_unsol_ud() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4694 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4695 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4696 | f_init(1, true); |
| 4697 | pars := f_init_pars(11822, true); |
| 4698 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_unsol_ud), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4699 | vc_conn.done; |
| 4700 | } |
| 4701 | |
| 4702 | private altstep as_other_sms_sgs() runs on BSC_ConnHdlr { |
| 4703 | /* FIXME: Match an actual payload (second questionmark), the type is |
| 4704 | * octetstring, how do we use a tr_PDU_DTAP_MT here? */ |
| 4705 | [] SGsAP.receive(tr_SGsAP_DL_UD(?,?)) { |
| 4706 | setverdict(fail, "Unexpected SMS related PDU from MSC"); |
| 4707 | mtc.stop; |
| 4708 | } |
| 4709 | } |
| 4710 | |
| 4711 | /* receive a MT-SMS delivered from the MSC/SMSC over an already existing SGsAP connection */ |
| 4712 | function f_mt_sms_sgs(inout SmsParameters spars) |
| 4713 | runs on BSC_ConnHdlr { |
| 4714 | var template (value) TPDU_RP_DATA_MS_SGSN tp_mo; |
| 4715 | var template (value) RPDU_MS_SGSN rp_mo; |
| 4716 | var template (value) PDU_ML3_MS_NW l3_mo; |
| 4717 | |
| 4718 | var template TPDU_RP_DATA_SGSN_MS tp_mt; |
| 4719 | var template RPDU_SGSN_MS rp_mt; |
| 4720 | var template PDU_ML3_NW_MS l3_mt; |
| 4721 | |
| 4722 | var PDU_ML3_NW_MS sgsap_l3_mt; |
| 4723 | |
| 4724 | var default d := activate(as_other_sms_sgs()); |
| 4725 | |
| 4726 | /* Expect CP-DATA(RP-DATA(SMS-DELIVER)) */ |
| 4727 | tp_mt := tr_SMS_DELIVER(?, spars.tp.ud, spars.tp.pid, spars.tp.dcs, ?); |
| 4728 | rp_mt := tr_RP_DATA_MT(?, ?, omit, tp_mt); |
| 4729 | l3_mt := tr_ML3_MT_SMS(?, c_TIF_ORIG, tr_CP_DATA_MT(rp_mt)); |
| 4730 | |
| 4731 | SGsAP.receive(l3_mt) -> value sgsap_l3_mt; |
| 4732 | |
| 4733 | /* Extract relevant identifiers */ |
| 4734 | spars.tid := bit2int(sgsap_l3_mt.tiOrSkip.transactionId.tio); |
| 4735 | spars.rp.msg_ref := sgsap_l3_mt.msgs.sms.cP_DATA.cP_User_Data.cP_RPDU.rP_DATA_SGSN_MS.rP_MessageReference; |
| 4736 | |
| 4737 | /* send CP-ACK for CP-DATA just received */ |
| 4738 | l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_REPL, ts_CP_ACK_MO); |
| 4739 | |
| 4740 | SGsAP.send(l3_mo); |
| 4741 | |
| 4742 | /* send RP-ACK for RP-DATA */ |
| 4743 | rp_mo := ts_RP_ACK_MO(spars.rp.msg_ref); |
| 4744 | l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_REPL, ts_CP_DATA_MO(rp_mo)); |
| 4745 | |
| 4746 | SGsAP.send(l3_mo); |
| 4747 | |
| 4748 | /* expect CP-ACK for CP-DATA(RP-ACK) just sent */ |
| 4749 | l3_mt := tr_ML3_MT_SMS(spars.tid, c_TIF_ORIG, tr_CP_ACK_MT); |
| 4750 | |
| 4751 | SGsAP.receive(l3_mt); |
| 4752 | |
| 4753 | deactivate(d); |
| 4754 | |
| 4755 | setverdict(pass); |
| 4756 | } |
| 4757 | |
| 4758 | /* submit a MO-SMS to MSC/SMSC over an already existing SGsAP connection */ |
| 4759 | function f_mo_sms_sgs(inout SmsParameters spars) |
| 4760 | runs on BSC_ConnHdlr { |
| 4761 | var template (value) TPDU_RP_DATA_MS_SGSN tp_mo; |
| 4762 | var template (value) RPDU_MS_SGSN rp_mo; |
| 4763 | var template (value) PDU_ML3_MS_NW l3_mo; |
| 4764 | |
| 4765 | var template TPDU_RP_DATA_SGSN_MS tp_mt; |
| 4766 | var template RPDU_SGSN_MS rp_mt; |
| 4767 | var template PDU_ML3_NW_MS l3_mt; |
| 4768 | |
| 4769 | var default d := activate(as_other_sms_sgs()); |
| 4770 | |
| 4771 | /* just in case this is routed to SMPP.. */ |
| 4772 | f_create_smpp_expect(hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue)); |
| 4773 | |
| 4774 | tp_mo := ts_SMS_SUBMIT(spars.tp.msg_ref, spars.tp.da, spars.tp.pid, spars.tp.dcs, |
| 4775 | spars.tp.udl, spars.tp.ud); |
| 4776 | rp_mo := ts_RP_DATA_MO(spars.rp.msg_ref, spars.rp.orig, spars.rp.dest, tp_mo); |
| 4777 | l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_ORIG, ts_CP_DATA_MO(rp_mo)); |
| 4778 | |
| 4779 | SGsAP.send(l3_mo); |
| 4780 | |
| 4781 | /* receive CP-ACK for CP-DATA above */ |
| 4782 | SGsAP.receive(tr_ML3_MT_SMS(spars.tid, c_TIF_REPL, tr_CP_ACK_MT)); |
| 4783 | |
| 4784 | if (ispresent(spars.exp_rp_err)) { |
| 4785 | /* expect an RP-ERROR message from MSC with given cause */ |
| 4786 | rp_mt := tr_RP_ERROR_MT(spars.rp.msg_ref, spars.exp_rp_err); |
| 4787 | l3_mt := tr_ML3_MT_SMS(spars.tid, c_TIF_REPL, tr_CP_DATA_MT(rp_mt)); |
| 4788 | SGsAP.receive(l3_mt); |
| 4789 | /* send CP-ACK for CP-DATA just received */ |
| 4790 | l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_ORIG, ts_CP_ACK_MO); |
| 4791 | SGsAP.send(l3_mo); |
| 4792 | } else { |
| 4793 | /* expect RP-ACK for RP-DATA */ |
| 4794 | rp_mt := tr_RP_ACK_MT(spars.rp.msg_ref); |
| 4795 | l3_mt := tr_ML3_MT_SMS(spars.tid, c_TIF_REPL, tr_CP_DATA_MT(rp_mt)); |
| 4796 | SGsAP.receive(l3_mt); |
| 4797 | /* send CP-ACO for CP-DATA just received */ |
| 4798 | l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_ORIG, ts_CP_ACK_MO); |
| 4799 | SGsAP.send(l3_mo); |
| 4800 | } |
| 4801 | |
| 4802 | deactivate(d); |
| 4803 | |
| 4804 | setverdict(pass); |
| 4805 | } |
| 4806 | |
| 4807 | private function f_vty_sms_send_conn_hdlr(charstring imsi, charstring msisdn, charstring text) |
| 4808 | runs on BSC_ConnHdlr { |
| 4809 | f_vty_transceive(MSCVTY, "subscriber imsi "&imsi&" sms sender msisdn "&msisdn&" send "&text); |
| 4810 | } |
| 4811 | |
| 4812 | /* Send a MT SMS via SGs interface */ |
| 4813 | private function f_tc_sgsap_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4814 | f_init_handler(pars); |
| 4815 | f_sgs_perform_lu(); |
| 4816 | f_sleep(1.0); |
| 4817 | var SmsParameters spars := valueof(t_SmsPars); |
| 4818 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 4819 | |
| 4820 | /* Trigger SMS via VTY */ |
| 4821 | f_vty_sms_send_conn_hdlr(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 4822 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4823 | |
| 4824 | /* Expect a paging request and respond accordingly with a service request */ |
| 4825 | SGsAP.receive(tr_SGsAP_PAGING_REQ(pars.imsi, vlr_name, SMS_indicator, omit)); |
| 4826 | SGsAP.send(ts_SGsAP_SERVICE_REQ(pars.imsi, SMS_indicator, EMM_CONNECTED)); |
| 4827 | |
| 4828 | /* Connection is now live, receive the MT-SMS */ |
| 4829 | f_mt_sms_sgs(spars); |
| 4830 | |
| 4831 | /* Expect a concluding release from the MSC */ |
| 4832 | SGsAP.receive(tr_SGsAP_RELEASE_REQ(pars.imsi, omit)); |
| 4833 | |
| 4834 | /* Make sure that subscriber is still present and the SGs association is in tact (ref-counting) */ |
| 4835 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4836 | |
| 4837 | f_sgsap_bssmap_screening(); |
| 4838 | |
| 4839 | setverdict(pass); |
| 4840 | } |
| 4841 | testcase TC_sgsap_mt_sms() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4842 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4843 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4844 | f_init(1, true); |
| 4845 | pars := f_init_pars(11823, true); |
| 4846 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4847 | vc_conn.done; |
| 4848 | } |
| 4849 | |
| 4850 | /* Send a MO SMS via SGs interface */ |
| 4851 | private function f_tc_sgsap_mo_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4852 | f_init_handler(pars); |
| 4853 | f_sgs_perform_lu(); |
| 4854 | f_sleep(1.0); |
| 4855 | var SmsParameters spars := valueof(t_SmsPars); |
| 4856 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 4857 | |
| 4858 | /* Send the MO-SMS */ |
| 4859 | f_mo_sms_sgs(spars); |
| 4860 | |
| 4861 | /* Expect a concluding release from the MSC/VLR */ |
| 4862 | SGsAP.receive(tr_SGsAP_RELEASE_REQ(pars.imsi, omit)); |
| 4863 | |
| 4864 | /* Make sure that subscriber is still present and the SGs association is in tact (ref-counting) */ |
| 4865 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4866 | |
| 4867 | setverdict(pass); |
| 4868 | |
| 4869 | f_sgsap_bssmap_screening() |
| 4870 | } |
| 4871 | testcase TC_sgsap_mo_sms() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4872 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4873 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4874 | f_init(1, true); |
| 4875 | pars := f_init_pars(11824, true); |
| 4876 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mo_sms), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4877 | vc_conn.done; |
| 4878 | } |
| 4879 | |
| 4880 | /* Trigger sending of an MT sms via VTY but never respond to anything */ |
| 4881 | private function f_tc_sgsap_mt_sms_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4882 | f_init_handler(pars, 170.0); |
| 4883 | f_sgs_perform_lu(); |
| 4884 | f_sleep(1.0); |
| 4885 | |
| 4886 | var SmsParameters spars := valueof(t_SmsPars); |
| 4887 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 4888 | var integer page_count := 0; |
| 4889 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4890 | var template PDU_SGsAP exp_pag_req := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, SMS_indicator, omit); |
| 4891 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4892 | exp_pag_req.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4893 | |
| 4894 | /* Trigger SMS via VTY */ |
| 4895 | f_vty_sms_send_conn_hdlr(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 4896 | |
Neels Hofmeyr | 1623774 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 4897 | /* Expect the MSC/VLR to page exactly once */ |
| 4898 | SGsAP.receive(exp_pag_req); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4899 | |
| 4900 | /* Wait some time to make sure the MSC is not delivering any further |
| 4901 | * paging messages or anything else that could be unexpected. */ |
| 4902 | timer T := 20.0; |
| 4903 | T.start |
| 4904 | alt { |
| 4905 | [] SGsAP.receive(exp_pag_req) |
| 4906 | { |
| 4907 | setverdict(fail, "paging seems not to stop!"); |
| 4908 | mtc.stop; |
| 4909 | } |
| 4910 | [] SGsAP.receive { |
| 4911 | setverdict(fail, "unexpected SGsAP message received"); |
| 4912 | self.stop; |
| 4913 | } |
| 4914 | [] T.timeout { |
| 4915 | setverdict(pass); |
| 4916 | } |
| 4917 | } |
| 4918 | |
| 4919 | /* Even on a failed paging the SGs Association should stay intact */ |
| 4920 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 4921 | |
Philipp Maier | 26bdb8c | 2019-09-24 09:21:12 +0200 | [diff] [blame] | 4922 | /* Make sure that the SMS we just inserted is cleared and the |
| 4923 | * subscriber is expired. This is necessary because otherwise the MSC |
| 4924 | * might re-try the SMS delivery and disturb the following tests. */ |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4925 | |
Neels Hofmeyr | 8256ed2 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 4926 | f_vty_sms_clear(hex2str(g_pars.imsi)); |
| 4927 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4928 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " expire"); |
| 4929 | |
| 4930 | setverdict(pass); |
Neels Hofmeyr | b0f8234 | 2019-03-06 15:36:51 +0100 | [diff] [blame] | 4931 | |
| 4932 | f_sgsap_bssmap_screening(); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4933 | } |
| 4934 | testcase TC_sgsap_mt_sms_and_nothing() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4935 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4936 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4937 | f_init(1, true); |
| 4938 | pars := f_init_pars(11825, true); |
| 4939 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms_and_nothing), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4940 | vc_conn.done; |
| 4941 | } |
| 4942 | |
| 4943 | /* Trigger sending of an MT sms via VTY but reject the paging immediately */ |
| 4944 | private function f_tc_sgsap_mt_sms_and_reject(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 4945 | f_init_handler(pars, 150.0); |
| 4946 | f_sgs_perform_lu(); |
| 4947 | f_sleep(1.0); |
| 4948 | |
| 4949 | var SmsParameters spars := valueof(t_SmsPars); |
| 4950 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 4951 | var integer page_count := 0; |
| 4952 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 4953 | var template PDU_SGsAP exp_pag_req := tr_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, SMS_indicator, omit); |
| 4954 | var template LocationAreaId exp_lai := ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 4955 | exp_pag_req.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai; |
| 4956 | |
| 4957 | /* Trigger SMS via VTY */ |
| 4958 | f_vty_sms_send_conn_hdlr(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 4959 | |
| 4960 | /* Expect a paging request and reject it immediately */ |
| 4961 | SGsAP.receive(exp_pag_req); |
| 4962 | SGsAP.send(ts_SGsAP_PAGING_REJ(g_pars.imsi, IMSI_unknown)); |
| 4963 | |
| 4964 | /* The MSC/VLR should no longer try to page once the paging has been |
| 4965 | * rejected. Wait some time and check if there are no unexpected |
| 4966 | * messages on the SGs interface. */ |
| 4967 | timer T := 20.0; |
| 4968 | T.start |
| 4969 | alt { |
| 4970 | [] SGsAP.receive(exp_pag_req) |
| 4971 | { |
| 4972 | setverdict(fail, "paging seems not to stop!"); |
| 4973 | mtc.stop; |
| 4974 | } |
| 4975 | [] SGsAP.receive { |
| 4976 | setverdict(fail, "unexpected SGsAP message received"); |
| 4977 | self.stop; |
| 4978 | } |
| 4979 | [] T.timeout { |
| 4980 | setverdict(pass); |
| 4981 | } |
| 4982 | } |
| 4983 | |
Neels Hofmeyr | 8256ed2 | 2019-03-06 15:34:01 +0100 | [diff] [blame] | 4984 | f_vty_sms_clear(hex2str(g_pars.imsi)); |
| 4985 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4986 | /* A rejected paging with IMSI_unknown (see above) should always send |
| 4987 | * the SGs association to NULL. */ |
| 4988 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-NULL"); |
| 4989 | |
| 4990 | f_sgsap_bssmap_screening(); |
| 4991 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4992 | setverdict(pass); |
| 4993 | } |
| 4994 | testcase TC_sgsap_mt_sms_and_reject() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4995 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 4996 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 4997 | f_init(1, true); |
| 4998 | pars := f_init_pars(11826, true); |
| 4999 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms_and_reject), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5000 | vc_conn.done; |
| 5001 | } |
| 5002 | |
| 5003 | /* Perform an MT CSDB call including LU */ |
| 5004 | private function f_mt_lu_and_csfb_call(charstring id, BSC_ConnHdlrPars pars, boolean bssmap_lu) runs on BSC_ConnHdlr { |
| 5005 | f_init_handler(pars); |
| 5006 | |
| 5007 | /* Be sure that the BSSMAP reset is done before we begin. */ |
| 5008 | f_sleep(2.0); |
| 5009 | |
| 5010 | /* Testcase variation: See what happens when we do a regular BSSMAP |
| 5011 | * LU first (this should not hurt in any way!) */ |
| 5012 | if (bssmap_lu) { |
| 5013 | f_perform_lu(); |
| 5014 | } |
| 5015 | |
| 5016 | f_sgs_perform_lu(); |
| 5017 | f_sleep(1.0); |
| 5018 | |
| 5019 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 5020 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 5021 | cpars.bss_rtp_port := 1110; |
| 5022 | cpars.mgcp_connection_id_bss := '10004'H; |
| 5023 | cpars.mgcp_connection_id_mss := '10005'H; |
| 5024 | |
| 5025 | /* Note: This is an optional parameter. When the call-agent (MSC) does |
| 5026 | * supply a full endpoint name this setting will be overwritten. */ |
| 5027 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 5028 | |
| 5029 | /* Initiate a call via MNCC interface */ |
| 5030 | f_mt_call_initate(cpars); |
| 5031 | |
| 5032 | /* Expect a paging request and respond accordingly with a service request */ |
| 5033 | SGsAP.receive(tr_SGsAP_PAGING_REQ(pars.imsi, vlr_name, CS_call_indicator, omit)); |
| 5034 | SGsAP.send(ts_SGsAP_SERVICE_REQ(pars.imsi, CS_call_indicator, EMM_CONNECTED)); |
| 5035 | |
| 5036 | /* Complete the call, hold it for some time and then tear it down */ |
| 5037 | f_mt_call_complete(cpars); |
| 5038 | f_sleep(3.0); |
Harald Welte | 4c422b7 | 2019-02-17 16:27:10 +0100 | [diff] [blame] | 5039 | f_call_hangup(cpars, true, is_csfb := true); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5040 | |
| 5041 | /* Make sure that subscriber is still present and the SGs association is in tact (ref-counting) */ |
| 5042 | f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & ".state", "SGs-ASSOCIATED"); |
| 5043 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5044 | /* Test for successful return by triggering a paging, when the paging |
| 5045 | * request is received via SGs, we can be sure that the MSC/VLR has |
| 5046 | * recognized that the UE is now back on 4G */ |
| 5047 | f_sleep(1.0); |
| 5048 | f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging"); |
| 5049 | alt { |
| 5050 | [] SGsAP.receive(tr_SGsAP_PAGING_REQ(pars.imsi, vlr_name, CS_call_indicator, omit)) { |
| 5051 | setverdict(pass); |
| 5052 | } |
| 5053 | [] SGsAP.receive { |
| 5054 | setverdict(fail, "Received unexpected message on SGs"); |
| 5055 | } |
| 5056 | } |
| 5057 | |
| 5058 | f_sgsap_bssmap_screening(); |
| 5059 | |
| 5060 | setverdict(pass); |
| 5061 | } |
| 5062 | |
| 5063 | /* Perform a regular BSSAP LU first, do a SGSAP LU and then make a CSFB call */ |
| 5064 | private function f_tc_bssap_lu_sgsap_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5065 | f_mt_lu_and_csfb_call(id, pars, true); |
| 5066 | } |
| 5067 | testcase TC_bssap_lu_sgsap_lu_and_mt_call() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5068 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5069 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5070 | f_init(1, true); |
| 5071 | pars := f_init_pars(118139, true); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5072 | |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5073 | vc_conn := f_start_handler_with_pars(refers(f_tc_bssap_lu_sgsap_lu_and_mt_call), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5074 | vc_conn.done; |
| 5075 | } |
| 5076 | |
| 5077 | |
| 5078 | /* Perform a SGSAP LU and then make a CSFB call */ |
| 5079 | private function f_tc_sgsap_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5080 | f_mt_lu_and_csfb_call(id, pars, false); |
| 5081 | } |
| 5082 | testcase TC_sgsap_lu_and_mt_call() runs on MTC_CT { |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5083 | var BSC_ConnHdlrPars pars; |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5084 | var BSC_ConnHdlr vc_conn; |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5085 | f_init(1, true); |
| 5086 | pars := f_init_pars(11827, true); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5087 | |
Philipp Maier | 8e07a4a | 2019-02-14 18:23:28 +0100 | [diff] [blame] | 5088 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu_and_mt_call), pars); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5089 | vc_conn.done; |
| 5090 | } |
| 5091 | |
Philipp Maier | 628c005 | 2019-04-09 17:36:57 +0200 | [diff] [blame] | 5092 | /* Simulate an HLR/VLR failure */ |
| 5093 | private function f_tc_sgsap_vlr_failure(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5094 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 5095 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 5096 | |
| 5097 | var PDU_SGsAP lur; |
| 5098 | |
| 5099 | f_init_handler(pars); |
| 5100 | |
| 5101 | /* Attempt location update (which is expected to fail) */ |
| 5102 | lur := valueof(ts_SGsAP_LU_REQ(g_pars.imsi, mme_name, IMSI_attach, |
| 5103 | ts_SGsAP_LAI('901'H, '70'H, 2342))); |
| 5104 | SGsAP.send(lur); |
| 5105 | |
| 5106 | /* Respond to SGsAP-RESET-INDICATION from VLR */ |
| 5107 | alt { |
| 5108 | [] SGsAP.receive(tr_SGsAP_RESET_IND_VLR(vlr_name)); { |
| 5109 | SGsAP.send(valueof(ts_SGsAP_RESET_ACK_MME(mme_name))); |
| 5110 | setverdict(pass); |
| 5111 | } |
| 5112 | [] SGsAP.receive { |
| 5113 | setverdict(fail, "Received unexpected message on SGs"); |
| 5114 | } |
| 5115 | } |
| 5116 | |
| 5117 | f_sleep(1.0); |
| 5118 | setverdict(pass); |
| 5119 | } |
| 5120 | testcase TC_sgsap_vlr_failure() runs on MTC_CT { |
| 5121 | var BSC_ConnHdlrPars pars; |
| 5122 | var BSC_ConnHdlr vc_conn; |
| 5123 | f_init(1, true, false); |
| 5124 | pars := f_init_pars(11811, true, false); |
| 5125 | vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_vlr_failure), pars); |
| 5126 | vc_conn.done; |
| 5127 | } |
| 5128 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5129 | /* SGs TODO: |
| 5130 | * LU attempt for IMSI without NAM_PS in HLR |
| 5131 | * LU attempt with AUTH FAIL due to invalid RES/SRES |
| 5132 | * LU attempt with no response from HLR (VLR should timeout + LU REJ) |
| 5133 | * LU attempt with new TMSI but without TMSI REALL CMPL baco to VLR |
| 5134 | * implicit IMSI detach from EPS |
| 5135 | * implicit IMSI detach from non-EPS |
| 5136 | * MM INFO |
| 5137 | * |
| 5138 | */ |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 5139 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 5140 | private function f_tc_ho_inter_bsc_unknown_cell(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5141 | f_init_handler(pars); |
| 5142 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 5143 | cpars.bss_rtp_port := 1110; |
| 5144 | cpars.mgcp_connection_id_bss := '22222'H; |
| 5145 | cpars.mgcp_connection_id_mss := '33333'H; |
| 5146 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 5147 | cpars.mo_call := true; |
| 5148 | |
| 5149 | f_perform_lu(); |
| 5150 | f_mo_call_establish(cpars); |
| 5151 | |
| 5152 | f_sleep(1.0); |
| 5153 | |
| 5154 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_BETTER_CELL; |
| 5155 | var BssmapCause cause := enum2int(cause_val); |
| 5156 | |
| 5157 | var template BSSMAP_FIELD_CellIdentificationList cil; |
| 5158 | cil := { cIl_LAI := { ts_BSSMAP_CI_LAI('023'H, '42'H, 999) } }; |
| 5159 | |
| 5160 | BSSAP.send(ts_BSSMAP_HandoverRequired(cause, cil)); |
| 5161 | BSSAP.receive(tr_BSSMAP_HandoverRequiredReject); |
| 5162 | |
| 5163 | f_call_hangup(cpars, true); |
| 5164 | } |
| 5165 | testcase TC_ho_inter_bsc_unknown_cell() runs on MTC_CT { |
| 5166 | var BSC_ConnHdlr vc_conn; |
| 5167 | f_init(); |
| 5168 | |
| 5169 | vc_conn := f_start_handler(refers(f_tc_ho_inter_bsc_unknown_cell), 53); |
| 5170 | vc_conn.done; |
| 5171 | } |
| 5172 | |
| 5173 | private altstep as_mgcp_ack_all_mdcx(CallParameters cpars) runs on BSC_ConnHdlr { |
| 5174 | var MgcpCommand mgcp_cmd; |
| 5175 | [] MGCP.receive(tr_MDCX) -> value mgcp_cmd { |
| 5176 | var SDP_Message sdp := valueof(ts_SDP(cpars.mgw_rtp_ip_mss, cpars.mgw_rtp_ip_mss, |
| 5177 | hex2str(cpars.mgcp_call_id), "42", |
| 5178 | cpars.mgw_rtp_port_mss, |
| 5179 | { int2str(cpars.rtp_payload_type) }, |
| 5180 | { valueof(ts_SDP_rtpmap(cpars.rtp_payload_type, |
| 5181 | cpars.rtp_sdp_format)), |
| 5182 | valueof(ts_SDP_ptime(20)) })); |
| 5183 | MGCP.send(ts_MDCX_ACK(mgcp_cmd.line.trans_id, cpars.mgcp_connection_id_mss, sdp)); |
| 5184 | repeat; |
| 5185 | } |
| 5186 | } |
| 5187 | |
| 5188 | private function f_tc_ho_inter_bsc0(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5189 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 5190 | cpars.bss_rtp_port := 1110; |
| 5191 | cpars.mgcp_connection_id_bss := '22222'H; |
| 5192 | cpars.mgcp_connection_id_mss := '33333'H; |
| 5193 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 5194 | cpars.mo_call := true; |
| 5195 | |
| 5196 | f_init_handler(pars); |
| 5197 | |
| 5198 | f_vty_transceive(MSCVTY, "configure terminal"); |
| 5199 | f_vty_transceive(MSCVTY, "msc"); |
| 5200 | f_vty_transceive(MSCVTY, "neighbor a cgi 262 42 23 42 ran-pc 0.24.1"); |
| 5201 | f_vty_transceive(MSCVTY, "neighbor a lac 5 ran-pc 0.24.2"); |
| 5202 | f_vty_transceive(MSCVTY, "exit"); |
| 5203 | f_vty_transceive(MSCVTY, "exit"); |
| 5204 | |
| 5205 | f_perform_lu(); |
| 5206 | f_mo_call_establish(cpars); |
| 5207 | |
| 5208 | f_sleep(1.0); |
| 5209 | |
| 5210 | var default ack_mdcx := activate(as_mgcp_ack_all_mdcx(cpars)); |
| 5211 | |
| 5212 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_BETTER_CELL; |
| 5213 | var BssmapCause cause := enum2int(cause_val); |
| 5214 | |
| 5215 | var template BSSMAP_FIELD_CellIdentificationList cil; |
| 5216 | cil := { cIl_LAI := { ts_BSSMAP_CI_LAI('023'H, '42'H, 5) } }; |
| 5217 | |
| 5218 | /* old BSS sends Handover Required */ |
| 5219 | BSSAP.send(ts_BSSMAP_HandoverRequired(cause, cil)); |
| 5220 | |
| 5221 | /* Now the action goes on in f_tc_ho_inter_bsc1() */ |
| 5222 | |
| 5223 | /* MSC forwards the RR Handover Command to old BSS */ |
| 5224 | var PDU_BSSAP ho_command; |
| 5225 | BSSAP.receive(tr_BSSMAP_HandoverCommand) -> value ho_command; |
| 5226 | |
| 5227 | log("GOT HandoverCommand", ho_command); |
| 5228 | |
| 5229 | BSSAP.receive(tr_BSSMAP_HandoverSucceeded); |
| 5230 | |
| 5231 | /* f_tc_ho_inter_bsc1() completes Handover, then expecting a Clear here. */ |
| 5232 | f_expect_clear(); |
| 5233 | |
| 5234 | log("FIRST inter-BSC Handover done"); |
| 5235 | |
| 5236 | |
| 5237 | /* ------------------------ */ |
| 5238 | |
| 5239 | /* Ok, that went well, now the other BSC is handovering back here -- |
| 5240 | * from now on this here is the new BSS. */ |
| 5241 | f_create_bssmap_exp_handoverRequest(193); |
| 5242 | |
| 5243 | var PDU_BSSAP ho_request; |
| 5244 | BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request; |
| 5245 | |
| 5246 | /* new BSS composes a RR Handover Command */ |
| 5247 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5248 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5249 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 5250 | BSSAP.send(ts_BSSMAP_HandoverRequestAcknowledge(rr_ho_cmd_enc, lengthof(rr_ho_cmd_enc), |
| 5251 | tla, ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}))); |
| 5252 | |
| 5253 | /* Now f_tc_ho_inter_bsc1() expects HandoverCommand */ |
| 5254 | |
| 5255 | f_sleep(0.5); |
| 5256 | |
| 5257 | /* Notify that the MS is now over here */ |
| 5258 | |
| 5259 | BSSAP.send(ts_BSSMAP_HandoverDetect); |
| 5260 | f_sleep(0.1); |
| 5261 | BSSAP.send(ts_BSSMAP_HandoverComplete); |
| 5262 | |
| 5263 | f_sleep(3.0); |
| 5264 | |
| 5265 | deactivate(ack_mdcx); |
| 5266 | |
| 5267 | var default ccrel := activate(as_optional_cc_rel(cpars, true)); |
| 5268 | |
| 5269 | /* blatant cheating */ |
| 5270 | var N_Sd_Array last_n_sd := f_bssmap_last_n_sd(); |
| 5271 | last_n_sd[0] := 3; |
| 5272 | f_bssmap_continue_after_n_sd(last_n_sd); |
| 5273 | |
| 5274 | f_call_hangup(cpars, true); |
| 5275 | f_sleep(1.0); |
| 5276 | deactivate(ccrel); |
| 5277 | |
| 5278 | setverdict(pass); |
| 5279 | } |
| 5280 | private function f_tc_ho_inter_bsc1(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5281 | f_init_handler(pars); |
| 5282 | f_create_bssmap_exp_handoverRequest(194); |
| 5283 | |
| 5284 | var PDU_BSSAP ho_request; |
| 5285 | BSSAP.receive(tr_BSSMAP_HandoverRequest) -> value ho_request; |
| 5286 | |
| 5287 | /* new BSS composes a RR Handover Command */ |
| 5288 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5289 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5290 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 5291 | BSSAP.send(ts_BSSMAP_HandoverRequestAcknowledge(rr_ho_cmd_enc, lengthof(rr_ho_cmd_enc), |
| 5292 | tla, ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}))); |
| 5293 | |
| 5294 | /* Now f_tc_ho_inter_bsc0() expects HandoverCommand */ |
| 5295 | |
| 5296 | f_sleep(0.5); |
| 5297 | |
| 5298 | /* Notify that the MS is now over here */ |
| 5299 | |
| 5300 | BSSAP.send(ts_BSSMAP_HandoverDetect); |
| 5301 | f_sleep(0.1); |
| 5302 | BSSAP.send(ts_BSSMAP_HandoverComplete); |
| 5303 | |
| 5304 | f_sleep(3.0); |
| 5305 | |
| 5306 | /* Now I'd like to f_call_hangup() but we don't know any cpars here. So |
| 5307 | * ... handover back to the first BSC :P */ |
| 5308 | |
| 5309 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_BETTER_CELL; |
| 5310 | var BssmapCause cause := enum2int(cause_val); |
| 5311 | |
| 5312 | var template BSSMAP_FIELD_CellIdentificationList cil; |
| 5313 | cil := { cIl_LAI := { ts_BSSMAP_CI_LAI('262'H, '42'H, 23) } }; |
| 5314 | |
| 5315 | /* old BSS sends Handover Required */ |
| 5316 | BSSAP.send(ts_BSSMAP_HandoverRequired(cause, cil)); |
| 5317 | |
| 5318 | /* Now the action goes on in f_tc_ho_inter_bsc0() */ |
| 5319 | |
| 5320 | /* MSC forwards the RR Handover Command to old BSS */ |
| 5321 | var PDU_BSSAP ho_command; |
| 5322 | BSSAP.receive(tr_BSSMAP_HandoverCommand) -> value ho_command; |
| 5323 | |
| 5324 | log("GOT HandoverCommand", ho_command); |
| 5325 | |
| 5326 | BSSAP.receive(tr_BSSMAP_HandoverSucceeded); |
| 5327 | |
| 5328 | /* f_tc_ho_inter_bsc1() completes Handover, then expecting a Clear here. */ |
| 5329 | f_expect_clear(); |
| 5330 | setverdict(pass); |
| 5331 | } |
| 5332 | testcase TC_ho_inter_bsc() runs on MTC_CT { |
| 5333 | var BSC_ConnHdlr vc_conn0; |
| 5334 | var BSC_ConnHdlr vc_conn1; |
| 5335 | f_init(2); |
| 5336 | |
| 5337 | var BSC_ConnHdlrPars pars0 := f_init_pars(53); |
| 5338 | var BSC_ConnHdlrPars pars1 := f_init_pars(53); |
| 5339 | |
| 5340 | vc_conn0 := f_start_handler_with_pars(refers(f_tc_ho_inter_bsc0), pars0, 0); |
| 5341 | vc_conn1 := f_start_handler_with_pars(refers(f_tc_ho_inter_bsc1), pars1, 1); |
| 5342 | vc_conn0.done; |
| 5343 | vc_conn1.done; |
| 5344 | } |
| 5345 | |
| 5346 | function f_ML3_patch_seq_nr_MS_NW(in uint2_t seq_nr, inout octetstring enc_l3) { |
| 5347 | log("MS_NW patching N(SD)=", seq_nr, " into dtap ", enc_l3); |
| 5348 | enc_l3[2] := (enc_l3[2] and4b '3f'O) or4b bit2oct(int2bit(seq_nr, 8) << 6); |
| 5349 | log("MS_NW patched enc_l3: ", enc_l3); |
| 5350 | } |
| 5351 | |
| 5352 | private function f_tc_ho_inter_msc_out(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5353 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 5354 | cpars.bss_rtp_port := 1110; |
| 5355 | cpars.mgcp_connection_id_bss := '22222'H; |
| 5356 | cpars.mgcp_connection_id_mss := '33333'H; |
| 5357 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 5358 | cpars.mo_call := true; |
| 5359 | var hexstring ho_number := f_gen_msisdn(99999); |
| 5360 | |
| 5361 | f_init_handler(pars); |
| 5362 | |
| 5363 | f_create_mncc_expect(hex2str(ho_number)); |
| 5364 | |
| 5365 | f_vty_transceive(MSCVTY, "configure terminal"); |
| 5366 | f_vty_transceive(MSCVTY, "msc"); |
| 5367 | f_vty_transceive(MSCVTY, "neighbor a cgi 017 017 1 1 msc-ipa-name msc-017-017-1"); |
| 5368 | f_vty_transceive(MSCVTY, "exit"); |
| 5369 | f_vty_transceive(MSCVTY, "exit"); |
| 5370 | |
| 5371 | f_perform_lu(); |
| 5372 | f_mo_call_establish(cpars); |
| 5373 | |
| 5374 | f_sleep(1.0); |
| 5375 | |
| 5376 | var default ack_mdcx := activate(as_mgcp_ack_all_mdcx(cpars)); |
| 5377 | |
| 5378 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_BETTER_CELL; |
| 5379 | var BssmapCause cause := enum2int(cause_val); |
| 5380 | |
| 5381 | var template BSSMAP_FIELD_CellIdentificationList cil; |
| 5382 | cil := { cIl_LAI := { ts_BSSMAP_CI_LAI('017'H, '017'H, 1) } }; |
| 5383 | |
| 5384 | /* old BSS sends Handover Required */ |
| 5385 | BSSAP.send(ts_BSSMAP_HandoverRequired(cause, cil)); |
| 5386 | |
| 5387 | /* The target cell 017-017 LAC 1 is configured to be a remote MSC of name "msc-017-017-1". |
| 5388 | * This MSC tries to reach the other MSC via GSUP. */ |
| 5389 | |
| 5390 | var octetstring remote_msc_name := '6D73632D3031372D3031372D3100'O; /* "msc-017-017-1\0" as octetstring */ |
| 5391 | var GSUP_PDU prep_ho_req; |
| 5392 | GSUP.receive(tr_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_REQUEST, |
| 5393 | pars.imsi, destination_name := remote_msc_name)) -> value prep_ho_req; |
| 5394 | |
| 5395 | var GSUP_IeValue source_name_ie; |
| 5396 | f_gsup_find_ie(prep_ho_req, OSMO_GSUP_SOURCE_NAME_IE, source_name_ie); |
| 5397 | var octetstring local_msc_name := source_name_ie.source_name; |
| 5398 | |
| 5399 | /* Remote MSC has figured out its BSC and signals success */ |
| 5400 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5401 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5402 | var PDU_BSSAP ho_req_ack := valueof(ts_BSSMAP_HandoverRequestAcknowledge(rr_ho_cmd_enc, lengthof(rr_ho_cmd_enc), |
| 5403 | aoIPTransportLayer := omit, |
| 5404 | speechCodec := ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}))); |
| 5405 | GSUP.send(ts_GSUP_E_PrepareHandoverResult( |
| 5406 | pars.imsi, |
| 5407 | ho_number, |
| 5408 | remote_msc_name, local_msc_name, |
| 5409 | valueof(t_GSUP_AN_APDU(OSMO_GSUP_AN_PROTO_48006, enc_PDU_BSSAP(ho_req_ack))))); |
| 5410 | |
| 5411 | /* MSC forwards the RR Handover Command to old BSS */ |
| 5412 | BSSAP.receive(tr_BSSMAP_HandoverCommand); |
| 5413 | |
| 5414 | /* The MS shows up at remote new BSS */ |
| 5415 | |
| 5416 | GSUP.send(ts_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST, |
| 5417 | pars.imsi, remote_msc_name, local_msc_name, |
| 5418 | valueof(t_GSUP_AN_APDU(OSMO_GSUP_AN_PROTO_48006, |
| 5419 | enc_PDU_BSSAP(valueof(ts_BSSMAP_HandoverDetect)))))); |
| 5420 | BSSAP.receive(tr_BSSMAP_HandoverSucceeded); |
| 5421 | f_sleep(0.1); |
| 5422 | |
| 5423 | /* Save the MS sequence counters for use on the other connection */ |
| 5424 | var N_Sd_Array last_n_sd := f_bssmap_last_n_sd(); |
| 5425 | |
| 5426 | GSUP.send(ts_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_REQUEST, |
| 5427 | pars.imsi, remote_msc_name, local_msc_name, |
| 5428 | valueof(t_GSUP_AN_APDU(OSMO_GSUP_AN_PROTO_48006, |
| 5429 | enc_PDU_BSSAP(valueof(ts_BSSMAP_HandoverComplete)))))); |
| 5430 | |
| 5431 | /* The local BSS conn clears, all communication goes via remote MSC now */ |
| 5432 | f_expect_clear(); |
| 5433 | |
| 5434 | /**********************************/ |
| 5435 | /* Play through some signalling across the inter-MSC link. |
| 5436 | * This is a copy of f_tc_lu_and_mo_ussd_single_request() translated into GSUP AN-APDUs. */ |
| 5437 | |
| 5438 | if (false) { |
| 5439 | var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( |
| 5440 | invoke_id := 5, /* Phone may not start from 0 or 1 */ |
| 5441 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 5442 | ussd_string := "*#100#" |
| 5443 | ); |
| 5444 | |
| 5445 | var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( |
| 5446 | invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */ |
| 5447 | op_code := SS_OP_CODE_PROCESS_USS_REQ, |
| 5448 | ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" |
| 5449 | ) |
| 5450 | |
| 5451 | /* Compose a new SS/REGISTER message with request */ |
| 5452 | var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER( |
| 5453 | tid := 1, /* We just need a single transaction */ |
| 5454 | ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ |
| 5455 | facility := valueof(facility_req) |
| 5456 | ); |
| 5457 | var PDU_ML3_MS_NW ussd_req_v := valueof(ussd_req); |
| 5458 | |
| 5459 | /* Compose SS/RELEASE_COMPLETE template with expected response */ |
| 5460 | var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 5461 | tid := 1, /* Response should arrive within the same transaction */ |
| 5462 | ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ |
| 5463 | facility := valueof(facility_rsp) |
| 5464 | ); |
| 5465 | |
| 5466 | /* Compose expected MSC -> HLR message */ |
| 5467 | var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ( |
| 5468 | imsi := g_pars.imsi, |
| 5469 | state := OSMO_GSUP_SESSION_STATE_BEGIN, |
| 5470 | ss := valueof(facility_req) |
| 5471 | ); |
| 5472 | |
| 5473 | /* To be used for sending response with correct session ID */ |
| 5474 | var GSUP_PDU gsup_req_complete; |
| 5475 | |
| 5476 | /* Request own number */ |
| 5477 | /* From remote MSC instead of BSSAP directly */ |
| 5478 | /* Patch the correct N_SD value into the message. */ |
| 5479 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(ussd_req_v); |
| 5480 | var RAN_Emulation.ConnectionData cd; |
| 5481 | f_ML3_patch_seq_nr_MS_NW(f_next_n_sd(last_n_sd, f_ML3_n_sd_idx(ussd_req_v)), l3_enc); |
| 5482 | GSUP.send(ts_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST, |
| 5483 | pars.imsi, remote_msc_name, local_msc_name, |
| 5484 | valueof(t_GSUP_AN_APDU(OSMO_GSUP_AN_PROTO_48006, |
| 5485 | enc_PDU_BSSAP(valueof(ts_BSSAP_DTAP(l3_enc))) |
| 5486 | )) |
| 5487 | )); |
| 5488 | |
| 5489 | /* Expect GSUP message containing the SS payload */ |
| 5490 | gsup_req_complete := f_expect_gsup_msg(gsup_req); |
| 5491 | |
| 5492 | /* Compose the response from HLR using received session ID */ |
| 5493 | var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ( |
| 5494 | imsi := g_pars.imsi, |
| 5495 | sid := gsup_req_complete.ies[1].val.session_id, |
| 5496 | state := OSMO_GSUP_SESSION_STATE_END, |
| 5497 | ss := valueof(facility_rsp) |
| 5498 | ); |
| 5499 | |
| 5500 | /* Finally, HLR terminates the session */ |
| 5501 | GSUP.send(gsup_rsp); |
| 5502 | |
| 5503 | /* The USSD response goes out to remote MSC, on GSUP E instead of BSSAP */ |
| 5504 | var GSUP_PDU gsup_ussd_rsp; |
| 5505 | GSUP.receive(tr_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST, |
| 5506 | pars.imsi, destination_name := remote_msc_name)) -> value gsup_ussd_rsp; |
| 5507 | |
| 5508 | var GSUP_IeValue an_apdu; |
| 5509 | if (not f_gsup_find_ie(gsup_ussd_rsp, OSMO_GSUP_AN_APDU_IE, an_apdu)) { |
| 5510 | setverdict(fail, "No AN-APDU in received GSUP message. Expected USSD response in DTAP, got", gsup_ussd_rsp); |
| 5511 | mtc.stop; |
| 5512 | } |
| 5513 | var PDU_BSSAP bssap_dtap_mt := dec_PDU_BSSAP(an_apdu.an_apdu.pdu); |
| 5514 | var PDU_ML3_NW_MS dtap_mt := dec_PDU_ML3_NW_MS(bssap_dtap_mt.pdu.dtap); |
| 5515 | log("Expecting", ussd_rsp); |
| 5516 | log("Got", dtap_mt); |
| 5517 | if (not match(dtap_mt, ussd_rsp)) { |
| 5518 | setverdict(fail, "Unexpected GSUP message. Expected USSD response in DTAP, got", gsup_ussd_rsp); |
| 5519 | mtc.stop; |
| 5520 | } |
| 5521 | } |
| 5522 | /**********************************/ |
| 5523 | |
| 5524 | |
| 5525 | /* inter-MSC handover back to the first MSC */ |
| 5526 | f_create_bssmap_exp_handoverRequest(193); |
| 5527 | cil := { cIl_CGI := { ts_BSSMAP_CI_CGI('262'H, '42'H, 23, 42) } }; |
| 5528 | |
| 5529 | /* old BSS sends Handover Required, via inter-MSC E link: like |
| 5530 | * BSSAP.send(ts_BSSMAP_HandoverRequired(cause, cil)); |
| 5531 | * but via GSUP */ |
| 5532 | GSUP.send(ts_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_REQUEST, |
| 5533 | pars.imsi, remote_msc_name, local_msc_name, |
| 5534 | valueof(t_GSUP_AN_APDU(OSMO_GSUP_AN_PROTO_48006, |
| 5535 | enc_PDU_BSSAP(valueof(ts_BSSMAP_HandoverRequired(cause, cil))) |
| 5536 | )) |
| 5537 | )); |
| 5538 | |
| 5539 | /* MSC asks local BSS to prepare Handover to it */ |
| 5540 | BSSAP.receive(tr_BSSMAP_HandoverRequest); |
| 5541 | |
| 5542 | /* Make sure the new BSSAP conn continues with the correct N_SD sequence numbers */ |
| 5543 | f_bssmap_continue_after_n_sd(last_n_sd); |
| 5544 | |
| 5545 | /* new BSS composes a RR Handover Command */ |
| 5546 | rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5547 | rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5548 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 5549 | BSSAP.send(ts_BSSMAP_HandoverRequestAcknowledge(rr_ho_cmd_enc, lengthof(rr_ho_cmd_enc), |
| 5550 | tla, ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}))); |
| 5551 | |
| 5552 | /* HandoverCommand goes out via remote MSC-I */ |
| 5553 | var GSUP_PDU prep_subsq_ho_res; |
| 5554 | GSUP.receive(tr_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_RESULT, |
| 5555 | pars.imsi, destination_name := remote_msc_name)) -> value prep_subsq_ho_res; |
| 5556 | |
| 5557 | /* MS shows up at the local BSS */ |
| 5558 | BSSAP.send(ts_BSSMAP_HandoverDetect); |
| 5559 | f_sleep(0.1); |
| 5560 | BSSAP.send(ts_BSSMAP_HandoverComplete); |
| 5561 | |
| 5562 | /* Handover Succeeded message */ |
| 5563 | GSUP.receive(tr_GSUP_E_AN_APDU(OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST, |
| 5564 | pars.imsi, destination_name := remote_msc_name)); |
| 5565 | |
| 5566 | /* MS has handovered to here, Clear Command goes out via remote MSC-I -- in form of a GSUP Close. */ |
| 5567 | GSUP.receive(tr_GSUP_E_NO_PDU(OSMO_GSUP_MSGT_E_CLOSE, |
| 5568 | pars.imsi, destination_name := remote_msc_name)); |
| 5569 | |
| 5570 | /* Handover ends successfully. Call goes on for a little longer and then we hang up. */ |
| 5571 | |
| 5572 | f_sleep(1.0); |
| 5573 | deactivate(ack_mdcx); |
| 5574 | |
| 5575 | /* FIXME: the inter-MSC call has put a number of MNCC messages in the queue, which above code should expect and |
| 5576 | * clear out. The f_call_hangup() expects an MNCC_REL_IND, so, for the time being, just clear the MNCC messages |
| 5577 | * before starting the call hangup. Instead of this, the individual messages should be tested for above. */ |
| 5578 | MNCC.clear; |
| 5579 | |
| 5580 | var default ccrel := activate(as_optional_cc_rel(cpars, true)); |
| 5581 | f_call_hangup(cpars, true); |
| 5582 | f_sleep(1.0); |
| 5583 | deactivate(ccrel); |
| 5584 | |
| 5585 | setverdict(pass); |
| 5586 | } |
| 5587 | testcase TC_ho_inter_msc_out() runs on MTC_CT { |
| 5588 | var BSC_ConnHdlr vc_conn; |
| 5589 | f_init(1); |
| 5590 | |
| 5591 | var BSC_ConnHdlrPars pars := f_init_pars(54); |
| 5592 | |
| 5593 | vc_conn := f_start_handler_with_pars(refers(f_tc_ho_inter_msc_out), pars, 0); |
| 5594 | vc_conn.done; |
| 5595 | } |
| 5596 | |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5597 | private function f_tc_lu_imsi_auth_tmsi_check_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5598 | pars.net.expect_auth := true; |
| 5599 | pars.net.expect_imei := true; |
| 5600 | f_init_handler(pars); |
| 5601 | f_perform_lu(); |
| 5602 | } |
| 5603 | testcase TC_lu_imsi_auth_tmsi_check_imei() runs on MTC_CT { |
| 5604 | var BSC_ConnHdlr vc_conn; |
| 5605 | f_init(); |
| 5606 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5607 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5608 | |
| 5609 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei), 5); |
| 5610 | vc_conn.done; |
| 5611 | } |
| 5612 | |
| 5613 | private function f_tc_lu_imsi_auth3g_tmsi_check_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5614 | pars.net.expect_auth := true; |
| 5615 | pars.use_umts_aka := true; |
| 5616 | pars.net.expect_imei := true; |
| 5617 | f_init_handler(pars); |
| 5618 | f_perform_lu(); |
| 5619 | } |
| 5620 | testcase TC_lu_imsi_auth3g_tmsi_check_imei() runs on MTC_CT { |
| 5621 | var BSC_ConnHdlr vc_conn; |
| 5622 | f_init(); |
| 5623 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5624 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5625 | |
| 5626 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth3g_tmsi_check_imei), 5); |
| 5627 | vc_conn.done; |
| 5628 | } |
| 5629 | |
| 5630 | private function f_tc_lu_imsi_noauth_tmsi_check_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5631 | pars.net.expect_imei := true; |
| 5632 | f_init_handler(pars); |
| 5633 | f_perform_lu(); |
| 5634 | } |
| 5635 | testcase TC_lu_imsi_noauth_tmsi_check_imei() runs on MTC_CT { |
| 5636 | var BSC_ConnHdlr vc_conn; |
| 5637 | f_init(); |
| 5638 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5639 | |
| 5640 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_tmsi_check_imei), 5); |
| 5641 | vc_conn.done; |
| 5642 | } |
| 5643 | |
| 5644 | private function f_tc_lu_imsi_noauth_notmsi_check_imei(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5645 | pars.net.expect_tmsi := false; |
| 5646 | pars.net.expect_imei := true; |
| 5647 | f_init_handler(pars); |
| 5648 | f_perform_lu(); |
| 5649 | } |
| 5650 | testcase TC_lu_imsi_noauth_notmsi_check_imei() runs on MTC_CT { |
| 5651 | var BSC_ConnHdlr vc_conn; |
| 5652 | f_init(); |
| 5653 | f_vty_config(MSCVTY, "msc", "no assign-tmsi"); |
| 5654 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5655 | |
| 5656 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_notmsi_check_imei), 5); |
| 5657 | vc_conn.done; |
| 5658 | } |
| 5659 | |
| 5660 | private function f_tc_lu_imsi_auth_tmsi_check_imei_nack(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5661 | var PDU_ML3_MS_NW l3_lu; |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5662 | |
| 5663 | pars.net.expect_auth := true; |
| 5664 | pars.net.expect_imei := true; |
| 5665 | pars.net.check_imei_result := OSMO_GSUP_IMEI_RESULT_NACK; |
| 5666 | f_init_handler(pars); |
| 5667 | |
| 5668 | /* Cannot use f_perform_lu() as we expect a reject */ |
| 5669 | l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 5670 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 5671 | f_bssap_compl_l3(l3_lu); |
| 5672 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 5673 | |
| 5674 | f_mm_common(); |
| 5675 | f_msc_lu_hlr(); |
| 5676 | f_mm_imei(); |
Oliver Smith | 91bfa1c | 2019-07-19 15:01:15 +0200 | [diff] [blame] | 5677 | f_expect_lu_reject(); |
Oliver Smith | 690d60f | 2019-07-23 13:09:08 +0200 | [diff] [blame] | 5678 | f_expect_clear(); |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5679 | } |
| 5680 | testcase TC_lu_imsi_auth_tmsi_check_imei_nack() runs on MTC_CT { |
| 5681 | var BSC_ConnHdlr vc_conn; |
| 5682 | f_init(); |
| 5683 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5684 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5685 | |
| 5686 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei_nack), 5); |
| 5687 | vc_conn.done; |
| 5688 | } |
| 5689 | |
| 5690 | private function f_tc_lu_imsi_auth_tmsi_check_imei_err(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5691 | var PDU_ML3_MS_NW l3_lu; |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5692 | |
| 5693 | pars.net.expect_auth := true; |
| 5694 | pars.net.expect_imei := true; |
| 5695 | pars.net.check_imei_error := true; |
| 5696 | f_init_handler(pars); |
| 5697 | |
| 5698 | /* Cannot use f_perform_lu() as we expect a reject */ |
| 5699 | l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 5700 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 5701 | f_bssap_compl_l3(l3_lu); |
| 5702 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 5703 | |
| 5704 | f_mm_common(); |
| 5705 | f_msc_lu_hlr(); |
| 5706 | f_mm_imei(); |
Oliver Smith | 91bfa1c | 2019-07-19 15:01:15 +0200 | [diff] [blame] | 5707 | f_expect_lu_reject(); |
Oliver Smith | 690d60f | 2019-07-23 13:09:08 +0200 | [diff] [blame] | 5708 | f_expect_clear(); |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5709 | } |
| 5710 | testcase TC_lu_imsi_auth_tmsi_check_imei_err() runs on MTC_CT { |
| 5711 | var BSC_ConnHdlr vc_conn; |
| 5712 | f_init(); |
| 5713 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5714 | f_vty_config(MSCVTY, "msc", "check-imei-rqd 1"); |
| 5715 | |
| 5716 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei_err), 5); |
| 5717 | vc_conn.done; |
| 5718 | } |
| 5719 | |
| 5720 | private function f_tc_lu_imsi_auth_tmsi_check_imei_early(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5721 | pars.net.expect_auth := true; |
| 5722 | pars.net.expect_imei_early := true; |
| 5723 | f_init_handler(pars); |
| 5724 | f_perform_lu(); |
| 5725 | } |
| 5726 | testcase TC_lu_imsi_auth_tmsi_check_imei_early() runs on MTC_CT { |
| 5727 | var BSC_ConnHdlr vc_conn; |
| 5728 | f_init(); |
| 5729 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5730 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5731 | |
| 5732 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei_early), 5); |
| 5733 | vc_conn.done; |
| 5734 | } |
| 5735 | |
| 5736 | private function f_tc_lu_imsi_auth3g_tmsi_check_imei_early(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5737 | pars.net.expect_auth := true; |
| 5738 | pars.use_umts_aka := true; |
| 5739 | pars.net.expect_imei_early := true; |
| 5740 | f_init_handler(pars); |
| 5741 | f_perform_lu(); |
| 5742 | } |
| 5743 | testcase TC_lu_imsi_auth3g_tmsi_check_imei_early() runs on MTC_CT { |
| 5744 | var BSC_ConnHdlr vc_conn; |
| 5745 | f_init(); |
| 5746 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5747 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5748 | |
| 5749 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth3g_tmsi_check_imei_early), 5); |
| 5750 | vc_conn.done; |
| 5751 | } |
| 5752 | |
| 5753 | private function f_tc_lu_imsi_noauth_tmsi_check_imei_early(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5754 | pars.net.expect_imei_early := true; |
| 5755 | f_init_handler(pars); |
| 5756 | f_perform_lu(); |
| 5757 | } |
| 5758 | testcase TC_lu_imsi_noauth_tmsi_check_imei_early() runs on MTC_CT { |
| 5759 | var BSC_ConnHdlr vc_conn; |
| 5760 | f_init(); |
| 5761 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5762 | |
| 5763 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_tmsi_check_imei_early), 5); |
| 5764 | vc_conn.done; |
| 5765 | } |
| 5766 | |
| 5767 | private function f_tc_lu_imsi_noauth_notmsi_check_imei_early(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5768 | pars.net.expect_tmsi := false; |
| 5769 | pars.net.expect_imei_early := true; |
| 5770 | f_init_handler(pars); |
| 5771 | f_perform_lu(); |
| 5772 | } |
| 5773 | testcase TC_lu_imsi_noauth_notmsi_check_imei_early() runs on MTC_CT { |
| 5774 | var BSC_ConnHdlr vc_conn; |
| 5775 | f_init(); |
| 5776 | f_vty_config(MSCVTY, "msc", "no assign-tmsi"); |
| 5777 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5778 | |
| 5779 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_notmsi_check_imei_early), 5); |
| 5780 | vc_conn.done; |
| 5781 | } |
| 5782 | |
| 5783 | private function f_tc_lu_imsi_auth_tmsi_check_imei_early_nack(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5784 | var PDU_ML3_MS_NW l3_lu; |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5785 | |
| 5786 | pars.net.expect_auth := true; |
| 5787 | pars.net.expect_imei_early := true; |
| 5788 | pars.net.check_imei_result := OSMO_GSUP_IMEI_RESULT_NACK; |
| 5789 | f_init_handler(pars); |
| 5790 | |
| 5791 | /* Cannot use f_perform_lu() as we expect a reject */ |
| 5792 | l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 5793 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 5794 | f_bssap_compl_l3(l3_lu); |
| 5795 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 5796 | |
| 5797 | f_mm_imei_early(); |
Oliver Smith | 91bfa1c | 2019-07-19 15:01:15 +0200 | [diff] [blame] | 5798 | f_expect_lu_reject(); |
Oliver Smith | 690d60f | 2019-07-23 13:09:08 +0200 | [diff] [blame] | 5799 | f_expect_clear(); |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5800 | } |
| 5801 | testcase TC_lu_imsi_auth_tmsi_check_imei_early_nack() runs on MTC_CT { |
| 5802 | var BSC_ConnHdlr vc_conn; |
| 5803 | f_init(); |
| 5804 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5805 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5806 | |
| 5807 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei_early_nack), 5); |
| 5808 | vc_conn.done; |
| 5809 | } |
| 5810 | |
| 5811 | private function f_tc_lu_imsi_auth_tmsi_check_imei_early_err(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 5812 | var PDU_ML3_MS_NW l3_lu; |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5813 | |
| 5814 | pars.net.expect_auth := true; |
| 5815 | pars.net.expect_imei_early := true; |
| 5816 | pars.net.check_imei_error := true; |
| 5817 | f_init_handler(pars); |
| 5818 | |
| 5819 | /* Cannot use f_perform_lu() as we expect a reject */ |
| 5820 | l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 5821 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 5822 | f_bssap_compl_l3(l3_lu); |
| 5823 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 5824 | |
| 5825 | f_mm_imei_early(); |
Oliver Smith | 91bfa1c | 2019-07-19 15:01:15 +0200 | [diff] [blame] | 5826 | f_expect_lu_reject(); |
Oliver Smith | 690d60f | 2019-07-23 13:09:08 +0200 | [diff] [blame] | 5827 | f_expect_clear(); |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5828 | } |
| 5829 | testcase TC_lu_imsi_auth_tmsi_check_imei_early_err() runs on MTC_CT { |
| 5830 | var BSC_ConnHdlr vc_conn; |
| 5831 | f_init(); |
| 5832 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 5833 | f_vty_config(MSCVTY, "msc", "check-imei-rqd early"); |
| 5834 | |
| 5835 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_check_imei_early_err), 5); |
| 5836 | vc_conn.done; |
| 5837 | } |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 5838 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 5839 | control { |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 5840 | execute( TC_cr_before_reset() ); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 5841 | execute( TC_lu_imsi_noauth_tmsi() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 5842 | execute( TC_lu_imsi_noauth_notmsi() ); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 5843 | execute( TC_lu_imsi_reject() ); |
| 5844 | execute( TC_lu_imsi_timeout_gsup() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 5845 | execute( TC_lu_imsi_auth_tmsi() ); |
Harald Welte | 8a397ae | 2019-04-21 22:03:37 +0200 | [diff] [blame] | 5846 | execute( TC_lu_imsi_auth3g_tmsi() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 5847 | execute( TC_cmserv_imsi_unknown() ); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 5848 | execute( TC_lu_and_mo_call() ); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 5849 | execute( TC_lu_auth_sai_timeout() ); |
| 5850 | execute( TC_lu_auth_sai_err() ); |
Harald Welte | e1a2f3c | 2018-01-24 17:28:48 +0100 | [diff] [blame] | 5851 | execute( TC_lu_clear_request() ); |
| 5852 | execute( TC_lu_disconnect() ); |
| 5853 | execute( TC_lu_by_imei() ); |
| 5854 | execute( TC_lu_by_tmsi_noauth_unknown() ); |
| 5855 | execute( TC_imsi_detach_by_imsi() ); |
| 5856 | execute( TC_imsi_detach_by_tmsi() ); |
| 5857 | execute( TC_imsi_detach_by_imei() ); |
| 5858 | execute( TC_emerg_call_imei_reject() ); |
| 5859 | execute( TC_emerg_call_imsi() ); |
| 5860 | execute( TC_cm_serv_req_vgcs_reject() ); |
| 5861 | execute( TC_cm_serv_req_vbs_reject() ); |
| 5862 | execute( TC_cm_serv_req_lcs_reject() ); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 5863 | execute( TC_cm_reest_req_reject() ); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 5864 | execute( TC_lu_auth_2G_fail() ); |
| 5865 | execute( TC_lu_imsi_auth_tmsi_encr_13_13() ); |
| 5866 | execute( TC_cl3_no_payload() ); |
| 5867 | execute( TC_cl3_rnd_payload() ); |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 5868 | execute( TC_establish_and_nothing() ); |
| 5869 | execute( TC_mo_setup_and_nothing() ); |
| 5870 | execute( TC_mo_crcx_ran_timeout() ); |
| 5871 | execute( TC_mo_crcx_ran_reject() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 5872 | execute( TC_mt_crcx_ran_reject() ); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 5873 | execute( TC_mo_setup_and_dtmf_dup() ); |
Harald Welte | aa54cf8 | 2018-01-30 08:15:32 +0100 | [diff] [blame] | 5874 | //execute( TC_mt_t310() ); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 5875 | execute( TC_gsup_cancel() ); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 5876 | execute( TC_lu_imsi_auth_tmsi_encr_1_13() ); |
| 5877 | execute( TC_lu_imsi_auth_tmsi_encr_3_13() ); |
| 5878 | execute( TC_lu_imsi_auth_tmsi_encr_3_1() ); |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 5879 | execute( TC_lu_imsi_auth_tmsi_encr_3_1_no_cm() ); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 5880 | execute( TC_lu_imsi_auth_tmsi_encr_13_2() ); |
| 5881 | execute( TC_lu_imsi_auth_tmsi_encr_013_2() ); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 5882 | execute( TC_mo_release_timeout() ); |
Philipp Maier | 2a98a73 | 2018-03-19 16:06:12 +0100 | [diff] [blame] | 5883 | execute( TC_lu_and_mt_call_no_dlcx_resp() ); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 5884 | execute( TC_reset_two() ); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 5885 | |
| 5886 | execute( TC_lu_and_mt_call() ); |
| 5887 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 5888 | execute( TC_lu_and_mo_sms() ); |
| 5889 | execute( TC_lu_and_mt_sms() ); |
Philipp Maier | 3983e70 | 2018-11-22 19:01:33 +0100 | [diff] [blame] | 5890 | execute( TC_lu_and_mt_sms_paging_and_nothing() ); |
Alexander Couzens | fc02f24 | 2019-09-12 03:43:18 +0200 | [diff] [blame] | 5891 | execute( TC_lu_and_mt_sms_paging_repeated() ); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 5892 | execute( TC_smpp_mo_sms() ); |
| 5893 | execute( TC_smpp_mt_sms() ); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 5894 | |
Vadim Yanitskiy | 103d09f | 2018-11-12 02:50:23 +0700 | [diff] [blame] | 5895 | execute( TC_gsup_mo_sms() ); |
Vadim Yanitskiy | 9cc019a | 2018-11-15 02:06:07 +0700 | [diff] [blame] | 5896 | execute( TC_gsup_mo_smma() ); |
Vadim Yanitskiy | d7b37ab | 2018-11-24 03:40:20 +0700 | [diff] [blame] | 5897 | execute( TC_gsup_mt_sms_ack() ); |
| 5898 | execute( TC_gsup_mt_sms_err() ); |
Vadim Yanitskiy | be1ff4b | 2019-01-18 15:04:13 +0700 | [diff] [blame] | 5899 | execute( TC_gsup_mt_sms_rp_mr() ); |
Vadim Yanitskiy | 5ac49cc | 2019-01-24 16:57:31 +0700 | [diff] [blame] | 5900 | execute( TC_gsup_mo_mt_sms_rp_mr() ); |
Vadim Yanitskiy | a2a8a11 | 2019-07-08 20:04:32 +0700 | [diff] [blame] | 5901 | execute( TC_gsup_mt_multi_part_sms() ); |
Vadim Yanitskiy | 103d09f | 2018-11-12 02:50:23 +0700 | [diff] [blame] | 5902 | |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 5903 | execute( TC_lu_and_mo_ussd_single_request() ); |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 5904 | execute( TC_lu_and_mt_ussd_notification() ); |
Vadim Yanitskiy | 2a978b9 | 2018-06-19 17:51:20 +0700 | [diff] [blame] | 5905 | execute( TC_lu_and_mo_ussd_during_mt_call() ); |
Vadim Yanitskiy | 13e4a27 | 2018-06-19 18:24:31 +0700 | [diff] [blame] | 5906 | execute( TC_lu_and_mt_ussd_during_mt_call() ); |
Vadim Yanitskiy | 2daf52d | 2018-06-21 04:19:58 +0700 | [diff] [blame] | 5907 | execute( TC_lu_and_mo_ussd_mo_release() ); |
Vadim Yanitskiy | 0e392dd | 2018-11-29 00:47:54 +0700 | [diff] [blame] | 5908 | execute( TC_lu_and_ss_session_timeout() ); |
Vadim Yanitskiy | 7d1f918 | 2018-05-28 16:21:42 +0700 | [diff] [blame] | 5909 | |
Vadim Yanitskiy | 0e6c9f5 | 2019-06-15 01:01:28 +0700 | [diff] [blame] | 5910 | execute( TC_mt_ussd_for_unknown_subscr() ); |
Vadim Yanitskiy | c3c07d4 | 2019-06-17 23:00:44 +0700 | [diff] [blame] | 5911 | execute( TC_mo_ussd_for_unknown_trans() ); |
Vadim Yanitskiy | d612d28 | 2019-06-15 14:46:03 +0700 | [diff] [blame] | 5912 | execute( TC_proc_ss_for_unknown_session() ); |
Vadim Yanitskiy | e5f4ed9 | 2019-06-16 02:36:33 +0700 | [diff] [blame] | 5913 | execute( TC_proc_ss_paging_fail() ); |
Vadim Yanitskiy | 29ba8d6 | 2019-06-16 15:19:41 +0700 | [diff] [blame] | 5914 | execute( TC_proc_ss_abort() ); |
Vadim Yanitskiy | 0e6c9f5 | 2019-06-15 01:01:28 +0700 | [diff] [blame] | 5915 | |
Stefan Sperling | 89eb1f3 | 2018-12-17 15:06:20 +0100 | [diff] [blame] | 5916 | execute( TC_cipher_complete_with_invalid_cipher() ); |
Stefan Sperling | a2d59c6 | 2018-12-18 16:32:44 +0100 | [diff] [blame] | 5917 | execute( TC_cipher_complete_1_without_cipher() ); |
| 5918 | execute( TC_cipher_complete_3_without_cipher() ); |
| 5919 | execute( TC_cipher_complete_13_without_cipher() ); |
Harald Welte | b2284bd | 2019-05-10 11:30:43 +0200 | [diff] [blame] | 5920 | execute( TC_lu_with_invalid_mcc_mnc() ); |
Stefan Sperling | 89eb1f3 | 2018-12-17 15:06:20 +0100 | [diff] [blame] | 5921 | |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5922 | execute( TC_sgsap_reset() ); |
| 5923 | execute( TC_sgsap_lu() ); |
| 5924 | execute( TC_sgsap_lu_imsi_reject() ); |
| 5925 | execute( TC_sgsap_lu_and_nothing() ); |
| 5926 | execute( TC_sgsap_expl_imsi_det_eps() ); |
Philipp Maier | fc19f17 | 2019-03-21 11:17:54 +0100 | [diff] [blame] | 5927 | execute( TC_sgsap_impl_imsi_det_eps() ); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5928 | execute( TC_sgsap_expl_imsi_det_noneps() ); |
Philipp Maier | 5d81270 | 2019-03-21 10:51:26 +0100 | [diff] [blame] | 5929 | execute( TC_sgsap_impl_imsi_det_noneps() ); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5930 | execute( TC_sgsap_paging_rej() ); |
| 5931 | execute( TC_sgsap_paging_subscr_rej() ); |
| 5932 | execute( TC_sgsap_paging_ue_unr() ); |
| 5933 | execute( TC_sgsap_paging_and_nothing() ); |
| 5934 | execute( TC_sgsap_paging_and_lu() ); |
| 5935 | execute( TC_sgsap_mt_sms() ); |
| 5936 | execute( TC_sgsap_mo_sms() ); |
| 5937 | execute( TC_sgsap_mt_sms_and_nothing() ); |
| 5938 | execute( TC_sgsap_mt_sms_and_reject() ); |
| 5939 | execute( TC_sgsap_unexp_ud() ); |
| 5940 | execute( TC_sgsap_unsol_ud() ); |
| 5941 | execute( TC_bssap_lu_sgsap_lu_and_mt_call() ); |
| 5942 | execute( TC_sgsap_lu_and_mt_call() ); |
Philipp Maier | 628c005 | 2019-04-09 17:36:57 +0200 | [diff] [blame] | 5943 | execute( TC_sgsap_vlr_failure() ); |
Harald Welte | 4263c52 | 2018-12-06 11:56:27 +0100 | [diff] [blame] | 5944 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 5945 | execute( TC_ho_inter_bsc_unknown_cell() ); |
| 5946 | execute( TC_ho_inter_bsc() ); |
| 5947 | |
| 5948 | execute( TC_ho_inter_msc_out() ); |
| 5949 | |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 5950 | execute( TC_lu_imsi_auth_tmsi_check_imei() ); |
| 5951 | execute( TC_lu_imsi_auth3g_tmsi_check_imei() ); |
| 5952 | execute( TC_lu_imsi_noauth_tmsi_check_imei() ); |
| 5953 | execute( TC_lu_imsi_noauth_notmsi_check_imei() ); |
| 5954 | execute( TC_lu_imsi_auth_tmsi_check_imei_nack() ); |
| 5955 | execute( TC_lu_imsi_auth_tmsi_check_imei_err() ); |
| 5956 | execute( TC_lu_imsi_auth_tmsi_check_imei_early() ); |
| 5957 | execute( TC_lu_imsi_auth3g_tmsi_check_imei_early() ); |
| 5958 | execute( TC_lu_imsi_noauth_tmsi_check_imei_early() ); |
| 5959 | execute( TC_lu_imsi_noauth_notmsi_check_imei_early() ); |
| 5960 | execute( TC_lu_imsi_auth_tmsi_check_imei_early_nack() ); |
| 5961 | execute( TC_lu_imsi_auth_tmsi_check_imei_early_err() ); |
| 5962 | |
Neels Hofmeyr | 1b3c6e3 | 2018-03-01 17:52:21 +0100 | [diff] [blame] | 5963 | /* Run this last: at the time of writing this test crashes the MSC */ |
| 5964 | execute( TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() ); |
Neels Hofmeyr | 692c9ee | 2018-04-10 02:07:13 +0200 | [diff] [blame] | 5965 | execute( TC_mo_cc_bssmap_clear() ); |
Pau Espin Pedrol | 690d659 | 2019-05-31 17:56:32 +0200 | [diff] [blame] | 5966 | if (mp_enable_osmux_test) { |
| 5967 | execute( TC_lu_and_mt_call_osmux() ); |
| 5968 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 5969 | } |
| 5970 | |
| 5971 | |
| 5972 | } |