Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 1 | module MSC_Tests { |
| 2 | |
| 3 | import from General_Types all; |
| 4 | import from Osmocom_Types all; |
| 5 | |
| 6 | import from M3UA_Types all; |
| 7 | import from M3UA_Emulation all; |
| 8 | |
| 9 | import from MTP3asp_Types all; |
| 10 | import from MTP3asp_PortType all; |
| 11 | |
| 12 | import from SCCPasp_Types all; |
| 13 | import from SCCP_Types all; |
| 14 | import from SCCP_Emulation all; |
| 15 | |
| 16 | import from SCTPasp_Types all; |
| 17 | import from SCTPasp_PortType all; |
| 18 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 19 | import from Osmocom_CTRL_Functions all; |
| 20 | import from Osmocom_CTRL_Types all; |
| 21 | import from Osmocom_CTRL_Adapter all; |
| 22 | |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 23 | import from TELNETasp_PortType all; |
| 24 | import from Osmocom_VTY_Functions all; |
| 25 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 26 | import from MNCC_Emulation all; |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 27 | import from MNCC_Types all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 28 | |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 29 | import from MGCP_Emulation all; |
| 30 | import from MGCP_Types all; |
| 31 | import from MGCP_Templates all; |
| 32 | import from SDP_Types all; |
| 33 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 34 | import from GSUP_Emulation all; |
| 35 | import from GSUP_Types all; |
| 36 | import from IPA_Emulation all; |
| 37 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 38 | import from BSSAP_Types all; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 39 | import from BSSAP_Adapter all; |
| 40 | import from BSSAP_CodecPort all; |
| 41 | import from BSSMAP_Templates all; |
| 42 | import from BSSMAP_Emulation all; |
| 43 | import from BSC_ConnectionHandler all; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 44 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 45 | import from MobileL3_Types all; |
| 46 | import from MobileL3_CommonIE_Types all; |
| 47 | import from L3_Templates all; |
Harald Welte | 158a7ca | 2018-02-16 18:11:31 +0100 | [diff] [blame] | 48 | import from L3_Common all; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 49 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 50 | import from SMPP_Types all; |
| 51 | import from SMPP_Templates all; |
| 52 | import from SMPP_Emulation all; |
| 53 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 54 | const integer NUM_BSC := 2; |
| 55 | type record of BSSAP_Configuration BSSAP_Configurations; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 56 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 57 | type component MTC_CT extends CTRL_Adapter_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 58 | var boolean g_initialized := false; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 59 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 60 | var BSSAP_Adapter g_bssap[NUM_BSC]; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 61 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 62 | /* no 'adapter_CT' for MNCC or GSUP */ |
| 63 | var MNCC_Emulation_CT vc_MNCC; |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 64 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 65 | var GSUP_Emulation_CT vc_GSUP; |
| 66 | var IPA_Emulation_CT vc_GSUP_IPA; |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 67 | var SMPP_Emulation_CT vc_SMPP; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 68 | |
| 69 | /* only to get events from IPA underneath GSUP */ |
| 70 | port IPA_CTRL_PT GSUP_IPA_EVENT; |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 71 | /* VTY to MSC */ |
| 72 | port TELNETasp_PT MSCVTY; |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 73 | |
| 74 | /* A port to directly send BSSAP messages. This port is used for |
| 75 | * tests that require low level access to sen arbitrary BSSAP |
| 76 | * messages. Run f_init_bssap_direct() to connect and initialize */ |
| 77 | port BSSAP_CODEC_PT BSSAP_DIRECT; |
| 78 | |
| 79 | /* When BSSAP messages are directly sent, then the connection |
| 80 | * handler is not active, which means that also no guard timer is |
| 81 | * set up. The following timer will serve as a replacement */ |
| 82 | timer Tguard_direct := 60.0; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | modulepar { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 86 | /* remote parameters of IUT */ |
| 87 | charstring mp_msc_ip := "127.0.0.1"; |
| 88 | integer mp_msc_ctrl_port := 4255; |
| 89 | integer mp_msc_vty_port := 4254; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 90 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 91 | /* local parameters of emulated HLR */ |
| 92 | charstring mp_hlr_ip := "127.0.0.1"; |
| 93 | integer mp_hlr_port := 4222; |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 94 | charstring mp_mgw_ip := "127.0.0.1"; |
| 95 | integer mp_mgw_port := 2427; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 96 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 97 | charstring mp_msc_mncc := "/tmp/mncc"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 98 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 99 | integer mp_msc_smpp_port := 2775; |
| 100 | charstring mp_smpp_system_id := "msc_tester"; |
| 101 | charstring mp_smpp_password := "osmocom1"; |
| 102 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 103 | BSSAP_Configurations mp_bssap_cfg := { |
| 104 | { |
| 105 | sccp_service_type := "mtp3_itu", |
| 106 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 107 | own_pc := 185, |
| 108 | own_ssn := 254, |
| 109 | peer_pc := 187, |
| 110 | peer_ssn := 254, |
| 111 | sio := '83'O, |
| 112 | rctx := 0 |
| 113 | }, |
| 114 | { |
| 115 | sccp_service_type := "mtp3_itu", |
| 116 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 117 | own_pc := 186, |
| 118 | own_ssn := 254, |
| 119 | peer_pc := 187, |
| 120 | peer_ssn := 254, |
| 121 | sio := '83'O, |
| 122 | rctx := 1 |
| 123 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 124 | }; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 125 | } |
| 126 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 127 | /* altstep for the global guard timer (only used when BSSAP_DIRECT |
| 128 | * is used for communication */ |
| 129 | private altstep as_Tguard_direct() runs on MTC_CT { |
| 130 | [] Tguard_direct.timeout { |
| 131 | setverdict(fail, "Tguard timeout"); |
| 132 | self.stop; |
| 133 | } |
| 134 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 135 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 136 | function f_init_smpp(charstring id) runs on MTC_CT { |
| 137 | id := id & "-SMPP"; |
| 138 | var EsmePars pars := { |
| 139 | mode := MODE_TRANSCEIVER, |
| 140 | bind := { |
| 141 | system_id := mp_smpp_system_id, |
| 142 | password := mp_smpp_password, |
| 143 | system_type := "MSC_Tests", |
| 144 | interface_version := hex2int('34'H), |
| 145 | addr_ton := unknown, |
| 146 | addr_npi := unknown, |
| 147 | address_range := "" |
| 148 | }, |
| 149 | esme_role := true |
| 150 | } |
| 151 | |
| 152 | vc_SMPP := SMPP_Emulation_CT.create(id); |
| 153 | map(vc_SMPP:SMPP_PORT, system:SMPP_PORT); |
| 154 | vc_SMPP.start(SMPP_Emulation.main_client(pars, mp_msc_ip, mp_msc_smpp_port, "", -1)); |
| 155 | } |
| 156 | |
| 157 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 158 | function f_init_mncc(charstring id) runs on MTC_CT { |
| 159 | id := id & "-MNCC"; |
| 160 | var MnccOps ops := { |
| 161 | create_cb := refers(MNCC_Emulation.ExpectedCreateCallback), |
| 162 | unitdata_cb := refers(MNCC_Emulation.DummyUnitdataCallback) |
| 163 | } |
| 164 | |
| 165 | vc_MNCC := MNCC_Emulation_CT.create(id); |
| 166 | map(vc_MNCC:MNCC, system:MNCC_CODEC_PT); |
| 167 | vc_MNCC.start(MNCC_Emulation.main(ops, id, mp_msc_mncc)); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 168 | } |
| 169 | |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 170 | function f_init_mgcp(charstring id) runs on MTC_CT { |
| 171 | id := id & "-MGCP"; |
| 172 | var MGCPOps ops := { |
| 173 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 174 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 175 | } |
| 176 | var MGCP_conn_parameters pars := { |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 177 | callagent_ip := mp_msc_ip, |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 178 | callagent_udp_port := -1, |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 179 | mgw_ip := mp_mgw_ip, |
| 180 | mgw_udp_port := mp_mgw_port |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 184 | map(vc_MGCP:MGCP, system:MGCP_CODEC_PT); |
| 185 | vc_MGCP.start(MGCP_Emulation.main(ops, pars, id)); |
| 186 | } |
| 187 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 188 | function f_init_gsup(charstring id) runs on MTC_CT { |
| 189 | id := id & "-GSUP"; |
| 190 | var GsupOps ops := { |
| 191 | create_cb := refers(GSUP_Emulation.ExpectedCreateCallback) |
| 192 | } |
| 193 | |
| 194 | vc_GSUP_IPA := IPA_Emulation_CT.create(id & "-IPA"); |
| 195 | vc_GSUP := GSUP_Emulation_CT.create(id); |
| 196 | |
| 197 | map(vc_GSUP_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 198 | connect(vc_GSUP:GSUP, vc_GSUP_IPA:IPA_GSUP_PORT); |
| 199 | /* we use this hack to get events like ASP_IPA_EVENT_UP */ |
| 200 | connect(vc_GSUP_IPA:IPA_CTRL_PORT, self:GSUP_IPA_EVENT); |
| 201 | |
| 202 | vc_GSUP.start(GSUP_Emulation.main(ops, id)); |
| 203 | vc_GSUP_IPA.start(IPA_Emulation.main_server(mp_hlr_ip, mp_hlr_port)); |
| 204 | |
| 205 | /* wait for incoming connection to GSUP port before proceeding */ |
| 206 | timer T := 10.0; |
| 207 | T.start; |
| 208 | alt { |
| 209 | [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { } |
| 210 | [] T.timeout { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 211 | setverdict(fail, "No connection to GSUP Port"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 212 | self.stop |
| 213 | } |
| 214 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 215 | } |
| 216 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 217 | function f_init(integer num_bsc := 1) runs on MTC_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 218 | |
| 219 | if (g_initialized == true) { |
| 220 | return; |
| 221 | } |
| 222 | g_initialized := true; |
| 223 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 224 | if (num_bsc > NUM_BSC) { |
| 225 | setverdict(fail, "excess number of BSC instances requested"); |
| 226 | } |
| 227 | |
| 228 | for (var integer i := 0; i < num_bsc; i := i + 1) { |
| 229 | if (isbound(mp_bssap_cfg[i])) { |
Philipp Maier | defd948 | 2018-05-16 16:44:37 +0200 | [diff] [blame] | 230 | f_bssap_init(g_bssap[i], mp_bssap_cfg[i], "MSC_Test_" & int2str(i), BSC_BssmapOps); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 231 | } else { |
| 232 | setverdict(fail, "missing BSSAP configuration"); |
| 233 | } |
| 234 | } |
| 235 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 236 | f_ipa_ctrl_start(mp_msc_ip, mp_msc_ctrl_port); |
| 237 | f_init_mncc("MSC_Test"); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 238 | f_init_mgcp("MSC_Test"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 239 | f_init_gsup("MSC_Test"); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 240 | f_init_smpp("MSC_Test"); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 241 | |
| 242 | map(self:MSCVTY, system:MSCVTY); |
| 243 | f_vty_set_prompts(MSCVTY); |
| 244 | f_vty_transceive(MSCVTY, "enable"); |
Harald Welte | b14c77a | 2018-01-25 17:25:44 +0100 | [diff] [blame] | 245 | |
| 246 | /* set some defaults */ |
| 247 | f_vty_config(MSCVTY, "network", "authentication optional"); |
| 248 | f_vty_config(MSCVTY, "msc", "assign-tmsi"); |
| 249 | f_vty_config(MSCVTY, "network", "encryption a5 0"); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 250 | } |
| 251 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 252 | /* Initialize for a direct connection to BSSAP. This function is an alternative |
| 253 | * to f_init() when the high level functions of the BSC_ConnectionHandler are |
| 254 | * not needed. */ |
| 255 | function f_init_bssap_direct() runs on MTC_CT { |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 256 | f_bssap_init(g_bssap[0], mp_bssap_cfg[0], "MSC_Test", omit); |
| 257 | connect(g_bssap[0].vc_SCCP:SCCP_SP_PORT, self:BSSAP_DIRECT); |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 258 | |
| 259 | /* Start guard timer and activate it as default */ |
| 260 | Tguard_direct.start |
| 261 | activate(as_Tguard_direct()); |
| 262 | } |
| 263 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 264 | template PDU_BSSAP ts_BSSAP_BSSMAP := { |
| 265 | discriminator := '0'B, |
| 266 | spare := '0000000'B, |
| 267 | dlci := omit, |
| 268 | lengthIndicator := 0, /* overwritten by codec */ |
| 269 | pdu := ? |
| 270 | } |
| 271 | |
| 272 | template PDU_BSSAP tr_BSSAP_BSSMAP := { |
| 273 | discriminator := '0'B, |
| 274 | spare := '0000000'B, |
| 275 | dlci := omit, |
| 276 | lengthIndicator := ?, |
| 277 | pdu := { |
| 278 | bssmap := ? |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | |
| 283 | type integer BssmapCause; |
| 284 | |
| 285 | template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := { |
| 286 | elementIdentifier := '04'O, |
| 287 | lengthIndicator := 0, |
| 288 | causeValue := int2bit(val, 7), |
| 289 | extensionCauseValue := '0'B, |
| 290 | spare1 := omit |
| 291 | } |
| 292 | |
| 293 | template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause) modifies ts_BSSAP_BSSMAP := { |
| 294 | pdu := { |
| 295 | bssmap := { |
| 296 | reset := { |
| 297 | messageType := '30'O, |
| 298 | cause := ts_BSSMAP_IE_Cause(cause), |
| 299 | a_InterfaceSelectorForReset := omit |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | template (value) PDU_BSSAP ts_BSSMAP_ResetAck modifies ts_BSSAP_BSSMAP := { |
| 306 | pdu := { |
| 307 | bssmap := { |
| 308 | resetAck := { |
| 309 | messageType := '31'O, |
| 310 | a_InterfaceSelectorForReset := omit |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | template PDU_BSSAP tr_BSSMAP_ResetAck modifies tr_BSSAP_BSSMAP := { |
| 317 | pdu := { |
| 318 | bssmap := { |
| 319 | resetAck := { |
| 320 | messageType := '31'O, |
| 321 | a_InterfaceSelectorForReset := * |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := { |
| 328 | elementIdentifier := '05'O, |
| 329 | lengthIndicator := 0, |
| 330 | cellIdentifierDiscriminator := '0000'B, |
| 331 | spare1_4 := '0000'B, |
| 332 | cellIdentification := ? |
| 333 | } |
| 334 | |
| 335 | type uint16_t BssmapLAC; |
| 336 | type uint16_t BssmapCI; |
| 337 | |
| 338 | /* |
| 339 | template BSSMAP_IE_CellIdentifier ts_CellId_CGI(mcc, mnc, lac, ci) |
| 340 | modifies ts_BSSMAP_IE_CellID := { |
| 341 | cellIdentification := { |
| 342 | cI_LAC_CGI := { |
| 343 | mnc_mcc := FIXME, |
| 344 | lac := int2oct(lac, 2), |
| 345 | ci := int2oct(ci, 2) |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | */ |
| 350 | |
| 351 | template BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci) |
| 352 | modifies ts_BSSMAP_IE_CellID := { |
| 353 | cellIdentification := { |
| 354 | cI_LAC_CI := { |
| 355 | lac := int2oct(lac, 2), |
| 356 | ci := int2oct(ci, 2) |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci) |
| 362 | modifies ts_BSSMAP_IE_CellID := { |
| 363 | cellIdentification := { |
| 364 | cI_CI := int2oct(ci, 2) |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | template BSSMAP_IE_CellIdentifier ts_CellId_none |
| 369 | modifies ts_BSSMAP_IE_CellID := { |
| 370 | cellIdentification := { |
| 371 | cI_noCell := ''O |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | |
| 376 | template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := { |
| 377 | elementIdentifier := '17'O, |
| 378 | lengthIndicator := 0, |
| 379 | layer3info := l3info |
| 380 | } |
| 381 | |
| 382 | template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info) |
| 383 | modifies ts_BSSAP_BSSMAP := { |
| 384 | pdu := { |
| 385 | bssmap := { |
| 386 | completeLayer3Information := { |
| 387 | messageType := '57'O, |
| 388 | cellIdentifier := cell_id, |
| 389 | layer3Information := ts_BSSMAP_IE_L3Info(l3_info), |
| 390 | chosenChannel := omit, |
| 391 | lSAIdentifier := omit, |
| 392 | aPDU := omit, |
| 393 | codecList := omit, |
| 394 | redirectAttemptFlag := omit, |
| 395 | sendSequenceNumber := omit, |
| 396 | iMSI := omit |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | template PDU_BSSAP ts_BSSMAP_HandoReq(BssmapCause cause, BSSMAP_IE_CellIdentifierList cid_list) |
| 403 | modifies ts_BSSAP_BSSMAP := { |
| 404 | pdu := { |
| 405 | bssmap := { |
| 406 | handoverRequired := { |
| 407 | messageType := '11'O, |
| 408 | cause := ts_BSSMAP_IE_Cause(cause), |
| 409 | responseRequest := omit, |
| 410 | cellIdentifierList := cid_list, |
| 411 | circuitPoolList := omit, |
| 412 | currentChannelType1 := omit, |
| 413 | speechVersion := omit, |
| 414 | queueingIndicator := omit, |
| 415 | oldToNewBSSInfo := omit, |
| 416 | sourceToTargetRNCTransparentInfo := omit, |
| 417 | sourceToTargetRNCTransparentInfoCDMA := omit, |
| 418 | gERANClassmark := omit, |
| 419 | talkerPriority := omit, |
| 420 | speechCodec := omit, |
| 421 | cSG_Identifier := omit |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 427 | 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] | 428 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 429 | /* FIXME: move into BSC_ConnectionHandler? */ |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 430 | function f_init_pars(integer imsi_suffix) runs on MTC_CT return BSC_ConnHdlrPars { |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 431 | var BSC_ConnHdlrNetworkPars net_pars := { |
| 432 | kc_support := '0A'O, /* A5/1 and A5/3 enabled */ |
| 433 | expect_tmsi := true, |
| 434 | expect_auth := false, |
| 435 | expect_ciph := false |
| 436 | }; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 437 | var BSC_ConnHdlrPars pars := { |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 438 | sccp_addr_own := g_bssap[0].sccp_addr_own, |
| 439 | sccp_addr_peer := g_bssap[0].sccp_addr_peer, |
Harald Welte | edbab81 | 2018-03-18 16:02:25 +0100 | [diff] [blame] | 440 | cell_id := valueof(ts_CellId_CGI('262'H, '42'H, 23, 42)), |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 441 | imei := f_gen_imei(imsi_suffix), |
| 442 | imsi := f_gen_imsi(imsi_suffix), |
| 443 | msisdn := f_gen_msisdn(imsi_suffix), |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 444 | tmsi := omit, |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 445 | cm1 := valueof(ts_CM1), |
Harald Welte | 8260057 | 2018-01-21 20:54:08 +0100 | [diff] [blame] | 446 | cm2 := valueof(ts_CM2_default), |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 447 | cm3 := omit, |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 448 | vec := omit, |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 449 | net := net_pars, |
| 450 | send_early_cm := true |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 451 | }; |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 452 | return pars; |
| 453 | } |
| 454 | |
| 455 | function f_start_handler_with_pars(void_fn fn, BSC_ConnHdlrPars pars) runs on MTC_CT return BSC_ConnHdlr { |
| 456 | var BSC_ConnHdlr vc_conn; |
| 457 | var charstring id := testcasename(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 458 | |
| 459 | vc_conn := BSC_ConnHdlr.create(id); |
| 460 | /* BSSMAP part / A interface */ |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 461 | connect(vc_conn:BSSAP, g_bssap[0].vc_BSSMAP:CLIENT); |
| 462 | connect(vc_conn:BSSAP_PROC, g_bssap[0].vc_BSSMAP:PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 463 | /* MNCC part */ |
| 464 | connect(vc_conn:MNCC, vc_MNCC:MNCC_CLIENT); |
| 465 | connect(vc_conn:MNCC_PROC, vc_MNCC:MNCC_PROC); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 466 | /* MGCP part */ |
| 467 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 468 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 469 | /* GSUP part */ |
| 470 | connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT); |
| 471 | connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 472 | /* SMPP part */ |
| 473 | connect(vc_conn:SMPP, vc_SMPP:SMPP_CLIENT); |
| 474 | connect(vc_conn:SMPP_PROC, vc_SMPP:SMPP_PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 475 | |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 476 | /* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we cannot have |
| 477 | * 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] | 478 | vc_conn.start(derefers(fn)(id, pars)); |
| 479 | return vc_conn; |
| 480 | } |
| 481 | |
Neels Hofmeyr | 9adaa70 | 2018-03-01 20:23:19 +0100 | [diff] [blame] | 482 | function f_start_handler(void_fn fn, integer imsi_suffix) runs on MTC_CT return BSC_ConnHdlr { |
| 483 | return f_start_handler_with_pars(fn, f_init_pars(imsi_suffix)); |
| 484 | } |
| 485 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 486 | 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] | 487 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 488 | f_perform_lu(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 489 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 490 | testcase TC_lu_imsi_noauth_tmsi() runs on MTC_CT { |
| 491 | var BSC_ConnHdlr vc_conn; |
| 492 | f_init(); |
| 493 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 494 | 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] | 495 | vc_conn.done; |
| 496 | } |
| 497 | |
| 498 | 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] | 499 | pars.net.expect_tmsi := false; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 500 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 501 | f_perform_lu(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 502 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 503 | testcase TC_lu_imsi_noauth_notmsi() runs on MTC_CT { |
| 504 | var BSC_ConnHdlr vc_conn; |
| 505 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 506 | f_vty_config(MSCVTY, "msc", "no assign-tmsi"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 507 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 508 | 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] | 509 | vc_conn.done; |
| 510 | } |
| 511 | |
| 512 | /* Do LU by IMSI, refuse it on GSUP and expect LU REJ back to MS */ |
| 513 | private 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] | 514 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 515 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 516 | |
| 517 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 518 | f_bssap_compl_l3(l3_lu); |
| 519 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 520 | GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23)); |
| 521 | alt { |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 522 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej(int2oct(23,1)))) { |
| 523 | f_expect_clear(); |
| 524 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 525 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 526 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
| 527 | self.stop; |
| 528 | } |
| 529 | } |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 530 | f_expect_clear(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 531 | } |
| 532 | testcase TC_lu_imsi_reject() runs on MTC_CT { |
| 533 | var BSC_ConnHdlr vc_conn; |
| 534 | f_init(); |
| 535 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 536 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_reject), 3); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 537 | vc_conn.done; |
| 538 | } |
| 539 | |
| 540 | /* Do LU by IMSI, timeout on GSUP */ |
| 541 | private 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] | 542 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 543 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 544 | |
| 545 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 546 | f_bssap_compl_l3(l3_lu); |
| 547 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 548 | /* Normally the HLR would need to respond here, but we decide to force a timeout here */ |
| 549 | alt { |
| 550 | /* FIXME: Expect specific reject cause */ |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 551 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 552 | f_expect_clear(); |
| 553 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 554 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 555 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
| 556 | self.stop; |
| 557 | } |
| 558 | } |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 559 | f_expect_clear(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 560 | } |
| 561 | testcase TC_lu_imsi_timeout_gsup() runs on MTC_CT { |
| 562 | var BSC_ConnHdlr vc_conn; |
| 563 | f_init(); |
| 564 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 565 | 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] | 566 | vc_conn.done; |
| 567 | } |
| 568 | |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 569 | 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] | 570 | pars.net.expect_auth := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 571 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 572 | f_perform_lu(); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 573 | } |
| 574 | testcase TC_lu_imsi_auth_tmsi() runs on MTC_CT { |
| 575 | var BSC_ConnHdlr vc_conn; |
| 576 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 577 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 578 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 579 | 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] | 580 | vc_conn.done; |
| 581 | } |
| 582 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 583 | |
| 584 | /* Send CM SERVICE REQ for IMSI that has never performed LU before */ |
| 585 | private function f_tc_cmserv_imsi_unknown(charstring id, BSC_ConnHdlrPars pars) |
| 586 | runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 587 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 588 | |
| 589 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | edbab81 | 2018-03-18 16:02:25 +0100 | [diff] [blame] | 590 | 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] | 591 | 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] | 592 | |
| 593 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 594 | |
| 595 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 596 | f_bssap_compl_l3(l3_info); |
| 597 | |
| 598 | timer T := 10.0; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 599 | T.start; |
| 600 | alt { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 601 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 602 | //[] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC)) { } |
| 603 | [] BSSAP.receive { setverdict(fail, "Received unexpected BSSAP"); } |
| 604 | [] GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) { |
| 605 | setverdict(fail, "Unexpected GSUP UL REQ"); |
| 606 | } |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 607 | [] T.timeout { setverdict(fail, "Timeout waiting for CM SERV REQ"); } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 608 | } |
| 609 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 610 | f_expect_clear(); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 611 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 612 | testcase TC_cmserv_imsi_unknown() runs on MTC_CT { |
| 613 | var BSC_ConnHdlr vc_conn; |
| 614 | f_init(); |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 615 | vc_conn := f_start_handler(refers(f_tc_cmserv_imsi_unknown), 6); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 616 | vc_conn.done; |
| 617 | } |
| 618 | |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 619 | private 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] | 620 | f_init_handler(pars); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 621 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 622 | cpars.bss_rtp_port := 1110; |
| 623 | cpars.mgcp_connection_id_bss := '22222'H; |
| 624 | cpars.mgcp_connection_id_mss := '33333'H; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 625 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 626 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 627 | f_perform_lu(); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 628 | f_mo_call(cpars); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 629 | } |
| 630 | testcase TC_lu_and_mo_call() runs on MTC_CT { |
| 631 | var BSC_ConnHdlr vc_conn; |
| 632 | f_init(); |
| 633 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 634 | 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] | 635 | vc_conn.done; |
| 636 | } |
| 637 | |
| 638 | /* Test LU (with authentication enabled), where HLR times out sending SAI response */ |
| 639 | private 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] | 640 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 641 | |
| 642 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 643 | var PDU_DTAP_MT dtap_mt; |
| 644 | |
| 645 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 646 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 647 | |
| 648 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 649 | f_bssap_compl_l3(l3_lu); |
| 650 | |
| 651 | /* Send Early Classmark, just for the fun of it */ |
| 652 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 653 | |
| 654 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 655 | /* The HLR would normally return an auth vector here, but we fail to do so. */ |
| 656 | |
| 657 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 658 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 659 | } |
| 660 | testcase TC_lu_auth_sai_timeout() runs on MTC_CT { |
| 661 | var BSC_ConnHdlr vc_conn; |
| 662 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 663 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 664 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 665 | 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] | 666 | vc_conn.done; |
| 667 | } |
| 668 | |
| 669 | /* Test LU (with authentication enabled), where HLR rejects sending SAI error */ |
| 670 | private 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] | 671 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 672 | |
| 673 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 674 | var PDU_DTAP_MT dtap_mt; |
| 675 | |
| 676 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 677 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 678 | |
| 679 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 680 | f_bssap_compl_l3(l3_lu); |
| 681 | |
| 682 | /* Send Early Classmark, just for the fun of it */ |
| 683 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 684 | |
| 685 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 686 | GSUP.send(ts_GSUP_SAI_ERR(g_pars.imsi, 13)); |
| 687 | |
| 688 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 689 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 690 | } |
| 691 | testcase TC_lu_auth_sai_err() runs on MTC_CT { |
| 692 | var BSC_ConnHdlr vc_conn; |
| 693 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 694 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 695 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 696 | 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] | 697 | vc_conn.done; |
| 698 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 699 | |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 700 | /* Test LU but BSC will send a clear request in the middle */ |
| 701 | 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] | 702 | f_init_handler(pars); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 703 | |
| 704 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 705 | var PDU_DTAP_MT dtap_mt; |
| 706 | |
| 707 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 708 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 709 | |
| 710 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 711 | f_bssap_compl_l3(l3_lu); |
| 712 | |
| 713 | /* Send Early Classmark, just for the fun of it */ |
| 714 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 715 | |
| 716 | f_sleep(1.0); |
| 717 | /* send clear request in the middle of the LU */ |
| 718 | BSSAP.send(ts_BSSMAP_ClearRequest(0)); |
Neels Hofmeyr | 2b326fa | 2018-04-06 00:59:36 +0200 | [diff] [blame] | 719 | alt { |
| 720 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { repeat; } |
| 721 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) {} |
| 722 | } |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 723 | BSSAP.send(ts_BSSMAP_ClearComplete); |
Harald Welte | 89a3249 | 2018-01-27 19:07:28 +0100 | [diff] [blame] | 724 | alt { |
| 725 | /* See https://osmocom.org/issues/2862 */ |
Neels Hofmeyr | 2b326fa | 2018-04-06 00:59:36 +0200 | [diff] [blame] | 726 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 727 | setverdict(fail, "Got a second Clear Command, only one expected"); |
| 728 | repeat; |
| 729 | } |
Harald Welte | 89a3249 | 2018-01-27 19:07:28 +0100 | [diff] [blame] | 730 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
| 731 | } |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 732 | setverdict(pass); |
| 733 | } |
| 734 | testcase TC_lu_clear_request() runs on MTC_CT { |
| 735 | var BSC_ConnHdlr vc_conn; |
| 736 | f_init(); |
| 737 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 738 | vc_conn := f_start_handler(refers(f_tc_lu_clear_request), 10); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 739 | vc_conn.done; |
| 740 | } |
| 741 | |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 742 | /* Test LU but BSC will send a clear request in the middle */ |
| 743 | private 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] | 744 | f_init_handler(pars); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 745 | |
| 746 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 747 | var PDU_DTAP_MT dtap_mt; |
| 748 | |
| 749 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 750 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 751 | |
| 752 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 753 | f_bssap_compl_l3(l3_lu); |
| 754 | |
| 755 | /* Send Early Classmark, just for the fun of it */ |
| 756 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 757 | |
| 758 | f_sleep(1.0); |
| 759 | /* send clear request in the middle of the LU */ |
| 760 | BSSAP.send(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 761 | setverdict(pass); |
| 762 | } |
| 763 | testcase TC_lu_disconnect() runs on MTC_CT { |
| 764 | var BSC_ConnHdlr vc_conn; |
| 765 | f_init(); |
| 766 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 767 | vc_conn := f_start_handler(refers(f_tc_lu_disconnect), 11); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 768 | vc_conn.done; |
| 769 | } |
| 770 | |
| 771 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 772 | /* Test LU but with illegal mobile identity type = IMEI */ |
| 773 | private 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 */ |
| 783 | f_bssap_compl_l3(l3_lu); |
| 784 | |
| 785 | /* Send Early Classmark, just for the fun of it */ |
| 786 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 787 | /* wait for LU reject, ignore any ID REQ */ |
| 788 | alt { |
| 789 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 790 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req)) { repeat; } |
| 791 | } |
| 792 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 793 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 794 | } |
| 795 | testcase TC_lu_by_imei() runs on MTC_CT { |
| 796 | var BSC_ConnHdlr vc_conn; |
| 797 | f_init(); |
| 798 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 799 | vc_conn := f_start_handler(refers(f_tc_lu_by_imei), 12); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 800 | vc_conn.done; |
| 801 | } |
| 802 | |
| 803 | /* Test LU by TMSI with unknown TMSI, expect (and answer) ID REQ. */ |
| 804 | private function f_tc_lu_tmsi_noauth_unknown(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 805 | f_init_handler(pars); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 806 | |
| 807 | var PDU_ML3_MS_NW l3_lu := f_build_lu_tmsi('01020304'O); /* FIXME: Random */ |
| 808 | var PDU_DTAP_MT dtap_mt; |
| 809 | |
| 810 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 811 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 812 | |
| 813 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 814 | f_bssap_compl_l3(l3_lu); |
| 815 | |
| 816 | /* Send Early Classmark, just for the fun of it */ |
| 817 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 818 | |
| 819 | /* Wait for + respond to ID REQ (IMSI) */ |
| 820 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req('001'B))); |
| 821 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi))); |
| 822 | |
| 823 | /* Expect MSC to do UpdateLocation to HLR; respond to it */ |
| 824 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 825 | GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 826 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 827 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 828 | |
| 829 | alt { |
Harald Welte | 7ec4fa8 | 2018-01-27 10:57:40 +0100 | [diff] [blame] | 830 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 831 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl)); |
| 832 | } |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 833 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 834 | setverdict(fail, "Expected LU ACK, but received REJ"); |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 839 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 840 | } |
| 841 | testcase TC_lu_by_tmsi_noauth_unknown() runs on MTC_CT { |
| 842 | var BSC_ConnHdlr vc_conn; |
| 843 | f_init(); |
| 844 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 845 | 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] | 846 | vc_conn.done; |
| 847 | } |
| 848 | |
| 849 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 850 | /* Test IMSI DETACH (MI=IMSI) */ |
| 851 | private 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] | 852 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 853 | |
| 854 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 855 | |
| 856 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 857 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 858 | |
| 859 | /* Send Early Classmark, just for the fun of it? */ |
| 860 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 861 | |
| 862 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 863 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 864 | } |
| 865 | testcase TC_imsi_detach_by_imsi() runs on MTC_CT { |
| 866 | var BSC_ConnHdlr vc_conn; |
| 867 | f_init(); |
| 868 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 869 | 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] | 870 | vc_conn.done; |
| 871 | } |
| 872 | |
| 873 | /* Test IMSI DETACH (MI=TMSI) */ |
| 874 | private 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] | 875 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 876 | |
| 877 | var MobileIdentityLV mi := valueof(ts_MI_TMSI_LV('01020304'O)); |
| 878 | |
| 879 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 880 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 881 | |
| 882 | /* Send Early Classmark, just for the fun of it? */ |
| 883 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 884 | |
| 885 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 886 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 887 | } |
| 888 | testcase TC_imsi_detach_by_tmsi() runs on MTC_CT { |
| 889 | var BSC_ConnHdlr vc_conn; |
| 890 | f_init(); |
| 891 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 892 | 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] | 893 | vc_conn.done; |
| 894 | } |
| 895 | |
| 896 | /* Test IMSI DETACH (MI=IMEI), which is illegal */ |
| 897 | private 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] | 898 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 899 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 900 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 901 | |
| 902 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 903 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 904 | |
| 905 | /* Send Early Classmark, just for the fun of it? */ |
| 906 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 907 | |
| 908 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 909 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 910 | } |
| 911 | testcase TC_imsi_detach_by_imei() runs on MTC_CT { |
| 912 | var BSC_ConnHdlr vc_conn; |
| 913 | f_init(); |
| 914 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 915 | 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] | 916 | vc_conn.done; |
| 917 | } |
| 918 | |
| 919 | |
| 920 | /* helper function for an emergency call. caller passes in mobile identity to use */ |
| 921 | private function f_emerg_call(MobileIdentityLV mi) runs on BSC_ConnHdlr { |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 922 | var CallParameters cpars := valueof(t_CallParams('112'H, 0)); |
| 923 | cpars.emergency := true; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 924 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 925 | |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 926 | f_mo_call(cpars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 927 | } |
| 928 | |
| 929 | /* establish an emergency call by IMEI, no SIM inserted (and hence no IMSI) */ |
| 930 | private 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] | 931 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 932 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 933 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 934 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_EMERG_CALL, mi)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 935 | f_bssap_compl_l3(l3_info); |
| 936 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ('05'O))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 937 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 938 | } |
| 939 | testcase TC_emerg_call_imei_reject() runs on MTC_CT { |
| 940 | var BSC_ConnHdlr vc_conn; |
| 941 | f_init(); |
| 942 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 943 | 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] | 944 | vc_conn.done; |
| 945 | } |
| 946 | |
Harald Welte | d5b9140 | 2018-01-24 18:48:16 +0100 | [diff] [blame] | 947 | /* establish an emergency call by IMSI, SIM inserted (and hence IMSI) */ |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 948 | private 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] | 949 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 950 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 951 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 952 | /* Then issue emergency call identified by IMSI */ |
| 953 | f_emerg_call(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
| 954 | } |
| 955 | testcase TC_emerg_call_imsi() runs on MTC_CT { |
| 956 | var BSC_ConnHdlr vc_conn; |
| 957 | f_init(); |
| 958 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 959 | vc_conn := f_start_handler(refers(f_tc_emerg_call_imsi), 18); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 960 | vc_conn.done; |
| 961 | } |
| 962 | |
| 963 | /* CM Service Request for VGCS -> reject */ |
| 964 | 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] | 965 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 966 | |
| 967 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 968 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 969 | |
| 970 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 971 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VGCS, mi)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 972 | f_bssap_compl_l3(l3_info); |
| 973 | 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] | 974 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 975 | } |
| 976 | testcase TC_cm_serv_req_vgcs_reject() runs on MTC_CT { |
| 977 | var BSC_ConnHdlr vc_conn; |
| 978 | f_init(); |
| 979 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 980 | 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] | 981 | vc_conn.done; |
| 982 | } |
| 983 | |
| 984 | /* CM Service Request for VBS -> reject */ |
| 985 | 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] | 986 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 987 | |
| 988 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 989 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 990 | |
| 991 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 992 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VBS, mi)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 993 | f_bssap_compl_l3(l3_info); |
| 994 | 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] | 995 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 996 | } |
| 997 | testcase TC_cm_serv_req_vbs_reject() runs on MTC_CT { |
| 998 | var BSC_ConnHdlr vc_conn; |
| 999 | f_init(); |
| 1000 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1001 | 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] | 1002 | vc_conn.done; |
| 1003 | } |
| 1004 | |
| 1005 | /* CM Service Request for LCS -> reject */ |
| 1006 | 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] | 1007 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1008 | |
| 1009 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1010 | f_perform_lu(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1011 | |
| 1012 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 1013 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_LCS, mi)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1014 | f_bssap_compl_l3(l3_info); |
| 1015 | 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] | 1016 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1017 | } |
| 1018 | testcase TC_cm_serv_req_lcs_reject() runs on MTC_CT { |
| 1019 | var BSC_ConnHdlr vc_conn; |
| 1020 | f_init(); |
| 1021 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1022 | 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] | 1023 | vc_conn.done; |
| 1024 | } |
| 1025 | |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1026 | /* CM Re-Establishment Request */ |
| 1027 | 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] | 1028 | f_init_handler(pars); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1029 | |
| 1030 | /* First perform location update to ensure subscriber is known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1031 | f_perform_lu(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1032 | |
| 1033 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 1034 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REEST_REQ(0, mi)); |
| 1035 | f_bssap_compl_l3(l3_info); |
| 1036 | 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] | 1037 | f_expect_clear(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1038 | } |
| 1039 | testcase TC_cm_reest_req_reject() runs on MTC_CT { |
| 1040 | var BSC_ConnHdlr vc_conn; |
| 1041 | f_init(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1042 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1043 | 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] | 1044 | vc_conn.done; |
| 1045 | } |
| 1046 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1047 | /* Test LU (with authentication enabled), with wrong response from MS */ |
| 1048 | 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] | 1049 | f_init_handler(pars); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1050 | |
| 1051 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 1052 | |
| 1053 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 1054 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1055 | |
| 1056 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 1057 | f_bssap_compl_l3(l3_lu); |
| 1058 | |
| 1059 | /* Send Early Classmark, just for the fun of it */ |
| 1060 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1061 | |
| 1062 | var AuthVector vec := f_gen_auth_vec_2g(); |
| 1063 | var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(vec.rand, vec.sres, vec.kc)); |
| 1064 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 1065 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 1066 | |
| 1067 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(vec.rand))); |
| 1068 | /* Send back wrong auth response */ |
| 1069 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G('00000000'O))); |
| 1070 | |
| 1071 | /* Expect GSUP AUTH FAIL REP to HLR */ |
| 1072 | GSUP.receive(tr_GSUP_AUTH_FAIL_IND(g_pars.imsi)); |
| 1073 | |
| 1074 | /* Expect LU REJECT with Cause == Illegal MS */ |
| 1075 | 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] | 1076 | f_expect_clear(); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1077 | } |
| 1078 | testcase TC_lu_auth_2G_fail() runs on MTC_CT { |
| 1079 | var BSC_ConnHdlr vc_conn; |
| 1080 | f_init(); |
| 1081 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 1082 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1083 | 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] | 1084 | vc_conn.done; |
| 1085 | } |
| 1086 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1087 | /* 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] | 1088 | 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] | 1089 | pars.net.expect_auth := true; |
| 1090 | pars.net.expect_ciph := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1091 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1092 | f_perform_lu(); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1093 | } |
| 1094 | testcase TC_lu_imsi_auth_tmsi_encr_13_13() runs on MTC_CT { |
| 1095 | var BSC_ConnHdlr vc_conn; |
| 1096 | f_init(); |
| 1097 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 1098 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 1099 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1100 | 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] | 1101 | vc_conn.done; |
| 1102 | } |
| 1103 | |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1104 | /* Test Complete L3 without payload */ |
| 1105 | 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] | 1106 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1107 | |
| 1108 | /* Send Complete L3 Info with empty L3 frame */ |
| 1109 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1110 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, ''O)))); |
| 1111 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1112 | timer T := 5.0; |
| 1113 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1114 | alt { |
| 1115 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
| 1116 | /* Expect LU REJECT with Cause == Illegal MS */ |
Harald Welte | bdb3c45 | 2018-03-18 22:43:06 +0100 | [diff] [blame] | 1117 | [] BSSAP.receive(tr_PDU_DTAP_MT(?)) { repeat; } |
| 1118 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_CONF_IND) { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1119 | [] as_clear_cmd_compl_disc(); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1120 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1121 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1122 | self.stop; |
| 1123 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1124 | } |
| 1125 | setverdict(pass); |
| 1126 | } |
| 1127 | testcase TC_cl3_no_payload() runs on MTC_CT { |
| 1128 | var BSC_ConnHdlr vc_conn; |
| 1129 | f_init(); |
| 1130 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1131 | vc_conn := f_start_handler(refers(f_tc_cl3_no_payload), 25); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1132 | vc_conn.done; |
| 1133 | } |
| 1134 | |
| 1135 | /* Test Complete L3 with random payload */ |
| 1136 | 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] | 1137 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1138 | |
| 1139 | var integer len := float2int(rnd() * 256.0); |
| 1140 | var octetstring payl := f_rnd_octstring(len); |
| 1141 | |
| 1142 | /* Send Complete L3 Info with empty L3 frame */ |
| 1143 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1144 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, payl)))); |
| 1145 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1146 | timer T := 5.0; |
| 1147 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1148 | alt { |
| 1149 | /* Immediate disconnect */ |
| 1150 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1151 | [] BSSAP.receive(tr_PDU_DTAP_MT(?)) { repeat; } |
Harald Welte | bdb3c45 | 2018-03-18 22:43:06 +0100 | [diff] [blame] | 1152 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_CONF_IND) { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1153 | [] as_clear_cmd_compl_disc(); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1154 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1155 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1156 | self.stop; |
| 1157 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1158 | } |
| 1159 | setverdict(pass); |
| 1160 | } |
| 1161 | testcase TC_cl3_rnd_payload() runs on MTC_CT { |
| 1162 | var BSC_ConnHdlr vc_conn; |
| 1163 | f_init(); |
| 1164 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1165 | vc_conn := f_start_handler(refers(f_tc_cl3_rnd_payload), 26); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1166 | vc_conn.done; |
| 1167 | } |
| 1168 | |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1169 | /* Test Complete L3 with random payload */ |
| 1170 | private 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] | 1171 | f_init_handler(pars); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1172 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1173 | f_perform_lu(); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1174 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1175 | f_establish_fully(); |
Daniel Willmann | 898a7e0 | 2018-05-17 12:16:16 +0200 | [diff] [blame] | 1176 | f_expect_clear(10.0); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1177 | } |
| 1178 | testcase TC_establish_and_nothing() runs on MTC_CT { |
| 1179 | var BSC_ConnHdlr vc_conn; |
| 1180 | f_init(); |
| 1181 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1182 | vc_conn := f_start_handler(refers(f_tc_establish_and_nothing), 27); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1183 | vc_conn.done; |
| 1184 | } |
| 1185 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1186 | /* Test MO Call SETUP with no response from MNCC */ |
| 1187 | private function f_tc_mo_setup_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 1188 | f_init_handler(pars); |
| 1189 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1190 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1191 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1192 | f_perform_lu(); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1193 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1194 | f_establish_fully(); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1195 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1196 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1197 | |
| 1198 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1199 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1200 | f_expect_clear(30.0); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1201 | } |
| 1202 | testcase TC_mo_setup_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_mo_setup_and_nothing), 28); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1207 | vc_conn.done; |
| 1208 | } |
| 1209 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1210 | /* Test MO Call with no response to RAN-side CRCX */ |
| 1211 | private 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] | 1212 | f_init_handler(pars); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1213 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1214 | var MNCC_PDU mncc; |
| 1215 | var MgcpCommand mgcp_cmd; |
| 1216 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1217 | f_perform_lu(); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1218 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1219 | f_establish_fully(); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +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 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1225 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1226 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1227 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1228 | |
| 1229 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 1230 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1231 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1232 | /* never respond to this */ |
| 1233 | |
Philipp Maier | 8e58f59 | 2018-03-14 11:10:56 +0100 | [diff] [blame] | 1234 | /* When the connection with the MGW fails, the MSC will first request |
| 1235 | * a release via call control. We will answer this request normally. */ |
| 1236 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1237 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1238 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1239 | f_expect_clear(30.0); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1240 | } |
| 1241 | testcase TC_mo_crcx_ran_timeout() runs on MTC_CT { |
| 1242 | var BSC_ConnHdlr vc_conn; |
| 1243 | f_init(); |
| 1244 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1245 | 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] | 1246 | vc_conn.done; |
| 1247 | } |
| 1248 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1249 | /* Test MO Call with reject to RAN-side CRCX */ |
| 1250 | private 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] | 1251 | f_init_handler(pars); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1252 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1253 | var MNCC_PDU mncc; |
| 1254 | var MgcpCommand mgcp_cmd; |
| 1255 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1256 | f_perform_lu(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1257 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1258 | f_establish_fully(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1259 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1260 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1261 | |
| 1262 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1263 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1264 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1265 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1266 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1267 | |
| 1268 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1269 | |
| 1270 | /* Detect if the received CRCX is a wildcarded CRCX request. If yes, |
| 1271 | * set an endpoint name that fits the pattern. If not, just use the |
| 1272 | * endpoint name from the request */ |
| 1273 | if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) { |
| 1274 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1275 | } else { |
| 1276 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1277 | } |
| 1278 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1279 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1280 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1281 | /* Respond to CRCX with error */ |
| 1282 | var MgcpResponse mgcp_rsp := { |
| 1283 | line := { |
| 1284 | code := "542", |
| 1285 | trans_id := mgcp_cmd.line.trans_id, |
| 1286 | string := "FORCED_FAIL" |
| 1287 | }, |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1288 | sdp := omit |
| 1289 | } |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1290 | var MgcpParameter mgcp_rsp_param := { |
| 1291 | code := "Z", |
| 1292 | val := cpars.mgcp_ep |
| 1293 | }; |
| 1294 | mgcp_rsp.params[0] := mgcp_rsp_param; |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1295 | MGCP.send(mgcp_rsp); |
| 1296 | |
| 1297 | timer T := 30.0; |
| 1298 | T.start; |
| 1299 | alt { |
| 1300 | [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); self.stop; } |
Daniel Willmann | 5868e62 | 2018-02-15 17:42:59 +0100 | [diff] [blame] | 1301 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))) { |
| 1302 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1303 | repeat; |
| 1304 | } |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1305 | [] MNCC.receive { repeat; } |
| 1306 | [] GSUP.receive { repeat; } |
Philipp Maier | c6e06f7 | 2018-04-11 18:12:23 +0200 | [diff] [blame] | 1307 | /* Note: As we did not respond properly to the CRCX from the MSC we |
| 1308 | * expect the MSC to omit any further MGCP operation (At least in the |
| 1309 | * the current implementation, there is no recovery mechanism implemented |
| 1310 | * and a DLCX can not be performed as the MSC does not know a specific |
| 1311 | * endpoint yet. */ |
| 1312 | [] MGCP.receive { setverdict(fail, "Unexpected MGCP message"); self.stop; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1313 | [] as_clear_cmd_compl_disc(); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1314 | } |
| 1315 | } |
| 1316 | testcase TC_mo_crcx_ran_reject() runs on MTC_CT { |
| 1317 | var BSC_ConnHdlr vc_conn; |
| 1318 | f_init(); |
| 1319 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1320 | 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] | 1321 | vc_conn.done; |
| 1322 | } |
| 1323 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1324 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1325 | /* helper function to start a MT call: MNCC SETUP; Paging; DChan est.; DTAP SETUP */ |
| 1326 | private function f_mt_call_start(inout CallParameters cpars) runs on BSC_ConnHdlr { |
| 1327 | var MNCC_PDU mncc; |
| 1328 | var MgcpCommand mgcp_cmd; |
| 1329 | var OCT4 tmsi; |
| 1330 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1331 | f_perform_lu(); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1332 | if (isvalue(g_pars.tmsi)) { |
| 1333 | tmsi := g_pars.tmsi; |
| 1334 | } else { |
| 1335 | tmsi := 'FFFFFFFF'O; |
| 1336 | } |
| 1337 | f_bssmap_register_imsi(g_pars.imsi, tmsi); |
| 1338 | |
| 1339 | /* Allocate call reference and send SETUP via MNCC to MSC */ |
| 1340 | cpars.mncc_callref := f_rnd_int(2147483648); |
| 1341 | MNCC.send(ts_MNCC_SETUP_req(cpars.mncc_callref, hex2str(g_pars.msisdn), |
| 1342 | hex2str(cpars.called_party), hex2str(g_pars.imsi))); |
| 1343 | |
| 1344 | /* MSC->BSC: expect PAGING from MSC */ |
| 1345 | BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); |
| 1346 | /* MS -> MSC: PAGING RESPONSE */ |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1347 | f_establish_fully(EST_TYPE_PAG_RESP); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1348 | |
| 1349 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1350 | |
| 1351 | /* MSC->MS: SETUP */ |
| 1352 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, *, cpars.called_party))); |
| 1353 | } |
| 1354 | |
| 1355 | /* Test MT Call */ |
| 1356 | private 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] | 1357 | f_init_handler(pars); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1358 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1359 | var MNCC_PDU mncc; |
| 1360 | var MgcpCommand mgcp_cmd; |
| 1361 | |
| 1362 | f_mt_call_start(cpars); |
| 1363 | |
| 1364 | /* MS->MSC: CALL CONFIRMED */ |
| 1365 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1366 | |
| 1367 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1368 | |
| 1369 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1370 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1371 | |
| 1372 | /* Detect if the received CRCX is a wildcarded CRCX request. If yes, |
| 1373 | * set an endpoint name that fits the pattern. If not, just use the |
| 1374 | * endpoint name from the request */ |
| 1375 | if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) { |
| 1376 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1377 | } else { |
| 1378 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1379 | } |
| 1380 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1381 | /* Respond to CRCX with error */ |
| 1382 | var MgcpResponse mgcp_rsp := { |
| 1383 | line := { |
| 1384 | code := "542", |
| 1385 | trans_id := mgcp_cmd.line.trans_id, |
| 1386 | string := "FORCED_FAIL" |
| 1387 | }, |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1388 | sdp := omit |
| 1389 | } |
Philipp Maier | f1e02bb | 2018-03-15 16:30:00 +0100 | [diff] [blame] | 1390 | var MgcpParameter mgcp_rsp_param := { |
| 1391 | code := "Z", |
| 1392 | val := cpars.mgcp_ep |
| 1393 | }; |
| 1394 | mgcp_rsp.params[0] := mgcp_rsp_param; |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1395 | MGCP.send(mgcp_rsp); |
| 1396 | |
| 1397 | timer T := 30.0; |
| 1398 | T.start; |
| 1399 | alt { |
| 1400 | [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); self.stop; } |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1401 | [] BSSAP.receive { repeat; } |
| 1402 | [] MNCC.receive { repeat; } |
| 1403 | [] GSUP.receive { repeat; } |
| 1404 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1405 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1406 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1407 | repeat; |
| 1408 | } |
| 1409 | [] MGCP.receive { repeat; } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1410 | [] as_clear_cmd_compl_disc(); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1411 | } |
| 1412 | } |
| 1413 | testcase TC_mt_crcx_ran_reject() runs on MTC_CT { |
| 1414 | var BSC_ConnHdlr vc_conn; |
| 1415 | f_init(); |
| 1416 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1417 | 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] | 1418 | vc_conn.done; |
| 1419 | } |
| 1420 | |
| 1421 | |
| 1422 | /* Test MT Call T310 timer */ |
| 1423 | private 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] | 1424 | f_init_handler(pars, 200.0); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1425 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1426 | var MNCC_PDU mncc; |
| 1427 | var MgcpCommand mgcp_cmd; |
| 1428 | |
| 1429 | f_mt_call_start(cpars); |
| 1430 | |
| 1431 | /* MS->MSC: CALL CONFIRMED */ |
| 1432 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1433 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1434 | |
| 1435 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1436 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1437 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1438 | /* FIXME: Respond to CRCX */ |
| 1439 | |
| 1440 | /* old libosmocore T310 default timeout is 180s. so let's wait 190 */ |
| 1441 | timer T := 190.0; |
| 1442 | T.start; |
| 1443 | alt { |
| 1444 | [] T.timeout { setverdict(fail, "Timeout waiting for T310"); self.stop; } |
| 1445 | [] MNCC.receive(tr_MNCC_DISC_ind(cpars.mncc_callref)) { |
| 1446 | MNCC.send(ts_MNCC_REL_req(cpars.mncc_callref, valueof(ts_MNCC_cause(23)))); |
| 1447 | } |
| 1448 | } |
| 1449 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_DISC(cpars.transaction_id))); |
| 1450 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1451 | /* FIXME: We're sending this with TIflag 0: allocated by sender, which is wrong */ |
| 1452 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1453 | |
| 1454 | alt { |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1455 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1456 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1457 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1458 | repeat; |
| 1459 | } |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1460 | [] as_clear_cmd_compl_disc(); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1461 | } |
| 1462 | } |
| 1463 | testcase TC_mt_t310() runs on MTC_CT { |
| 1464 | var BSC_ConnHdlr vc_conn; |
| 1465 | f_init(); |
| 1466 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1467 | vc_conn := f_start_handler(refers(f_tc_mt_t310), 32); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1468 | vc_conn.done; |
| 1469 | } |
| 1470 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1471 | /* Perform successful LU + MO call, then GSUP LocationCancel. Subscriber must be denied CM SERV */ |
| 1472 | private function f_tc_gsup_cancel(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1473 | f_init_handler(pars); |
| 1474 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1475 | cpars.bss_rtp_port := 1110; |
| 1476 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1477 | cpars.mgcp_connection_id_mss := '33333'H; |
| 1478 | |
| 1479 | /* Location Update to make subscriber known */ |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1480 | f_perform_lu(); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1481 | |
| 1482 | /* First MO call should succeed */ |
| 1483 | f_mo_call(cpars); |
| 1484 | |
| 1485 | /* Cancel the subscriber in the VLR */ |
| 1486 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_WITHDRAW)); |
| 1487 | alt { |
| 1488 | [] GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)) { } |
| 1489 | [] GSUP.receive(tr_GSUP_CL_ERR(g_pars.imsi)) { |
| 1490 | setverdict(fail, "Received GSUP Location Cancel Error"); |
| 1491 | self.stop; |
| 1492 | } |
| 1493 | } |
| 1494 | |
| 1495 | /* Follow-up transactions should fail */ |
| 1496 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 1497 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 1498 | f_bssap_compl_l3(l3_info); |
| 1499 | alt { |
| 1500 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 1501 | [] BSSAP.receive { |
| 1502 | setverdict(fail, "Received unexpected BSSAP instead of CM SERV REJ"); |
| 1503 | self.stop; |
| 1504 | } |
| 1505 | } |
| 1506 | setverdict(pass); |
| 1507 | } |
| 1508 | testcase TC_gsup_cancel() runs on MTC_CT { |
| 1509 | var BSC_ConnHdlr vc_conn; |
| 1510 | f_init(); |
| 1511 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1512 | vc_conn := f_start_handler(refers(f_tc_gsup_cancel), 33); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1513 | vc_conn.done; |
| 1514 | } |
| 1515 | |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1516 | /* A5/1 only permitted on network side, and MS capable to do it */ |
| 1517 | private function f_tc_lu_imsi_auth_tmsi_encr_1_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1518 | pars.net.expect_auth := true; |
| 1519 | pars.net.expect_ciph := true; |
| 1520 | pars.net.kc_support := '02'O; /* A5/1 only */ |
| 1521 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1522 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1523 | } |
| 1524 | testcase TC_lu_imsi_auth_tmsi_encr_1_13() runs on MTC_CT { |
| 1525 | var BSC_ConnHdlr vc_conn; |
| 1526 | f_init(); |
| 1527 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1528 | f_vty_config(MSCVTY, "network", "encryption a5 1"); |
| 1529 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1530 | 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] | 1531 | vc_conn.done; |
| 1532 | } |
| 1533 | |
| 1534 | /* A5/3 only permitted on network side, and MS capable to do it */ |
| 1535 | private function f_tc_lu_imsi_auth_tmsi_encr_3_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1536 | pars.net.expect_auth := true; |
| 1537 | pars.net.expect_ciph := true; |
| 1538 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1539 | f_init_handler(pars); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1540 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1541 | } |
| 1542 | testcase TC_lu_imsi_auth_tmsi_encr_3_13() runs on MTC_CT { |
| 1543 | var BSC_ConnHdlr vc_conn; |
| 1544 | f_init(); |
| 1545 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1546 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1547 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1548 | 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] | 1549 | vc_conn.done; |
| 1550 | } |
| 1551 | |
| 1552 | /* A5/3 only permitted on network side, and MS with only A5/1 support */ |
| 1553 | private function f_tc_lu_imsi_auth_tmsi_encr_3_1(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1554 | pars.net.expect_auth := true; |
| 1555 | pars.net.expect_ciph := true; |
| 1556 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1557 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1558 | f_init_handler(pars, 15.0); |
| 1559 | |
| 1560 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1561 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1562 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1563 | f_bssap_compl_l3(l3_lu); |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 1564 | if (pars.send_early_cm) { |
| 1565 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1566 | } else { |
| 1567 | pars.cm1.esind := '0'B; |
| 1568 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1569 | f_mm_auth(); |
| 1570 | alt { |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1571 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 1572 | f_expect_clear(); |
| 1573 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1574 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1575 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
| 1576 | self.stop; |
| 1577 | } |
| 1578 | [] BSSAP.receive { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 1579 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1580 | self.stop; |
| 1581 | } |
| 1582 | } |
| 1583 | setverdict(pass); |
| 1584 | } |
| 1585 | testcase TC_lu_imsi_auth_tmsi_encr_3_1() runs on MTC_CT { |
| 1586 | var BSC_ConnHdlr vc_conn; |
| 1587 | f_init(); |
| 1588 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1589 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1590 | |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 1591 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), 360); |
| 1592 | vc_conn.done; |
| 1593 | } |
| 1594 | testcase TC_lu_imsi_auth_tmsi_encr_3_1_no_cm() runs on MTC_CT { |
| 1595 | var BSC_ConnHdlrPars pars; |
| 1596 | var BSC_ConnHdlr vc_conn; |
| 1597 | f_init(); |
| 1598 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1599 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1600 | |
| 1601 | pars := f_init_pars(361); |
| 1602 | pars.send_early_cm := false; |
| 1603 | 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] | 1604 | vc_conn.done; |
| 1605 | } |
Neels Hofmeyr | 1b3c6e3 | 2018-03-01 17:52:21 +0100 | [diff] [blame] | 1606 | testcase TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() runs on MTC_CT { |
| 1607 | var BSC_ConnHdlr vc_conn; |
| 1608 | f_init(); |
| 1609 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1610 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1611 | |
| 1612 | /* Make sure the MSC category is on DEBUG level to trigger the log |
| 1613 | * message that is reported in OS#2947 to trigger the segfault */ |
| 1614 | f_vty_config(MSCVTY, "log stderr", "logging level msc debug"); |
| 1615 | |
| 1616 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), 362); |
| 1617 | vc_conn.done; |
| 1618 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1619 | |
| 1620 | /* A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1621 | private function f_tc_lu_imsi_auth_tmsi_encr_13_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1622 | pars.net.expect_auth := true; |
| 1623 | pars.net.expect_ciph := true; |
| 1624 | pars.net.kc_support := '0A'O; /* A5/1 + A5/3 */ |
| 1625 | pars.cm1.a5_1 := '1'B; |
| 1626 | pars.cm2.a5_1 := '1'B; |
| 1627 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1628 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1629 | f_init_handler(pars, 15.0); |
| 1630 | |
| 1631 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1632 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1633 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1634 | f_bssap_compl_l3(l3_lu); |
| 1635 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1636 | f_mm_auth(); |
| 1637 | alt { |
Harald Welte | 5946b33 | 2018-03-18 23:32:21 +0100 | [diff] [blame] | 1638 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 1639 | f_expect_clear(); |
| 1640 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1641 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1642 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
| 1643 | self.stop; |
| 1644 | } |
| 1645 | [] BSSAP.receive { |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 1646 | setverdict(fail, "Unknown/unexpected BSSAP received"); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1647 | self.stop; |
| 1648 | } |
| 1649 | } |
| 1650 | setverdict(pass); |
| 1651 | } |
| 1652 | testcase TC_lu_imsi_auth_tmsi_encr_13_2() runs on MTC_CT { |
| 1653 | var BSC_ConnHdlr vc_conn; |
| 1654 | f_init(); |
| 1655 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1656 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 1657 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1658 | 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] | 1659 | vc_conn.done; |
| 1660 | } |
| 1661 | |
| 1662 | /* A5/0 + A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1663 | private function f_tc_lu_imsi_auth_tmsi_encr_013_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1664 | pars.net.expect_auth := true; |
| 1665 | pars.net.expect_ciph := true; |
| 1666 | pars.net.kc_support := '0B'O; /* A5/1 + A5/3 */ |
| 1667 | pars.cm1.a5_1 := '1'B; |
| 1668 | pars.cm2.a5_1 := '1'B; |
| 1669 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1670 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1671 | f_init_handler(pars, 15.0); |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1672 | f_perform_lu(); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1673 | } |
| 1674 | testcase TC_lu_imsi_auth_tmsi_encr_013_2() runs on MTC_CT { |
| 1675 | var BSC_ConnHdlr vc_conn; |
| 1676 | f_init(); |
| 1677 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1678 | f_vty_config(MSCVTY, "network", "encryption a5 0 1 3"); |
| 1679 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1680 | 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] | 1681 | vc_conn.done; |
| 1682 | } |
| 1683 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1684 | /* LU followed by MT call (including paging) */ |
| 1685 | private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1686 | f_init_handler(pars); |
| 1687 | //FIXME: odd digits var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1688 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1689 | cpars.bss_rtp_port := 1110; |
| 1690 | cpars.mgcp_connection_id_bss := '10004'H; |
| 1691 | cpars.mgcp_connection_id_mss := '10005'H; |
| 1692 | |
Philipp Maier | 4b2692d | 2018-03-14 16:37:48 +0100 | [diff] [blame] | 1693 | /* Note: This is an optional parameter. When the call-agent (MSC) does |
| 1694 | * supply a full endpoint name this setting will be overwritten. */ |
| 1695 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1696 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1697 | f_perform_lu(); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1698 | f_mt_call(cpars); |
| 1699 | } |
| 1700 | testcase TC_lu_and_mt_call() runs on MTC_CT { |
| 1701 | var BSC_ConnHdlr vc_conn; |
| 1702 | f_init(); |
| 1703 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1704 | 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] | 1705 | vc_conn.done; |
| 1706 | } |
| 1707 | |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1708 | /* Test MO Call SETUP with DTMF */ |
| 1709 | private function f_tc_mo_setup_dtmf_dup(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1710 | f_init_handler(pars); |
| 1711 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1712 | cpars.bss_rtp_port := 1110; |
| 1713 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1714 | cpars.mgcp_connection_id_mss := '33333'H; |
| 1715 | |
Neels Hofmeyr | c1f105a | 2018-03-01 20:00:19 +0100 | [diff] [blame] | 1716 | f_perform_lu(); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1717 | f_mo_seq_dtmf_dup(cpars); |
| 1718 | } |
| 1719 | testcase TC_mo_setup_and_dtmf_dup() runs on MTC_CT { |
| 1720 | var BSC_ConnHdlr vc_conn; |
| 1721 | f_init(); |
| 1722 | |
Neels Hofmeyr | e9b8eeb | 2018-03-01 20:29:58 +0100 | [diff] [blame] | 1723 | 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] | 1724 | vc_conn.done; |
| 1725 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1726 | |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 1727 | testcase TC_cr_before_reset() runs on MTC_CT { |
| 1728 | timer T := 4.0; |
| 1729 | var boolean reset_ack_seen := false; |
| 1730 | f_init_bssap_direct(); |
| 1731 | |
| 1732 | /* Make a blind connection attemt, to trigger the deadlock condition */ |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1733 | 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] | 1734 | |
| 1735 | /* Send a BSSMAP reset */ |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1736 | 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] | 1737 | T.start |
| 1738 | alt { |
| 1739 | [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_ResetAck)) { |
| 1740 | reset_ack_seen := true; |
| 1741 | repeat; |
| 1742 | } |
| 1743 | |
| 1744 | /* Acknowledge MSC sided reset requests */ |
| 1745 | [] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1746 | 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] | 1747 | repeat; |
| 1748 | } |
| 1749 | |
| 1750 | /* Ignore all other messages (e.g CR from the connection request) */ |
| 1751 | [] BSSAP_DIRECT.receive { repeat } |
| 1752 | |
| 1753 | /* If we got no BSSMAP RESET ACK back, then the MSC entered the |
| 1754 | * deadlock situation. The MSC is then unable to respond to any |
| 1755 | * further BSSMAP RESET or any other sort of traffic. */ |
| 1756 | [reset_ack_seen == true] T.timeout { setverdict(pass) } |
| 1757 | [reset_ack_seen == false] T.timeout { |
| 1758 | setverdict(fail, "no BSSMAP RESET ACK seen!"); |
| 1759 | } |
| 1760 | } |
| 1761 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1762 | |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1763 | /* Test MO Call with no response to RAN-side CRCX or DTAP Release */ |
| 1764 | private function f_tc_mo_release_timeout(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1765 | f_init_handler(pars); |
| 1766 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1767 | var MNCC_PDU mncc; |
| 1768 | var MgcpCommand mgcp_cmd; |
| 1769 | |
| 1770 | f_perform_lu(); |
| 1771 | |
Harald Welte | b9e86fa | 2018-04-09 18:18:31 +0200 | [diff] [blame] | 1772 | f_establish_fully(); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 1773 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1774 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1775 | |
| 1776 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1777 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1778 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1779 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1780 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1781 | |
| 1782 | /* Drop CRCX */ |
| 1783 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1784 | |
| 1785 | /* Drop DTAP Release */ |
| 1786 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1787 | |
| 1788 | /* Drop resent DTAP Release */ |
| 1789 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1790 | |
| 1791 | f_expect_clear(60.0); |
| 1792 | } |
| 1793 | testcase TC_mo_release_timeout() runs on MTC_CT { |
| 1794 | var BSC_ConnHdlr vc_conn; |
| 1795 | f_init(); |
| 1796 | |
| 1797 | vc_conn := f_start_handler(refers(f_tc_mo_release_timeout), 40); |
| 1798 | vc_conn.done; |
| 1799 | } |
| 1800 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1801 | |
Philipp Maier | 2a98a73 | 2018-03-19 16:06:12 +0100 | [diff] [blame] | 1802 | /* LU followed by MT call (including paging) */ |
| 1803 | private function f_tc_lu_and_mt_call_no_dlcx_resp(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1804 | f_init_handler(pars); |
| 1805 | //FIXME: odd digits var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1806 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1807 | cpars.bss_rtp_port := 1110; |
| 1808 | cpars.mgcp_connection_id_bss := '10004'H; |
| 1809 | cpars.mgcp_connection_id_mss := '10005'H; |
| 1810 | |
| 1811 | /* Note: This is an optional parameter. When the call-agent (MSC) does |
| 1812 | * supply a full endpoint name this setting will be overwritten. */ |
| 1813 | cpars.mgcp_ep := "rtpbridge/1@mgw"; |
| 1814 | |
| 1815 | /* Intentionally disable the CRCX response */ |
| 1816 | cpars.mgw_drop_dlcx := true; |
| 1817 | |
| 1818 | /* Perform location update and call */ |
| 1819 | f_perform_lu(); |
| 1820 | f_mt_call(cpars); |
| 1821 | } |
| 1822 | testcase TC_lu_and_mt_call_no_dlcx_resp() runs on MTC_CT { |
| 1823 | var BSC_ConnHdlr vc_conn; |
| 1824 | f_init(); |
| 1825 | |
| 1826 | /* Perform an almost normal looking locationupdate + mt-call, but do |
| 1827 | * not respond to the DLCX at the end of the call */ |
| 1828 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call_no_dlcx_resp), 41); |
| 1829 | vc_conn.done; |
| 1830 | |
| 1831 | /* Wait a guard period until the MGCP layer in the MSC times out, |
| 1832 | * if the MSC is vulnerable to the use-after-free situation that is |
| 1833 | * fixed by I78f1b6a9149488a4ad3f120c1e190a83c07d4b89 then it should |
| 1834 | * segfault now */ |
| 1835 | f_sleep(6.0); |
| 1836 | |
| 1837 | /* Run the init procedures once more. If the MSC has crashed, this |
| 1838 | * this will fail */ |
| 1839 | f_init(); |
| 1840 | } |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1841 | |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 1842 | /* Two BSSMAP resets from two different BSCs */ |
| 1843 | testcase TC_reset_two() runs on MTC_CT { |
| 1844 | var BSC_ConnHdlr vc_conn; |
| 1845 | f_init(2); |
| 1846 | f_sleep(2.0); |
| 1847 | setverdict(pass); |
| 1848 | } |
| 1849 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 1850 | /*********************************************************************** |
| 1851 | * SMS Testing |
| 1852 | ***********************************************************************/ |
| 1853 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1854 | /* LU followed by MO SMS */ |
| 1855 | private function f_tc_lu_and_mo_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1856 | var SmsParameters spars := valueof(t_SmsPars); |
| 1857 | |
| 1858 | f_init_handler(pars); |
| 1859 | |
| 1860 | /* Perform location update and call */ |
| 1861 | f_perform_lu(); |
| 1862 | |
| 1863 | f_establish_fully(EST_TYPE_MO_SMS); |
| 1864 | |
| 1865 | //spars.exp_rp_err := 96; /* invalid mandatory information */ |
| 1866 | f_mo_sms(spars); |
| 1867 | |
| 1868 | f_expect_clear(); |
| 1869 | } |
| 1870 | testcase TC_lu_and_mo_sms() runs on MTC_CT { |
| 1871 | var BSC_ConnHdlr vc_conn; |
| 1872 | f_init(); |
| 1873 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_sms), 42); |
| 1874 | vc_conn.done; |
| 1875 | } |
| 1876 | |
| 1877 | private function f_vty_sms_send(charstring imsi, charstring msisdn, charstring text) |
| 1878 | runs on MTC_CT { |
| 1879 | f_vty_transceive(MSCVTY, "subscriber imsi "&imsi&" sms sender msisdn "&msisdn&" send "&text); |
| 1880 | } |
| 1881 | |
| 1882 | /* LU followed by MT SMS */ |
| 1883 | private function f_tc_lu_and_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1884 | var SmsParameters spars := valueof(t_SmsPars); |
| 1885 | var OCT4 tmsi; |
| 1886 | |
| 1887 | f_init_handler(pars); |
| 1888 | |
| 1889 | /* Perform location update and call */ |
| 1890 | f_perform_lu(); |
| 1891 | |
| 1892 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 1893 | if (isvalue(g_pars.tmsi)) { |
| 1894 | tmsi := g_pars.tmsi; |
| 1895 | } else { |
| 1896 | tmsi := 'FFFFFFFF'O; |
| 1897 | } |
| 1898 | f_bssmap_register_imsi(g_pars.imsi, tmsi); |
| 1899 | |
| 1900 | /* FIXME: actually cause MSC to send a SMS via VTY or SMPP */ |
| 1901 | |
| 1902 | /* MSC->BSC: expect PAGING from MSC */ |
| 1903 | BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); |
| 1904 | /* Establish DTAP / BSSAP / SCCP connection */ |
| 1905 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 1906 | |
| 1907 | spars.tp.ud := 'C8329BFD064D9B53'O; |
| 1908 | f_mt_sms(spars); |
| 1909 | |
| 1910 | f_expect_clear(); |
| 1911 | } |
| 1912 | testcase TC_lu_and_mt_sms() runs on MTC_CT { |
| 1913 | var BSC_ConnHdlrPars pars; |
| 1914 | var BSC_ConnHdlr vc_conn; |
| 1915 | f_init(); |
| 1916 | pars := f_init_pars(43); |
| 1917 | vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars); |
| 1918 | f_sleep(2.0); |
| 1919 | f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS"); |
| 1920 | vc_conn.done; |
| 1921 | } |
| 1922 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 1923 | /* mobile originated SMS from MS/BTS/BSC side to SMPP */ |
| 1924 | private function f_tc_smpp_mo_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1925 | var SmsParameters spars := valueof(t_SmsPars); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1926 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 1927 | f_init_handler(pars); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 1928 | |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 1929 | /* Perform location update so IMSI is known + registered in MSC/VLR */ |
| 1930 | f_perform_lu(); |
| 1931 | f_establish_fully(EST_TYPE_MO_SMS); |
| 1932 | |
| 1933 | f_mo_sms(spars); |
| 1934 | |
| 1935 | var SMPP_PDU smpp; |
| 1936 | var template SMPP_PDU tr_smpp := tr_SMPP(c_SMPP_command_id_deliver_sm, ESME_ROK); |
| 1937 | tr_smpp.body.deliver_sm := { |
| 1938 | service_type := "CMT", |
| 1939 | source_addr_ton := network_specific, |
| 1940 | source_addr_npi := isdn, |
| 1941 | source_addr := hex2str(pars.msisdn), |
| 1942 | dest_addr_ton := f_sm_ton_from_gsm(spars.tp.da.tP_DA_NoPad.tP_TypeOfNumber), |
| 1943 | dest_addr_npi := f_sm_npi_from_gsm(spars.tp.da.tP_DA_NoPad.tP_NumberingPlanID), |
| 1944 | destination_addr := hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue), |
| 1945 | esm_class := '00000001'B, |
| 1946 | protocol_id := 0, |
| 1947 | priority_flag := 0, |
| 1948 | schedule_delivery_time := "", |
| 1949 | replace_if_present := 0, |
| 1950 | data_coding := '00000001'B, |
| 1951 | sm_default_msg_id := 0, |
| 1952 | sm_length := ?, |
| 1953 | short_message := spars.tp.ud, |
| 1954 | opt_pars := { |
| 1955 | { |
| 1956 | tag := user_message_reference, |
| 1957 | len := 2, |
| 1958 | opt_value := { |
| 1959 | int2_val := oct2int(spars.tp.msg_ref) |
| 1960 | } |
| 1961 | } |
| 1962 | } |
| 1963 | }; |
| 1964 | alt { |
| 1965 | [] SMPP.receive(tr_smpp) -> value smpp { |
| 1966 | SMPP.send(ts_SMPP_DELIVER_SM_resp(ESME_ROK, smpp.header.seq_num)); |
| 1967 | } |
| 1968 | [] SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)) { repeat; } |
| 1969 | } |
| 1970 | |
| 1971 | f_expect_clear(); |
| 1972 | } |
| 1973 | testcase TC_smpp_mo_sms() runs on MTC_CT { |
| 1974 | var BSC_ConnHdlr vc_conn; |
| 1975 | f_init(); |
| 1976 | f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "default-route"); |
| 1977 | vc_conn := f_start_handler(refers(f_tc_smpp_mo_sms), 44); |
| 1978 | vc_conn.done; |
| 1979 | f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "no default-route"); |
| 1980 | } |
| 1981 | |
| 1982 | /* convert GSM L3 TON to SMPP_TON enum */ |
| 1983 | function f_sm_ton_from_gsm(BIT3 ton) return SMPP_TON { |
| 1984 | select (ton) { |
| 1985 | case ('000'B) { return unknown; } |
| 1986 | case ('001'B) { return international; } |
| 1987 | case ('010'B) { return national; } |
| 1988 | case ('011'B) { return network_specific; } |
| 1989 | case ('100'B) { return subscriber_number; } |
| 1990 | case ('101'B) { return alphanumeric; } |
| 1991 | case ('110'B) { return abbreviated; } |
| 1992 | } |
| 1993 | setverdict(fail, "Unknown TON ", ton); |
| 1994 | self.stop; |
| 1995 | } |
| 1996 | /* convert GSM L3 NPI to SMPP_NPI enum */ |
| 1997 | function f_sm_npi_from_gsm(BIT4 npi) return SMPP_NPI { |
| 1998 | select (npi) { |
| 1999 | case ('0000'B) { return unknown; } |
| 2000 | case ('0001'B) { return isdn; } |
| 2001 | case ('0011'B) { return data; } |
| 2002 | case ('0100'B) { return telex; } |
| 2003 | case ('0110'B) { return land_mobile; } |
| 2004 | case ('1000'B) { return national; } |
| 2005 | case ('1001'B) { return private_; } |
| 2006 | case ('1010'B) { return ermes; } |
| 2007 | } |
| 2008 | setverdict(fail, "Unknown NPI ", npi); |
| 2009 | self.stop; |
| 2010 | } |
| 2011 | |
| 2012 | /* build a SMPP_SM from SmsParameters */ |
| 2013 | function f_mt_sm_from_spars(SmsParameters spars) |
| 2014 | runs on BSC_ConnHdlr return SMPP_SM { |
| 2015 | var SMPP_SM sm := { |
| 2016 | service_type := "CMT", |
| 2017 | source_addr_ton := f_sm_ton_from_gsm(spars.tp.da.tP_DA_NoPad.tP_TypeOfNumber), |
| 2018 | source_addr_npi := f_sm_npi_from_gsm(spars.tp.da.tP_DA_NoPad.tP_NumberingPlanID), |
| 2019 | source_addr := hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue), |
| 2020 | dest_addr_ton := international, |
| 2021 | dest_addr_npi := isdn, |
| 2022 | destination_addr := hex2str(g_pars.msisdn), |
| 2023 | esm_class := '00000001'B, |
| 2024 | protocol_id := 0, |
| 2025 | priority_flag := 0, |
| 2026 | schedule_delivery_time := "", |
| 2027 | validity_period := "", |
| 2028 | registered_delivery := '00000000'B, |
| 2029 | replace_if_present := 0, |
| 2030 | data_coding := '00000001'B, |
| 2031 | sm_default_msg_id := 0, |
| 2032 | sm_length := spars.tp.udl, |
| 2033 | short_message := spars.tp.ud, |
| 2034 | opt_pars := {} |
| 2035 | }; |
| 2036 | return sm; |
| 2037 | } |
| 2038 | |
| 2039 | /* helper function to encode SMS from 'spars', send it via SMPP to MSC; receive it on MS side */ |
| 2040 | private function f_smpp_mt_sms(SmsParameters spars, boolean trans_mode) runs on BSC_ConnHdlr { |
| 2041 | var SMPP_SM sm := f_mt_sm_from_spars(spars); |
| 2042 | if (trans_mode) { |
| 2043 | sm.esm_class := '00000010'B; |
| 2044 | } |
| 2045 | |
| 2046 | /* actually cause MSC to send a SMS via SUBMIT-SM from SMPP side */ |
| 2047 | SMPP.send(ts_SMPP_SUBMIT_SM(sm)); |
| 2048 | if (not match(sm.esm_class, tr_ESM_CLASS_TRANSACTION)) { |
| 2049 | /* if we're not in SMPP transaction mode, we expect the SMPP-level ACK |
| 2050 | * before we expect the SMS delivery on the BSC/radio side */ |
| 2051 | SMPP.receive(tr_SMPP(c_SMPP_command_id_submit_sm_resp, ESME_ROK)); |
| 2052 | } |
| 2053 | |
| 2054 | /* MSC->BSC: expect PAGING from MSC */ |
| 2055 | BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); |
| 2056 | /* Establish DTAP / BSSAP / SCCP connection */ |
| 2057 | f_establish_fully(EST_TYPE_PAG_RESP); |
| 2058 | SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)); |
| 2059 | |
| 2060 | f_mt_sms(spars); |
| 2061 | |
| 2062 | if (match(sm.esm_class, tr_ESM_CLASS_TRANSACTION)) { |
| 2063 | SMPP.receive(tr_SMPP(c_SMPP_command_id_submit_sm_resp, ESME_ROK)); |
| 2064 | } |
| 2065 | f_expect_clear(); |
| 2066 | } |
| 2067 | |
| 2068 | /* mobile terminated SMS, from SMPP to BSC/BTS/MS */ |
| 2069 | private function f_tc_smpp_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 2070 | f_init_handler(pars); |
| 2071 | |
| 2072 | /* Perform location update so IMSI is known + registered in MSC/VLR */ |
| 2073 | f_perform_lu(); |
| 2074 | SMPP.receive(tr_SMPP(c_SMPP_command_id_alert_notification, ESME_ROK)); |
| 2075 | |
| 2076 | /* register an 'expect' for given IMSI (+TMSI) */ |
| 2077 | var OCT4 tmsi; |
| 2078 | if (isvalue(g_pars.tmsi)) { |
| 2079 | tmsi := g_pars.tmsi; |
| 2080 | } else { |
| 2081 | tmsi := 'FFFFFFFF'O; |
| 2082 | } |
| 2083 | f_bssmap_register_imsi(g_pars.imsi, tmsi); |
| 2084 | |
| 2085 | var SmsParameters spars := valueof(t_SmsPars); |
| 2086 | /* TODO: test with more intelligent user data; test different coding schemes */ |
| 2087 | spars.tp.ud := '00'O; |
| 2088 | spars.tp.udl := 1; |
| 2089 | |
| 2090 | /* first test the non-transaction store+forward mode */ |
| 2091 | f_smpp_mt_sms(spars, false); |
| 2092 | |
| 2093 | /* then test the transaction mode */ |
| 2094 | f_smpp_mt_sms(spars, true); |
| 2095 | } |
| 2096 | testcase TC_smpp_mt_sms() runs on MTC_CT { |
| 2097 | var BSC_ConnHdlr vc_conn; |
| 2098 | f_init(); |
| 2099 | vc_conn := f_start_handler(refers(f_tc_smpp_mt_sms), 45); |
| 2100 | vc_conn.done; |
| 2101 | } |
| 2102 | |
| 2103 | /* TODO (SMS): |
| 2104 | * different user data lengths |
| 2105 | * SMPP transaction mode with unsuccessful delivery |
| 2106 | * queued MT-SMS with no paging response + later delivery |
| 2107 | * different data coding schemes |
| 2108 | * multi-part SMS |
| 2109 | * user-data headers |
| 2110 | * TP-PID for SMS to SIM |
| 2111 | * behavior if SMS memory is full + RP-SMMA |
| 2112 | * delivery reports |
| 2113 | * SMPP osmocom extensions |
| 2114 | * more-messages-to-send |
| 2115 | * SMS during ongoing call (SACCH/SAPI3) |
| 2116 | */ |
| 2117 | |
| 2118 | /* TODO (General): |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 2119 | * continue to send repeated MO signalling messages to keep channel open: does MSC tmeout? |
| 2120 | * malformed messages (missing IE, invalid message type): properly rejected? |
| 2121 | * MT call while LU or is ongoing: Do we use existing lchan or page while lchan active? |
| 2122 | * 3G/2G auth permutations |
| 2123 | * encryption algorithms vs. classmark vs. vty config |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 2124 | * send new transaction after/during clear (like SMS, ...) |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 2125 | * too long L3 INFO in DTAP |
| 2126 | * too long / padded BSSAP |
| 2127 | * too long / short TLV values |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 2128 | */ |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 2129 | |
| 2130 | |
| 2131 | control { |
Philipp Maier | 328d166 | 2018-03-07 10:40:27 +0100 | [diff] [blame] | 2132 | execute( TC_cr_before_reset() ); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 2133 | execute( TC_lu_imsi_noauth_tmsi() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 2134 | execute( TC_lu_imsi_noauth_notmsi() ); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 2135 | execute( TC_lu_imsi_reject() ); |
| 2136 | execute( TC_lu_imsi_timeout_gsup() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 2137 | execute( TC_lu_imsi_auth_tmsi() ); |
| 2138 | execute( TC_cmserv_imsi_unknown() ); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 2139 | execute( TC_lu_and_mo_call() ); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 2140 | execute( TC_lu_auth_sai_timeout() ); |
| 2141 | execute( TC_lu_auth_sai_err() ); |
Harald Welte | e1a2f3c | 2018-01-24 17:28:48 +0100 | [diff] [blame] | 2142 | execute( TC_lu_clear_request() ); |
| 2143 | execute( TC_lu_disconnect() ); |
| 2144 | execute( TC_lu_by_imei() ); |
| 2145 | execute( TC_lu_by_tmsi_noauth_unknown() ); |
| 2146 | execute( TC_imsi_detach_by_imsi() ); |
| 2147 | execute( TC_imsi_detach_by_tmsi() ); |
| 2148 | execute( TC_imsi_detach_by_imei() ); |
| 2149 | execute( TC_emerg_call_imei_reject() ); |
| 2150 | execute( TC_emerg_call_imsi() ); |
| 2151 | execute( TC_cm_serv_req_vgcs_reject() ); |
| 2152 | execute( TC_cm_serv_req_vbs_reject() ); |
| 2153 | execute( TC_cm_serv_req_lcs_reject() ); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 2154 | execute( TC_cm_reest_req_reject() ); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 2155 | execute( TC_lu_auth_2G_fail() ); |
| 2156 | execute( TC_lu_imsi_auth_tmsi_encr_13_13() ); |
| 2157 | execute( TC_cl3_no_payload() ); |
| 2158 | execute( TC_cl3_rnd_payload() ); |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 2159 | execute( TC_establish_and_nothing() ); |
| 2160 | execute( TC_mo_setup_and_nothing() ); |
| 2161 | execute( TC_mo_crcx_ran_timeout() ); |
| 2162 | execute( TC_mo_crcx_ran_reject() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 2163 | execute( TC_mt_crcx_ran_reject() ); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 2164 | execute( TC_mo_setup_and_dtmf_dup() ); |
Harald Welte | aa54cf8 | 2018-01-30 08:15:32 +0100 | [diff] [blame] | 2165 | //execute( TC_mt_t310() ); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 2166 | execute( TC_gsup_cancel() ); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 2167 | execute( TC_lu_imsi_auth_tmsi_encr_1_13() ); |
| 2168 | execute( TC_lu_imsi_auth_tmsi_encr_3_13() ); |
| 2169 | execute( TC_lu_imsi_auth_tmsi_encr_3_1() ); |
Neels Hofmeyr | 29b8da0 | 2018-03-01 18:09:45 +0100 | [diff] [blame] | 2170 | execute( TC_lu_imsi_auth_tmsi_encr_3_1_no_cm() ); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 2171 | execute( TC_lu_imsi_auth_tmsi_encr_13_2() ); |
| 2172 | execute( TC_lu_imsi_auth_tmsi_encr_013_2() ); |
Philipp Maier | 94f3f1b | 2018-03-15 18:54:13 +0100 | [diff] [blame] | 2173 | execute( TC_mo_release_timeout() ); |
Philipp Maier | 2a98a73 | 2018-03-19 16:06:12 +0100 | [diff] [blame] | 2174 | execute( TC_lu_and_mt_call_no_dlcx_resp() ); |
Philipp Maier | 7593298 | 2018-03-27 14:52:35 +0200 | [diff] [blame] | 2175 | execute( TC_reset_two() ); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 2176 | |
| 2177 | execute( TC_lu_and_mt_call() ); |
| 2178 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2179 | execute( TC_lu_and_mo_sms() ); |
| 2180 | execute( TC_lu_and_mt_sms() ); |
Harald Welte | f640a01 | 2018-04-14 17:49:21 +0200 | [diff] [blame] | 2181 | execute( TC_smpp_mo_sms() ); |
| 2182 | execute( TC_smpp_mt_sms() ); |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2183 | |
Neels Hofmeyr | 1b3c6e3 | 2018-03-01 17:52:21 +0100 | [diff] [blame] | 2184 | /* Run this last: at the time of writing this test crashes the MSC */ |
| 2185 | execute( TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() ); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 2186 | } |
| 2187 | |
| 2188 | |
| 2189 | } |