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 | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 48 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 49 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 50 | type component MTC_CT extends CTRL_Adapter_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 51 | var boolean g_initialized := false; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 52 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 53 | var BSSAP_Adapter g_bssap; |
| 54 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 55 | /* no 'adapter_CT' for MNCC or GSUP */ |
| 56 | var MNCC_Emulation_CT vc_MNCC; |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 57 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 58 | var GSUP_Emulation_CT vc_GSUP; |
| 59 | var IPA_Emulation_CT vc_GSUP_IPA; |
| 60 | |
| 61 | /* only to get events from IPA underneath GSUP */ |
| 62 | port IPA_CTRL_PT GSUP_IPA_EVENT; |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 63 | /* VTY to MSC */ |
| 64 | port TELNETasp_PT MSCVTY; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | modulepar { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 68 | /* remote parameters of IUT */ |
| 69 | charstring mp_msc_ip := "127.0.0.1"; |
| 70 | integer mp_msc_ctrl_port := 4255; |
| 71 | integer mp_msc_vty_port := 4254; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 72 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 73 | /* local parameters of emulated HLR */ |
| 74 | charstring mp_hlr_ip := "127.0.0.1"; |
| 75 | integer mp_hlr_port := 4222; |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 76 | charstring mp_mgw_ip := "127.0.0.1"; |
| 77 | integer mp_mgw_port := 2427; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 78 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 79 | charstring mp_msc_mncc := "/tmp/mncc"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 80 | |
| 81 | BSSAP_Configuration mp_bssap_cfg := { |
| 82 | sccp_service_type := "mtp3_itu", |
| 83 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 84 | own_pc := 185, |
| 85 | own_ssn := 254, |
| 86 | peer_pc := 187, |
| 87 | peer_ssn := 254 |
| 88 | }; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 92 | function f_init_mncc(charstring id) runs on MTC_CT { |
| 93 | id := id & "-MNCC"; |
| 94 | var MnccOps ops := { |
| 95 | create_cb := refers(MNCC_Emulation.ExpectedCreateCallback), |
| 96 | unitdata_cb := refers(MNCC_Emulation.DummyUnitdataCallback) |
| 97 | } |
| 98 | |
| 99 | vc_MNCC := MNCC_Emulation_CT.create(id); |
| 100 | map(vc_MNCC:MNCC, system:MNCC_CODEC_PT); |
| 101 | vc_MNCC.start(MNCC_Emulation.main(ops, id, mp_msc_mncc)); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 102 | } |
| 103 | |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 104 | function f_init_mgcp(charstring id) runs on MTC_CT { |
| 105 | id := id & "-MGCP"; |
| 106 | var MGCPOps ops := { |
| 107 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 108 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 109 | } |
| 110 | var MGCP_conn_parameters pars := { |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 111 | callagent_ip := mp_msc_ip, |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 112 | callagent_udp_port := -1, |
Harald Welte | 6126fb0 | 2018-01-27 20:08:24 +0100 | [diff] [blame] | 113 | mgw_ip := mp_mgw_ip, |
| 114 | mgw_udp_port := mp_mgw_port |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 118 | map(vc_MGCP:MGCP, system:MGCP_CODEC_PT); |
| 119 | vc_MGCP.start(MGCP_Emulation.main(ops, pars, id)); |
| 120 | } |
| 121 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 122 | function f_init_gsup(charstring id) runs on MTC_CT { |
| 123 | id := id & "-GSUP"; |
| 124 | var GsupOps ops := { |
| 125 | create_cb := refers(GSUP_Emulation.ExpectedCreateCallback) |
| 126 | } |
| 127 | |
| 128 | vc_GSUP_IPA := IPA_Emulation_CT.create(id & "-IPA"); |
| 129 | vc_GSUP := GSUP_Emulation_CT.create(id); |
| 130 | |
| 131 | map(vc_GSUP_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 132 | connect(vc_GSUP:GSUP, vc_GSUP_IPA:IPA_GSUP_PORT); |
| 133 | /* we use this hack to get events like ASP_IPA_EVENT_UP */ |
| 134 | connect(vc_GSUP_IPA:IPA_CTRL_PORT, self:GSUP_IPA_EVENT); |
| 135 | |
| 136 | vc_GSUP.start(GSUP_Emulation.main(ops, id)); |
| 137 | vc_GSUP_IPA.start(IPA_Emulation.main_server(mp_hlr_ip, mp_hlr_port)); |
| 138 | |
| 139 | /* wait for incoming connection to GSUP port before proceeding */ |
| 140 | timer T := 10.0; |
| 141 | T.start; |
| 142 | alt { |
| 143 | [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { } |
| 144 | [] T.timeout { |
| 145 | setverdict(inconc, "No connection to GSUP Port"); |
| 146 | self.stop |
| 147 | } |
| 148 | } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 149 | } |
| 150 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 151 | function f_init() runs on MTC_CT { |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 152 | |
| 153 | if (g_initialized == true) { |
| 154 | return; |
| 155 | } |
| 156 | g_initialized := true; |
| 157 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 158 | f_bssap_init(g_bssap, mp_bssap_cfg, "MSC_Test", BSC_BssmapOps); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 159 | f_ipa_ctrl_start(mp_msc_ip, mp_msc_ctrl_port); |
| 160 | f_init_mncc("MSC_Test"); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 161 | f_init_mgcp("MSC_Test"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 162 | f_init_gsup("MSC_Test"); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 163 | |
| 164 | map(self:MSCVTY, system:MSCVTY); |
| 165 | f_vty_set_prompts(MSCVTY); |
| 166 | f_vty_transceive(MSCVTY, "enable"); |
Harald Welte | b14c77a | 2018-01-25 17:25:44 +0100 | [diff] [blame] | 167 | |
| 168 | /* set some defaults */ |
| 169 | f_vty_config(MSCVTY, "network", "authentication optional"); |
| 170 | f_vty_config(MSCVTY, "msc", "assign-tmsi"); |
| 171 | f_vty_config(MSCVTY, "network", "encryption a5 0"); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | template PDU_BSSAP ts_BSSAP_BSSMAP := { |
| 175 | discriminator := '0'B, |
| 176 | spare := '0000000'B, |
| 177 | dlci := omit, |
| 178 | lengthIndicator := 0, /* overwritten by codec */ |
| 179 | pdu := ? |
| 180 | } |
| 181 | |
| 182 | template PDU_BSSAP tr_BSSAP_BSSMAP := { |
| 183 | discriminator := '0'B, |
| 184 | spare := '0000000'B, |
| 185 | dlci := omit, |
| 186 | lengthIndicator := ?, |
| 187 | pdu := { |
| 188 | bssmap := ? |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | |
| 193 | type integer BssmapCause; |
| 194 | |
| 195 | template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := { |
| 196 | elementIdentifier := '04'O, |
| 197 | lengthIndicator := 0, |
| 198 | causeValue := int2bit(val, 7), |
| 199 | extensionCauseValue := '0'B, |
| 200 | spare1 := omit |
| 201 | } |
| 202 | |
| 203 | template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause) modifies ts_BSSAP_BSSMAP := { |
| 204 | pdu := { |
| 205 | bssmap := { |
| 206 | reset := { |
| 207 | messageType := '30'O, |
| 208 | cause := ts_BSSMAP_IE_Cause(cause), |
| 209 | a_InterfaceSelectorForReset := omit |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | template (value) PDU_BSSAP ts_BSSMAP_ResetAck modifies ts_BSSAP_BSSMAP := { |
| 216 | pdu := { |
| 217 | bssmap := { |
| 218 | resetAck := { |
| 219 | messageType := '31'O, |
| 220 | a_InterfaceSelectorForReset := omit |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | template PDU_BSSAP tr_BSSMAP_ResetAck modifies tr_BSSAP_BSSMAP := { |
| 227 | pdu := { |
| 228 | bssmap := { |
| 229 | resetAck := { |
| 230 | messageType := '31'O, |
| 231 | a_InterfaceSelectorForReset := * |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := { |
| 238 | elementIdentifier := '05'O, |
| 239 | lengthIndicator := 0, |
| 240 | cellIdentifierDiscriminator := '0000'B, |
| 241 | spare1_4 := '0000'B, |
| 242 | cellIdentification := ? |
| 243 | } |
| 244 | |
| 245 | type uint16_t BssmapLAC; |
| 246 | type uint16_t BssmapCI; |
| 247 | |
| 248 | /* |
| 249 | template BSSMAP_IE_CellIdentifier ts_CellId_CGI(mcc, mnc, lac, ci) |
| 250 | modifies ts_BSSMAP_IE_CellID := { |
| 251 | cellIdentification := { |
| 252 | cI_LAC_CGI := { |
| 253 | mnc_mcc := FIXME, |
| 254 | lac := int2oct(lac, 2), |
| 255 | ci := int2oct(ci, 2) |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | */ |
| 260 | |
| 261 | template BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci) |
| 262 | modifies ts_BSSMAP_IE_CellID := { |
| 263 | cellIdentification := { |
| 264 | cI_LAC_CI := { |
| 265 | lac := int2oct(lac, 2), |
| 266 | ci := int2oct(ci, 2) |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci) |
| 272 | modifies ts_BSSMAP_IE_CellID := { |
| 273 | cellIdentification := { |
| 274 | cI_CI := int2oct(ci, 2) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | template BSSMAP_IE_CellIdentifier ts_CellId_none |
| 279 | modifies ts_BSSMAP_IE_CellID := { |
| 280 | cellIdentification := { |
| 281 | cI_noCell := ''O |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | |
| 286 | template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := { |
| 287 | elementIdentifier := '17'O, |
| 288 | lengthIndicator := 0, |
| 289 | layer3info := l3info |
| 290 | } |
| 291 | |
| 292 | template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info) |
| 293 | modifies ts_BSSAP_BSSMAP := { |
| 294 | pdu := { |
| 295 | bssmap := { |
| 296 | completeLayer3Information := { |
| 297 | messageType := '57'O, |
| 298 | cellIdentifier := cell_id, |
| 299 | layer3Information := ts_BSSMAP_IE_L3Info(l3_info), |
| 300 | chosenChannel := omit, |
| 301 | lSAIdentifier := omit, |
| 302 | aPDU := omit, |
| 303 | codecList := omit, |
| 304 | redirectAttemptFlag := omit, |
| 305 | sendSequenceNumber := omit, |
| 306 | iMSI := omit |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | template PDU_BSSAP ts_BSSMAP_HandoReq(BssmapCause cause, BSSMAP_IE_CellIdentifierList cid_list) |
| 313 | modifies ts_BSSAP_BSSMAP := { |
| 314 | pdu := { |
| 315 | bssmap := { |
| 316 | handoverRequired := { |
| 317 | messageType := '11'O, |
| 318 | cause := ts_BSSMAP_IE_Cause(cause), |
| 319 | responseRequest := omit, |
| 320 | cellIdentifierList := cid_list, |
| 321 | circuitPoolList := omit, |
| 322 | currentChannelType1 := omit, |
| 323 | speechVersion := omit, |
| 324 | queueingIndicator := omit, |
| 325 | oldToNewBSSInfo := omit, |
| 326 | sourceToTargetRNCTransparentInfo := omit, |
| 327 | sourceToTargetRNCTransparentInfoCDMA := omit, |
| 328 | gERANClassmark := omit, |
| 329 | talkerPriority := omit, |
| 330 | speechCodec := omit, |
| 331 | cSG_Identifier := omit |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | } |
| 336 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 337 | 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] | 338 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 339 | /* FIXME: move into BSC_ConnectionHandler? */ |
| 340 | function f_start_handler(void_fn fn, charstring id, integer imsi_suffix) runs on MTC_CT return BSC_ConnHdlr { |
| 341 | var BSC_ConnHdlr vc_conn; |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 342 | var BSC_ConnHdlrNetworkPars net_pars := { |
| 343 | kc_support := '0A'O, /* A5/1 and A5/3 enabled */ |
| 344 | expect_tmsi := true, |
| 345 | expect_auth := false, |
| 346 | expect_ciph := false |
| 347 | }; |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 348 | var BSC_ConnHdlrPars pars := { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 349 | sccp_addr_own := g_bssap.sccp_addr_own, |
| 350 | sccp_addr_peer := g_bssap.sccp_addr_peer, |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 351 | cell_id := valueof(ts_CellId_CGI('262'H, '042'H, 23, 42)), |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 352 | imei := f_gen_imei(imsi_suffix), |
| 353 | imsi := f_gen_imsi(imsi_suffix), |
| 354 | msisdn := f_gen_msisdn(imsi_suffix), |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 355 | tmsi := omit, |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 356 | cm1 := valueof(ts_CM1), |
Harald Welte | 8260057 | 2018-01-21 20:54:08 +0100 | [diff] [blame] | 357 | cm2 := valueof(ts_CM2_default), |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 358 | cm3 := omit, |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 359 | vec := omit, |
| 360 | net := net_pars |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | vc_conn := BSC_ConnHdlr.create(id); |
| 364 | /* BSSMAP part / A interface */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 365 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
| 366 | connect(vc_conn:BSSAP_PROC, g_bssap.vc_BSSMAP:PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 367 | /* MNCC part */ |
| 368 | connect(vc_conn:MNCC, vc_MNCC:MNCC_CLIENT); |
| 369 | connect(vc_conn:MNCC_PROC, vc_MNCC:MNCC_PROC); |
Harald Welte | 4aa970c | 2018-01-26 10:38:09 +0100 | [diff] [blame] | 370 | /* MGCP part */ |
| 371 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 372 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 373 | /* GSUP part */ |
| 374 | connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT); |
| 375 | connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC); |
| 376 | |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 377 | /* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we cannot have |
| 378 | * 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] | 379 | vc_conn.start(derefers(fn)(id, pars)); |
| 380 | return vc_conn; |
| 381 | } |
| 382 | |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 383 | function f_vty_config(TELNETasp_PT pt, charstring config_node, charstring cmd) |
| 384 | { |
| 385 | /* enter config mode; enter node */ |
| 386 | f_vty_enter_config(pt); |
| 387 | f_vty_transceive(pt, config_node); |
| 388 | /* execute command */ |
| 389 | f_vty_transceive(pt, cmd); |
| 390 | /* leave config mode */ |
| 391 | f_vty_transceive(pt, "end"); |
| 392 | } |
| 393 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 394 | 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] | 395 | f_init_handler(pars); |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 396 | f_perform_lu(true); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 397 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 398 | testcase TC_lu_imsi_noauth_tmsi() runs on MTC_CT { |
| 399 | var BSC_ConnHdlr vc_conn; |
| 400 | f_init(); |
| 401 | |
| 402 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_tmsi), testcasename(), 1); |
| 403 | vc_conn.done; |
| 404 | } |
| 405 | |
| 406 | 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] | 407 | pars.net.expect_tmsi := false; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 408 | f_init_handler(pars); |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 409 | f_perform_lu(true); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 410 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 411 | testcase TC_lu_imsi_noauth_notmsi() runs on MTC_CT { |
| 412 | var BSC_ConnHdlr vc_conn; |
| 413 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 414 | f_vty_config(MSCVTY, "msc", "no assign-tmsi"); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 415 | |
| 416 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_notmsi), testcasename(), 2); |
| 417 | vc_conn.done; |
| 418 | } |
| 419 | |
| 420 | /* Do LU by IMSI, refuse it on GSUP and expect LU REJ back to MS */ |
| 421 | 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] | 422 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 423 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 424 | |
| 425 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 426 | f_bssap_compl_l3(l3_lu); |
| 427 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 428 | GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 23)); |
| 429 | alt { |
| 430 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej(int2oct(23,1)))) { } |
| 431 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 432 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
| 433 | self.stop; |
| 434 | } |
| 435 | } |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 436 | f_expect_clear(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 437 | } |
| 438 | testcase TC_lu_imsi_reject() runs on MTC_CT { |
| 439 | var BSC_ConnHdlr vc_conn; |
| 440 | f_init(); |
| 441 | |
| 442 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_reject), testcasename(), 3); |
| 443 | vc_conn.done; |
| 444 | } |
| 445 | |
| 446 | /* Do LU by IMSI, timeout on GSUP */ |
| 447 | 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] | 448 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 449 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 450 | |
| 451 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 452 | f_bssap_compl_l3(l3_lu); |
| 453 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 454 | /* Normally the HLR would need to respond here, but we decide to force a timeout here */ |
| 455 | alt { |
| 456 | /* FIXME: Expect specific reject cause */ |
| 457 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 458 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 459 | setverdict(fail, "Expecting LU REJ, but got ACCEPT"); |
| 460 | self.stop; |
| 461 | } |
| 462 | } |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 463 | f_expect_clear(); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 464 | } |
| 465 | testcase TC_lu_imsi_timeout_gsup() runs on MTC_CT { |
| 466 | var BSC_ConnHdlr vc_conn; |
| 467 | f_init(); |
| 468 | |
| 469 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_timeout_gsup), testcasename(), 4); |
| 470 | vc_conn.done; |
| 471 | } |
| 472 | |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 473 | 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] | 474 | pars.net.expect_auth := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 475 | f_init_handler(pars); |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 476 | f_perform_lu(true); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 477 | } |
| 478 | testcase TC_lu_imsi_auth_tmsi() runs on MTC_CT { |
| 479 | var BSC_ConnHdlr vc_conn; |
| 480 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 481 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 7b1b281 | 2018-01-22 21:23:06 +0100 | [diff] [blame] | 482 | |
| 483 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi), testcasename(), 5); |
| 484 | vc_conn.done; |
| 485 | } |
| 486 | |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 487 | |
| 488 | /* Send CM SERVICE REQ for IMSI that has never performed LU before */ |
| 489 | private function f_tc_cmserv_imsi_unknown(charstring id, BSC_ConnHdlrPars pars) |
| 490 | runs on BSC_ConnHdlr { |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 491 | f_init_handler(pars); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 492 | |
| 493 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 494 | var BSSMAP_IE_CellIdentifier cell_id := valueof(ts_CellId_CGI('262'H, '042'H, 23, 42)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 495 | 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] | 496 | |
| 497 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 498 | |
| 499 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 500 | f_bssap_compl_l3(l3_info); |
| 501 | |
| 502 | timer T := 10.0; |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 503 | T.start; |
| 504 | alt { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 505 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 506 | //[] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC)) { } |
| 507 | [] BSSAP.receive { setverdict(fail, "Received unexpected BSSAP"); } |
| 508 | [] GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) { |
| 509 | setverdict(fail, "Unexpected GSUP UL REQ"); |
| 510 | } |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 511 | [] T.timeout { setverdict(fail, "Timeout waiting for CM SERV REQ"); } |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 512 | } |
| 513 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 514 | f_expect_clear(); |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 515 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 516 | testcase TC_cmserv_imsi_unknown() runs on MTC_CT { |
| 517 | var BSC_ConnHdlr vc_conn; |
| 518 | f_init(); |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 519 | vc_conn := f_start_handler(refers(f_tc_cmserv_imsi_unknown), testcasename(), 6); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 520 | vc_conn.done; |
| 521 | } |
| 522 | |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 523 | 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] | 524 | f_init_handler(pars); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 525 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 526 | cpars.bss_rtp_port := 1110; |
| 527 | cpars.mgcp_connection_id_bss := '22222'H; |
| 528 | cpars.mgcp_connection_id_mss := '33333'H; |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 529 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 530 | f_perform_lu(true); |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 531 | f_mo_call(cpars); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 532 | } |
| 533 | testcase TC_lu_and_mo_call() runs on MTC_CT { |
| 534 | var BSC_ConnHdlr vc_conn; |
| 535 | f_init(); |
| 536 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 537 | vc_conn := f_start_handler(refers(f_tc_lu_and_mo_call), testcasename(), 7); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 538 | vc_conn.done; |
| 539 | } |
| 540 | |
| 541 | /* Test LU (with authentication enabled), where HLR times out sending SAI response */ |
| 542 | 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] | 543 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 544 | |
| 545 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 546 | var PDU_DTAP_MT dtap_mt; |
| 547 | |
| 548 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 549 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 550 | |
| 551 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 552 | f_bssap_compl_l3(l3_lu); |
| 553 | |
| 554 | /* Send Early Classmark, just for the fun of it */ |
| 555 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 556 | |
| 557 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 558 | /* The HLR would normally return an auth vector here, but we fail to do so. */ |
| 559 | |
| 560 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 561 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 562 | } |
| 563 | testcase TC_lu_auth_sai_timeout() runs on MTC_CT { |
| 564 | var BSC_ConnHdlr vc_conn; |
| 565 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 566 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 567 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 568 | vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_timeout), testcasename(), 8); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 569 | vc_conn.done; |
| 570 | } |
| 571 | |
| 572 | /* Test LU (with authentication enabled), where HLR rejects sending SAI error */ |
| 573 | 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] | 574 | f_init_handler(pars); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 575 | |
| 576 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 577 | var PDU_DTAP_MT dtap_mt; |
| 578 | |
| 579 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 580 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 581 | |
| 582 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 583 | f_bssap_compl_l3(l3_lu); |
| 584 | |
| 585 | /* Send Early Classmark, just for the fun of it */ |
| 586 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 587 | |
| 588 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 589 | GSUP.send(ts_GSUP_SAI_ERR(g_pars.imsi, 13)); |
| 590 | |
| 591 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 592 | f_expect_clear(); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 593 | } |
| 594 | testcase TC_lu_auth_sai_err() runs on MTC_CT { |
| 595 | var BSC_ConnHdlr vc_conn; |
| 596 | f_init(); |
Harald Welte | 3ca1c90 | 2018-01-24 18:51:27 +0100 | [diff] [blame] | 597 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 598 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 599 | vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_err), testcasename(), 9); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 600 | vc_conn.done; |
| 601 | } |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 602 | |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 603 | /* Test LU but BSC will send a clear request in the middle */ |
| 604 | 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] | 605 | f_init_handler(pars); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 606 | |
| 607 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 608 | var PDU_DTAP_MT dtap_mt; |
| 609 | |
| 610 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 611 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 612 | |
| 613 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 614 | f_bssap_compl_l3(l3_lu); |
| 615 | |
| 616 | /* Send Early Classmark, just for the fun of it */ |
| 617 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 618 | |
| 619 | f_sleep(1.0); |
| 620 | /* send clear request in the middle of the LU */ |
| 621 | BSSAP.send(ts_BSSMAP_ClearRequest(0)); |
| 622 | BSSAP.receive(tr_BSSMAP_ClearCommand); |
| 623 | BSSAP.send(ts_BSSMAP_ClearComplete); |
Harald Welte | 89a3249 | 2018-01-27 19:07:28 +0100 | [diff] [blame] | 624 | alt { |
| 625 | /* See https://osmocom.org/issues/2862 */ |
| 626 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { repeat; } |
| 627 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
| 628 | } |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 629 | setverdict(pass); |
| 630 | } |
| 631 | testcase TC_lu_clear_request() runs on MTC_CT { |
| 632 | var BSC_ConnHdlr vc_conn; |
| 633 | f_init(); |
| 634 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 635 | vc_conn := f_start_handler(refers(f_tc_lu_clear_request), testcasename(), 10); |
Harald Welte | bc88178 | 2018-01-23 20:09:15 +0100 | [diff] [blame] | 636 | vc_conn.done; |
| 637 | } |
| 638 | |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 639 | /* Test LU but BSC will send a clear request in the middle */ |
| 640 | 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] | 641 | f_init_handler(pars); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 642 | |
| 643 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 644 | var PDU_DTAP_MT dtap_mt; |
| 645 | |
| 646 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 647 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 648 | |
| 649 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 650 | f_bssap_compl_l3(l3_lu); |
| 651 | |
| 652 | /* Send Early Classmark, just for the fun of it */ |
| 653 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 654 | |
| 655 | f_sleep(1.0); |
| 656 | /* send clear request in the middle of the LU */ |
| 657 | BSSAP.send(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 658 | setverdict(pass); |
| 659 | } |
| 660 | testcase TC_lu_disconnect() runs on MTC_CT { |
| 661 | var BSC_ConnHdlr vc_conn; |
| 662 | f_init(); |
| 663 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 664 | vc_conn := f_start_handler(refers(f_tc_lu_disconnect), testcasename(), 11); |
Harald Welte | 66af9e6 | 2018-01-24 17:28:21 +0100 | [diff] [blame] | 665 | vc_conn.done; |
| 666 | } |
| 667 | |
| 668 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 669 | /* Test LU but with illegal mobile identity type = IMEI */ |
| 670 | 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] | 671 | f_init_handler(pars); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 672 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 673 | 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] | 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 | /* wait for LU reject, ignore any ID REQ */ |
| 685 | alt { |
| 686 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 687 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req)) { repeat; } |
| 688 | } |
| 689 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 690 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 691 | } |
| 692 | testcase TC_lu_by_imei() runs on MTC_CT { |
| 693 | var BSC_ConnHdlr vc_conn; |
| 694 | f_init(); |
| 695 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 696 | vc_conn := f_start_handler(refers(f_tc_lu_by_imei), testcasename(), 12); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 697 | vc_conn.done; |
| 698 | } |
| 699 | |
| 700 | /* Test LU by TMSI with unknown TMSI, expect (and answer) ID REQ. */ |
| 701 | 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] | 702 | f_init_handler(pars); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 703 | |
| 704 | var PDU_ML3_MS_NW l3_lu := f_build_lu_tmsi('01020304'O); /* FIXME: Random */ |
| 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 | /* Wait for + respond to ID REQ (IMSI) */ |
| 717 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req('001'B))); |
| 718 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi))); |
| 719 | |
| 720 | /* Expect MSC to do UpdateLocation to HLR; respond to it */ |
| 721 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 722 | GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 723 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 724 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 725 | |
| 726 | alt { |
Harald Welte | 7ec4fa8 | 2018-01-27 10:57:40 +0100 | [diff] [blame] | 727 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) { |
| 728 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl)); |
| 729 | } |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 730 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { |
| 731 | setverdict(fail, "Expected LU ACK, but received REJ"); |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 736 | f_expect_clear(); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 737 | } |
| 738 | testcase TC_lu_by_tmsi_noauth_unknown() runs on MTC_CT { |
| 739 | var BSC_ConnHdlr vc_conn; |
| 740 | f_init(); |
| 741 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 742 | vc_conn := f_start_handler(refers(f_tc_lu_tmsi_noauth_unknown), testcasename(), 13); |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 743 | vc_conn.done; |
| 744 | } |
| 745 | |
| 746 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 747 | /* Test IMSI DETACH (MI=IMSI) */ |
| 748 | 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] | 749 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 750 | |
| 751 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 752 | |
| 753 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 754 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 755 | |
| 756 | /* Send Early Classmark, just for the fun of it? */ |
| 757 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 758 | |
| 759 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 760 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 761 | } |
| 762 | testcase TC_imsi_detach_by_imsi() runs on MTC_CT { |
| 763 | var BSC_ConnHdlr vc_conn; |
| 764 | f_init(); |
| 765 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 766 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imsi), testcasename(), 14); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 767 | vc_conn.done; |
| 768 | } |
| 769 | |
| 770 | /* Test IMSI DETACH (MI=TMSI) */ |
| 771 | 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] | 772 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 773 | |
| 774 | var MobileIdentityLV mi := valueof(ts_MI_TMSI_LV('01020304'O)); |
| 775 | |
| 776 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 777 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 778 | |
| 779 | /* Send Early Classmark, just for the fun of it? */ |
| 780 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 781 | |
| 782 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 783 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 784 | } |
| 785 | testcase TC_imsi_detach_by_tmsi() runs on MTC_CT { |
| 786 | var BSC_ConnHdlr vc_conn; |
| 787 | f_init(); |
| 788 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 789 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_tmsi), testcasename(), 15); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 790 | vc_conn.done; |
| 791 | } |
| 792 | |
| 793 | /* Test IMSI DETACH (MI=IMEI), which is illegal */ |
| 794 | 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] | 795 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 796 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 797 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 798 | |
| 799 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 800 | f_bssap_compl_l3(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(mi))); |
| 801 | |
| 802 | /* Send Early Classmark, just for the fun of it? */ |
| 803 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 804 | |
| 805 | /* wait for normal teardown */ |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 806 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 807 | } |
| 808 | testcase TC_imsi_detach_by_imei() runs on MTC_CT { |
| 809 | var BSC_ConnHdlr vc_conn; |
| 810 | f_init(); |
| 811 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 812 | vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imei), testcasename(), 16); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 813 | vc_conn.done; |
| 814 | } |
| 815 | |
| 816 | |
| 817 | /* helper function for an emergency call. caller passes in mobile identity to use */ |
| 818 | private function f_emerg_call(MobileIdentityLV mi) runs on BSC_ConnHdlr { |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 819 | var CallParameters cpars := valueof(t_CallParams('112'H, 0)); |
| 820 | cpars.emergency := true; |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 821 | |
Harald Welte | 0bef21e | 2018-02-10 09:48:23 +0100 | [diff] [blame] | 822 | f_mo_call(cpars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | /* establish an emergency call by IMEI, no SIM inserted (and hence no IMSI) */ |
| 826 | 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] | 827 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 828 | |
Harald Welte | 256571e | 2018-01-24 18:47:19 +0100 | [diff] [blame] | 829 | var MobileIdentityLV mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 830 | 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] | 831 | f_bssap_compl_l3(l3_info); |
| 832 | BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ('05'O))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 833 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 834 | } |
| 835 | testcase TC_emerg_call_imei_reject() runs on MTC_CT { |
| 836 | var BSC_ConnHdlr vc_conn; |
| 837 | f_init(); |
| 838 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 839 | vc_conn := f_start_handler(refers(f_tc_emerg_call_imei_reject), testcasename(), 17); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 840 | vc_conn.done; |
| 841 | } |
| 842 | |
Harald Welte | d5b9140 | 2018-01-24 18:48:16 +0100 | [diff] [blame] | 843 | /* establish an emergency call by IMSI, SIM inserted (and hence IMSI) */ |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 844 | 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] | 845 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 846 | /* First perform location update to ensure subscriber is known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 847 | f_perform_lu(true); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 848 | /* Then issue emergency call identified by IMSI */ |
| 849 | f_emerg_call(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
| 850 | } |
| 851 | testcase TC_emerg_call_imsi() runs on MTC_CT { |
| 852 | var BSC_ConnHdlr vc_conn; |
| 853 | f_init(); |
| 854 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 855 | vc_conn := f_start_handler(refers(f_tc_emerg_call_imsi), testcasename(), 18); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 856 | vc_conn.done; |
| 857 | } |
| 858 | |
| 859 | /* CM Service Request for VGCS -> reject */ |
| 860 | 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] | 861 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 862 | |
| 863 | /* First perform location update to ensure subscriber is known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 864 | f_perform_lu(true); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 865 | |
| 866 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 867 | 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] | 868 | f_bssap_compl_l3(l3_info); |
| 869 | 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] | 870 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 871 | } |
| 872 | testcase TC_cm_serv_req_vgcs_reject() runs on MTC_CT { |
| 873 | var BSC_ConnHdlr vc_conn; |
| 874 | f_init(); |
| 875 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 876 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_vgcs_reject), testcasename(), 19); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 877 | vc_conn.done; |
| 878 | } |
| 879 | |
| 880 | /* CM Service Request for VBS -> reject */ |
| 881 | 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] | 882 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 883 | |
| 884 | /* First perform location update to ensure subscriber is known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 885 | f_perform_lu(true); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 886 | |
| 887 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 888 | 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] | 889 | f_bssap_compl_l3(l3_info); |
| 890 | 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] | 891 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 892 | } |
| 893 | testcase TC_cm_serv_req_vbs_reject() runs on MTC_CT { |
| 894 | var BSC_ConnHdlr vc_conn; |
| 895 | f_init(); |
| 896 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 897 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_vbs_reject), testcasename(), 20); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 898 | vc_conn.done; |
| 899 | } |
| 900 | |
| 901 | /* CM Service Request for LCS -> reject */ |
| 902 | 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] | 903 | f_init_handler(pars); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 904 | |
| 905 | /* First perform location update to ensure subscriber is known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 906 | f_perform_lu(true); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 907 | |
| 908 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 909 | 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] | 910 | f_bssap_compl_l3(l3_info); |
| 911 | 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] | 912 | f_expect_clear(); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 913 | } |
| 914 | testcase TC_cm_serv_req_lcs_reject() runs on MTC_CT { |
| 915 | var BSC_ConnHdlr vc_conn; |
| 916 | f_init(); |
| 917 | |
Harald Welte | 81b7f9d | 2018-01-24 19:06:24 +0100 | [diff] [blame] | 918 | vc_conn := f_start_handler(refers(f_tc_cm_serv_req_lcs_reject), testcasename(), 21); |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 919 | vc_conn.done; |
| 920 | } |
| 921 | |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 922 | /* CM Re-Establishment Request */ |
| 923 | 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] | 924 | f_init_handler(pars); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 925 | |
| 926 | /* First perform location update to ensure subscriber is known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 927 | f_perform_lu(true); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 928 | |
| 929 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 930 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REEST_REQ(0, mi)); |
| 931 | f_bssap_compl_l3(l3_info); |
| 932 | 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] | 933 | f_expect_clear(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 934 | } |
| 935 | testcase TC_cm_reest_req_reject() runs on MTC_CT { |
| 936 | var BSC_ConnHdlr vc_conn; |
| 937 | f_init(); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 938 | |
| 939 | vc_conn := f_start_handler(refers(f_tc_cm_reest_req_reject), testcasename(), 22); |
| 940 | vc_conn.done; |
| 941 | } |
| 942 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 943 | /* Test LU (with authentication enabled), with wrong response from MS */ |
| 944 | 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] | 945 | f_init_handler(pars); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 946 | |
| 947 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi) |
| 948 | |
| 949 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 950 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 951 | |
| 952 | /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */ |
| 953 | f_bssap_compl_l3(l3_lu); |
| 954 | |
| 955 | /* Send Early Classmark, just for the fun of it */ |
| 956 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 957 | |
| 958 | var AuthVector vec := f_gen_auth_vec_2g(); |
| 959 | var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(vec.rand, vec.sres, vec.kc)); |
| 960 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 961 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 962 | |
| 963 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(vec.rand))); |
| 964 | /* Send back wrong auth response */ |
| 965 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G('00000000'O))); |
| 966 | |
| 967 | /* Expect GSUP AUTH FAIL REP to HLR */ |
| 968 | GSUP.receive(tr_GSUP_AUTH_FAIL_IND(g_pars.imsi)); |
| 969 | |
| 970 | /* Expect LU REJECT with Cause == Illegal MS */ |
| 971 | 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] | 972 | f_expect_clear(); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 973 | } |
| 974 | testcase TC_lu_auth_2G_fail() runs on MTC_CT { |
| 975 | var BSC_ConnHdlr vc_conn; |
| 976 | f_init(); |
| 977 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 978 | |
| 979 | vc_conn := f_start_handler(refers(f_tc_lu_auth_2G_fail), testcasename(), 23); |
| 980 | vc_conn.done; |
| 981 | } |
| 982 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 983 | /* 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] | 984 | 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] | 985 | pars.net.expect_auth := true; |
| 986 | pars.net.expect_ciph := true; |
Harald Welte | a10db90 | 2018-01-27 12:44:49 +0100 | [diff] [blame] | 987 | f_init_handler(pars); |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 988 | f_perform_lu(true); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 989 | } |
| 990 | testcase TC_lu_imsi_auth_tmsi_encr_13_13() runs on MTC_CT { |
| 991 | var BSC_ConnHdlr vc_conn; |
| 992 | f_init(); |
| 993 | f_vty_config(MSCVTY, "network", "authentication required"); |
Harald Welte | 1611428 | 2018-01-24 22:41:21 +0100 | [diff] [blame] | 994 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 995 | |
| 996 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_13_13), testcasename(), 24); |
| 997 | vc_conn.done; |
| 998 | } |
| 999 | |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1000 | /* Test Complete L3 without payload */ |
| 1001 | 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] | 1002 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1003 | |
| 1004 | /* Send Complete L3 Info with empty L3 frame */ |
| 1005 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1006 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, ''O)))); |
| 1007 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1008 | timer T := 5.0; |
| 1009 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1010 | alt { |
| 1011 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
| 1012 | /* Expect LU REJECT with Cause == Illegal MS */ |
| 1013 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 1014 | BSSAP.send(ts_BSSMAP_ClearComplete); |
| 1015 | BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 1016 | } |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1017 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1018 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1019 | self.stop; |
| 1020 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1021 | } |
| 1022 | setverdict(pass); |
| 1023 | } |
| 1024 | testcase TC_cl3_no_payload() runs on MTC_CT { |
| 1025 | var BSC_ConnHdlr vc_conn; |
| 1026 | f_init(); |
| 1027 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1028 | vc_conn := f_start_handler(refers(f_tc_cl3_no_payload), testcasename(), 25); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1029 | vc_conn.done; |
| 1030 | } |
| 1031 | |
| 1032 | /* Test Complete L3 with random payload */ |
| 1033 | 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] | 1034 | f_init_handler(pars); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1035 | |
| 1036 | var integer len := float2int(rnd() * 256.0); |
| 1037 | var octetstring payl := f_rnd_octstring(len); |
| 1038 | |
| 1039 | /* Send Complete L3 Info with empty L3 frame */ |
| 1040 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_peer, g_pars.sccp_addr_own, |
| 1041 | valueof(ts_BSSMAP_ComplL3(g_pars.cell_id, payl)))); |
| 1042 | |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1043 | timer T := 5.0; |
| 1044 | T.start; |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1045 | alt { |
| 1046 | /* Immediate disconnect */ |
| 1047 | [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {} |
| 1048 | /* Expect LU REJECT with Cause == Illegal MS */ |
| 1049 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 1050 | BSSAP.send(ts_BSSMAP_ClearComplete); |
| 1051 | BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 1052 | } |
| 1053 | [] BSSAP.receive(tr_PDU_DTAP_MT(?)) { repeat; } |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1054 | [] T.timeout { |
Daniel Willmann | 90829d6 | 2018-02-15 17:45:14 +0100 | [diff] [blame] | 1055 | setverdict(fail, "Timeout waiting for ClearCommand or SCCP Release"); |
Harald Welte | f466eb4 | 2018-01-27 14:26:54 +0100 | [diff] [blame] | 1056 | self.stop; |
| 1057 | } |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1058 | } |
| 1059 | setverdict(pass); |
| 1060 | } |
| 1061 | testcase TC_cl3_rnd_payload() runs on MTC_CT { |
| 1062 | var BSC_ConnHdlr vc_conn; |
| 1063 | f_init(); |
| 1064 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1065 | vc_conn := f_start_handler(refers(f_tc_cl3_rnd_payload), testcasename(), 26); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1066 | vc_conn.done; |
| 1067 | } |
| 1068 | |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1069 | /* Test Complete L3 with random payload */ |
| 1070 | 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] | 1071 | f_init_handler(pars); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1072 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1073 | f_perform_lu(true); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1074 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1075 | f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1076 | f_expect_clear(); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1077 | } |
| 1078 | testcase TC_establish_and_nothing() runs on MTC_CT { |
| 1079 | var BSC_ConnHdlr vc_conn; |
| 1080 | f_init(); |
| 1081 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1082 | vc_conn := f_start_handler(refers(f_tc_establish_and_nothing), testcasename(), 27); |
Harald Welte | 116e433 | 2018-01-26 22:17:48 +0100 | [diff] [blame] | 1083 | vc_conn.done; |
| 1084 | } |
| 1085 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1086 | /* Test MO Call SETUP with no response from MNCC */ |
| 1087 | 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] | 1088 | f_init_handler(pars); |
| 1089 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1090 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1091 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1092 | f_perform_lu(true); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1093 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1094 | f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1095 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1096 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1097 | |
| 1098 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1099 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1100 | f_expect_clear(30.0); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1101 | } |
| 1102 | testcase TC_mo_setup_and_nothing() runs on MTC_CT { |
| 1103 | var BSC_ConnHdlr vc_conn; |
| 1104 | f_init(); |
| 1105 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1106 | vc_conn := f_start_handler(refers(f_tc_mo_setup_and_nothing), testcasename(), 28); |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1107 | vc_conn.done; |
| 1108 | } |
| 1109 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1110 | /* Test MO Call with no response to RAN-side CRCX */ |
| 1111 | 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] | 1112 | f_init_handler(pars); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1113 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1114 | var MNCC_PDU mncc; |
| 1115 | var MgcpCommand mgcp_cmd; |
| 1116 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1117 | f_perform_lu(true); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1118 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1119 | f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1120 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1121 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1122 | |
| 1123 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1124 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1125 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1126 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1127 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1128 | |
| 1129 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 1130 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1131 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1132 | /* never respond to this */ |
| 1133 | |
Harald Welte | 1ddc716 | 2018-01-27 14:25:46 +0100 | [diff] [blame] | 1134 | f_expect_clear(30.0); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1135 | } |
| 1136 | testcase TC_mo_crcx_ran_timeout() runs on MTC_CT { |
| 1137 | var BSC_ConnHdlr vc_conn; |
| 1138 | f_init(); |
| 1139 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1140 | vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_timeout), testcasename(), 29); |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1141 | vc_conn.done; |
| 1142 | } |
| 1143 | |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1144 | /* Test MO Call with reject to RAN-side CRCX */ |
| 1145 | 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] | 1146 | f_init_handler(pars); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1147 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1148 | var MNCC_PDU mncc; |
| 1149 | var MgcpCommand mgcp_cmd; |
| 1150 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1151 | f_perform_lu(true); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1152 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1153 | f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi))); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1154 | f_create_mncc_expect(hex2str(cpars.called_party)); |
| 1155 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1156 | |
| 1157 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party))); |
| 1158 | MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc; |
| 1159 | cpars.mncc_callref := mncc.u.signal.callref; |
| 1160 | MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, cpars.mncc_bearer_cap)); |
| 1161 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id))); |
| 1162 | |
| 1163 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1164 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1165 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1166 | /* Respond to CRCX with error */ |
| 1167 | var MgcpResponse mgcp_rsp := { |
| 1168 | line := { |
| 1169 | code := "542", |
| 1170 | trans_id := mgcp_cmd.line.trans_id, |
| 1171 | string := "FORCED_FAIL" |
| 1172 | }, |
| 1173 | params := omit, |
| 1174 | sdp := omit |
| 1175 | } |
| 1176 | MGCP.send(mgcp_rsp); |
| 1177 | |
| 1178 | timer T := 30.0; |
| 1179 | T.start; |
| 1180 | alt { |
| 1181 | [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); self.stop; } |
| 1182 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 1183 | BSSAP.send(ts_BSSMAP_ClearComplete); |
| 1184 | BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 1185 | setverdict(pass); |
| 1186 | } |
Daniel Willmann | 5868e62 | 2018-02-15 17:42:59 +0100 | [diff] [blame] | 1187 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))) { |
| 1188 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1189 | repeat; |
| 1190 | } |
| 1191 | [] BSSAP.receive { |
| 1192 | repeat; |
| 1193 | } |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1194 | [] MNCC.receive { repeat; } |
| 1195 | [] GSUP.receive { repeat; } |
| 1196 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1197 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1198 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
Harald Welte | ec6e5b4 | 2018-01-27 12:45:15 +0100 | [diff] [blame] | 1199 | repeat; |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1200 | } |
| 1201 | [] MGCP.receive { repeat; } |
| 1202 | } |
| 1203 | } |
| 1204 | testcase TC_mo_crcx_ran_reject() runs on MTC_CT { |
| 1205 | var BSC_ConnHdlr vc_conn; |
| 1206 | f_init(); |
| 1207 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1208 | vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_reject), testcasename(), 30); |
Harald Welte | 0cc82d9 | 2018-01-26 22:52:34 +0100 | [diff] [blame] | 1209 | vc_conn.done; |
| 1210 | } |
| 1211 | |
Harald Welte | 3ab8800 | 2018-01-26 22:37:25 +0100 | [diff] [blame] | 1212 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1213 | /* helper function to start a MT call: MNCC SETUP; Paging; DChan est.; DTAP SETUP */ |
| 1214 | private function f_mt_call_start(inout CallParameters cpars) runs on BSC_ConnHdlr { |
| 1215 | var MNCC_PDU mncc; |
| 1216 | var MgcpCommand mgcp_cmd; |
| 1217 | var OCT4 tmsi; |
| 1218 | |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1219 | f_perform_lu(true); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1220 | if (isvalue(g_pars.tmsi)) { |
| 1221 | tmsi := g_pars.tmsi; |
| 1222 | } else { |
| 1223 | tmsi := 'FFFFFFFF'O; |
| 1224 | } |
| 1225 | f_bssmap_register_imsi(g_pars.imsi, tmsi); |
| 1226 | |
| 1227 | /* Allocate call reference and send SETUP via MNCC to MSC */ |
| 1228 | cpars.mncc_callref := f_rnd_int(2147483648); |
| 1229 | MNCC.send(ts_MNCC_SETUP_req(cpars.mncc_callref, hex2str(g_pars.msisdn), |
| 1230 | hex2str(cpars.called_party), hex2str(g_pars.imsi))); |
| 1231 | |
| 1232 | /* MSC->BSC: expect PAGING from MSC */ |
| 1233 | BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)); |
| 1234 | /* MS -> MSC: PAGING RESPONSE */ |
Harald Welte | 081b19a | 2018-02-10 09:11:13 +0100 | [diff] [blame] | 1235 | f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), EST_TYPE_PAG_RESP); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1236 | |
| 1237 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1238 | |
| 1239 | /* MSC->MS: SETUP */ |
| 1240 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, *, cpars.called_party))); |
| 1241 | } |
| 1242 | |
| 1243 | /* Test MT Call */ |
| 1244 | 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] | 1245 | f_init_handler(pars); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1246 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1247 | var MNCC_PDU mncc; |
| 1248 | var MgcpCommand mgcp_cmd; |
| 1249 | |
| 1250 | f_mt_call_start(cpars); |
| 1251 | |
| 1252 | /* MS->MSC: CALL CONFIRMED */ |
| 1253 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1254 | |
| 1255 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1256 | |
| 1257 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1258 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1259 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1260 | /* Respond to CRCX with error */ |
| 1261 | var MgcpResponse mgcp_rsp := { |
| 1262 | line := { |
| 1263 | code := "542", |
| 1264 | trans_id := mgcp_cmd.line.trans_id, |
| 1265 | string := "FORCED_FAIL" |
| 1266 | }, |
| 1267 | params := omit, |
| 1268 | sdp := omit |
| 1269 | } |
| 1270 | MGCP.send(mgcp_rsp); |
| 1271 | |
| 1272 | timer T := 30.0; |
| 1273 | T.start; |
| 1274 | alt { |
| 1275 | [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); self.stop; } |
| 1276 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 1277 | BSSAP.send(ts_BSSMAP_ClearComplete); |
| 1278 | BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 1279 | setverdict(pass); |
| 1280 | } |
| 1281 | [] BSSAP.receive { repeat; } |
| 1282 | [] MNCC.receive { repeat; } |
| 1283 | [] GSUP.receive { repeat; } |
| 1284 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1285 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1286 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1287 | repeat; |
| 1288 | } |
| 1289 | [] MGCP.receive { repeat; } |
| 1290 | } |
| 1291 | } |
| 1292 | testcase TC_mt_crcx_ran_reject() runs on MTC_CT { |
| 1293 | var BSC_ConnHdlr vc_conn; |
| 1294 | f_init(); |
| 1295 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1296 | vc_conn := f_start_handler(refers(f_tc_mt_crcx_ran_reject), testcasename(), 31); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1297 | vc_conn.done; |
| 1298 | } |
| 1299 | |
| 1300 | |
| 1301 | /* Test MT Call T310 timer */ |
| 1302 | 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] | 1303 | f_init_handler(pars, 200.0); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1304 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1305 | var MNCC_PDU mncc; |
| 1306 | var MgcpCommand mgcp_cmd; |
| 1307 | |
| 1308 | f_mt_call_start(cpars); |
| 1309 | |
| 1310 | /* MS->MSC: CALL CONFIRMED */ |
| 1311 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_CALL_CONF(cpars.transaction_id))); |
| 1312 | MNCC.receive(tr_MNCC_CALL_CONF_ind(cpars.mncc_callref)); |
| 1313 | |
| 1314 | MGCP.receive(tr_CRCX) -> value mgcp_cmd; |
| 1315 | cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1316 | cpars.mgcp_ep := mgcp_cmd.line.ep; |
| 1317 | /* FIXME: Respond to CRCX */ |
| 1318 | |
| 1319 | /* old libosmocore T310 default timeout is 180s. so let's wait 190 */ |
| 1320 | timer T := 190.0; |
| 1321 | T.start; |
| 1322 | alt { |
| 1323 | [] T.timeout { setverdict(fail, "Timeout waiting for T310"); self.stop; } |
| 1324 | [] MNCC.receive(tr_MNCC_DISC_ind(cpars.mncc_callref)) { |
| 1325 | MNCC.send(ts_MNCC_REL_req(cpars.mncc_callref, valueof(ts_MNCC_cause(23)))); |
| 1326 | } |
| 1327 | } |
| 1328 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_DISC(cpars.transaction_id))); |
| 1329 | BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))); |
| 1330 | /* FIXME: We're sending this with TIflag 0: allocated by sender, which is wrong */ |
| 1331 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id))); |
| 1332 | |
| 1333 | alt { |
| 1334 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 1335 | BSSAP.send(ts_BSSMAP_ClearComplete); |
| 1336 | BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 1337 | setverdict(pass); |
| 1338 | } |
| 1339 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 1340 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1341 | f_create_mgcp_delete_ep(cpars.mgcp_ep); |
| 1342 | repeat; |
| 1343 | } |
| 1344 | } |
| 1345 | } |
| 1346 | testcase TC_mt_t310() runs on MTC_CT { |
| 1347 | var BSC_ConnHdlr vc_conn; |
| 1348 | f_init(); |
| 1349 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1350 | vc_conn := f_start_handler(refers(f_tc_mt_t310), testcasename(), 32); |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1351 | vc_conn.done; |
| 1352 | } |
| 1353 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1354 | /* Perform successful LU + MO call, then GSUP LocationCancel. Subscriber must be denied CM SERV */ |
| 1355 | private function f_tc_gsup_cancel(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1356 | f_init_handler(pars); |
| 1357 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1358 | cpars.bss_rtp_port := 1110; |
| 1359 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1360 | cpars.mgcp_connection_id_mss := '33333'H; |
| 1361 | |
| 1362 | /* Location Update to make subscriber known */ |
Harald Welte | de37149 | 2018-01-27 23:44:41 +0100 | [diff] [blame] | 1363 | f_perform_lu(true); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1364 | |
| 1365 | /* First MO call should succeed */ |
| 1366 | f_mo_call(cpars); |
| 1367 | |
| 1368 | /* Cancel the subscriber in the VLR */ |
| 1369 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_WITHDRAW)); |
| 1370 | alt { |
| 1371 | [] GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)) { } |
| 1372 | [] GSUP.receive(tr_GSUP_CL_ERR(g_pars.imsi)) { |
| 1373 | setverdict(fail, "Received GSUP Location Cancel Error"); |
| 1374 | self.stop; |
| 1375 | } |
| 1376 | } |
| 1377 | |
| 1378 | /* Follow-up transactions should fail */ |
| 1379 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 1380 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 1381 | f_bssap_compl_l3(l3_info); |
| 1382 | alt { |
| 1383 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { } |
| 1384 | [] BSSAP.receive { |
| 1385 | setverdict(fail, "Received unexpected BSSAP instead of CM SERV REJ"); |
| 1386 | self.stop; |
| 1387 | } |
| 1388 | } |
| 1389 | setverdict(pass); |
| 1390 | } |
| 1391 | testcase TC_gsup_cancel() runs on MTC_CT { |
| 1392 | var BSC_ConnHdlr vc_conn; |
| 1393 | f_init(); |
| 1394 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1395 | vc_conn := f_start_handler(refers(f_tc_gsup_cancel), testcasename(), 33); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1396 | vc_conn.done; |
| 1397 | } |
| 1398 | |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1399 | /* A5/1 only permitted on network side, and MS capable to do it */ |
| 1400 | private function f_tc_lu_imsi_auth_tmsi_encr_1_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1401 | pars.net.expect_auth := true; |
| 1402 | pars.net.expect_ciph := true; |
| 1403 | pars.net.kc_support := '02'O; /* A5/1 only */ |
| 1404 | f_init_handler(pars); |
| 1405 | f_perform_lu(true); |
| 1406 | } |
| 1407 | testcase TC_lu_imsi_auth_tmsi_encr_1_13() runs on MTC_CT { |
| 1408 | var BSC_ConnHdlr vc_conn; |
| 1409 | f_init(); |
| 1410 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1411 | f_vty_config(MSCVTY, "network", "encryption a5 1"); |
| 1412 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1413 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_1_13), testcasename(), 34); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1414 | vc_conn.done; |
| 1415 | } |
| 1416 | |
| 1417 | /* A5/3 only permitted on network side, and MS capable to do it */ |
| 1418 | private function f_tc_lu_imsi_auth_tmsi_encr_3_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1419 | pars.net.expect_auth := true; |
| 1420 | pars.net.expect_ciph := true; |
| 1421 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1422 | f_init_handler(pars); |
| 1423 | f_perform_lu(true); |
| 1424 | } |
| 1425 | testcase TC_lu_imsi_auth_tmsi_encr_3_13() runs on MTC_CT { |
| 1426 | var BSC_ConnHdlr vc_conn; |
| 1427 | f_init(); |
| 1428 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1429 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1430 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1431 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_13), testcasename(), 35); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1432 | vc_conn.done; |
| 1433 | } |
| 1434 | |
| 1435 | /* A5/3 only permitted on network side, and MS with only A5/1 support */ |
| 1436 | private function f_tc_lu_imsi_auth_tmsi_encr_3_1(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1437 | pars.net.expect_auth := true; |
| 1438 | pars.net.expect_ciph := true; |
| 1439 | pars.net.kc_support := '08'O; /* A5/3 only */ |
| 1440 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1441 | f_init_handler(pars, 15.0); |
| 1442 | |
| 1443 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1444 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1445 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1446 | f_bssap_compl_l3(l3_lu); |
| 1447 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1448 | f_mm_auth(); |
| 1449 | alt { |
| 1450 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 1451 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1452 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
| 1453 | self.stop; |
| 1454 | } |
| 1455 | [] BSSAP.receive { |
| 1456 | setverdict(inconc, "Unknown/unexpected BSSAP received"); |
| 1457 | self.stop; |
| 1458 | } |
| 1459 | } |
| 1460 | setverdict(pass); |
| 1461 | } |
| 1462 | testcase TC_lu_imsi_auth_tmsi_encr_3_1() runs on MTC_CT { |
| 1463 | var BSC_ConnHdlr vc_conn; |
| 1464 | f_init(); |
| 1465 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1466 | f_vty_config(MSCVTY, "network", "encryption a5 3"); |
| 1467 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1468 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_3_1), testcasename(), 36); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1469 | vc_conn.done; |
| 1470 | } |
| 1471 | |
| 1472 | /* A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1473 | private function f_tc_lu_imsi_auth_tmsi_encr_13_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1474 | pars.net.expect_auth := true; |
| 1475 | pars.net.expect_ciph := true; |
| 1476 | pars.net.kc_support := '0A'O; /* A5/1 + A5/3 */ |
| 1477 | pars.cm1.a5_1 := '1'B; |
| 1478 | pars.cm2.a5_1 := '1'B; |
| 1479 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1480 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1481 | f_init_handler(pars, 15.0); |
| 1482 | |
| 1483 | /* cannot use f_perform_lu() as we expect a reject */ |
| 1484 | var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi); |
| 1485 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
| 1486 | f_bssap_compl_l3(l3_lu); |
| 1487 | BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3)); |
| 1488 | f_mm_auth(); |
| 1489 | alt { |
| 1490 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { } |
| 1491 | [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) { |
| 1492 | setverdict(fail, "CipherModeCommand despite no A5 intersection"); |
| 1493 | self.stop; |
| 1494 | } |
| 1495 | [] BSSAP.receive { |
| 1496 | setverdict(inconc, "Unknown/unexpected BSSAP received"); |
| 1497 | self.stop; |
| 1498 | } |
| 1499 | } |
| 1500 | setverdict(pass); |
| 1501 | } |
| 1502 | testcase TC_lu_imsi_auth_tmsi_encr_13_2() runs on MTC_CT { |
| 1503 | var BSC_ConnHdlr vc_conn; |
| 1504 | f_init(); |
| 1505 | f_vty_config(MSCVTY, "network", "authentication required"); |
| 1506 | f_vty_config(MSCVTY, "network", "encryption a5 1 3"); |
| 1507 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1508 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_13_2), testcasename(), 37); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1509 | vc_conn.done; |
| 1510 | } |
| 1511 | |
| 1512 | /* A5/0 + A5/1 + A5/3 only permitted on network side, and MS with only A5/2 support */ |
| 1513 | private function f_tc_lu_imsi_auth_tmsi_encr_013_2(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1514 | pars.net.expect_auth := true; |
| 1515 | pars.net.expect_ciph := true; |
| 1516 | pars.net.kc_support := '0B'O; /* A5/1 + A5/3 */ |
| 1517 | pars.cm1.a5_1 := '1'B; |
| 1518 | pars.cm2.a5_1 := '1'B; |
| 1519 | pars.cm2.classmarkInformationType2_oct5.a5_3 := '0'B; |
| 1520 | pars.cm2.classmarkInformationType2_oct5.a5_2 := '1'B; |
| 1521 | f_init_handler(pars, 15.0); |
| 1522 | f_perform_lu(true); |
| 1523 | } |
| 1524 | testcase TC_lu_imsi_auth_tmsi_encr_013_2() 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 0 1 3"); |
| 1529 | |
Daniel Willmann | 4bd9955 | 2018-02-02 18:27:14 +0100 | [diff] [blame] | 1530 | vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi_encr_013_2), testcasename(), 38); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1531 | vc_conn.done; |
| 1532 | } |
| 1533 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1534 | /* LU followed by MT call (including paging) */ |
| 1535 | private function f_tc_lu_and_mt_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1536 | f_init_handler(pars); |
| 1537 | //FIXME: odd digits var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1538 | var CallParameters cpars := valueof(t_CallParams('123456'H, 0)); |
| 1539 | cpars.bss_rtp_port := 1110; |
| 1540 | cpars.mgcp_connection_id_bss := '10004'H; |
| 1541 | cpars.mgcp_connection_id_mss := '10005'H; |
| 1542 | |
| 1543 | f_perform_lu(true); |
| 1544 | f_mt_call(cpars); |
| 1545 | } |
| 1546 | testcase TC_lu_and_mt_call() runs on MTC_CT { |
| 1547 | var BSC_ConnHdlr vc_conn; |
| 1548 | f_init(); |
| 1549 | |
| 1550 | vc_conn := f_start_handler(refers(f_tc_lu_and_mt_call), testcasename(), 39); |
| 1551 | vc_conn.done; |
| 1552 | } |
| 1553 | |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1554 | /* Test MO Call SETUP with DTMF */ |
| 1555 | private function f_tc_mo_setup_dtmf_dup(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr { |
| 1556 | f_init_handler(pars); |
| 1557 | var CallParameters cpars := valueof(t_CallParams('12345'H, 0)); |
| 1558 | cpars.bss_rtp_port := 1110; |
| 1559 | cpars.mgcp_connection_id_bss := '22222'H; |
| 1560 | cpars.mgcp_connection_id_mss := '33333'H; |
| 1561 | |
| 1562 | f_perform_lu(true); |
| 1563 | f_mo_seq_dtmf_dup(cpars); |
| 1564 | } |
| 1565 | testcase TC_mo_setup_and_dtmf_dup() runs on MTC_CT { |
| 1566 | var BSC_ConnHdlr vc_conn; |
| 1567 | f_init(); |
| 1568 | |
| 1569 | vc_conn := f_start_handler(refers(f_tc_mo_setup_dtmf_dup), testcasename(), 39); |
| 1570 | vc_conn.done; |
| 1571 | } |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1572 | |
| 1573 | |
Harald Welte | 12510c5 | 2018-01-26 22:26:24 +0100 | [diff] [blame] | 1574 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1575 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 1576 | /* TODO: |
| 1577 | * continue to send repeated MO signalling messages to keep channel open: does MSC tmeout? |
| 1578 | * malformed messages (missing IE, invalid message type): properly rejected? |
| 1579 | * MT call while LU or is ongoing: Do we use existing lchan or page while lchan active? |
| 1580 | * 3G/2G auth permutations |
| 1581 | * encryption algorithms vs. classmark vs. vty config |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 1582 | * send new transaction after/during clear (like SMS, ...) |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1583 | * too long L3 INFO in DTAP |
| 1584 | * too long / padded BSSAP |
| 1585 | * too long / short TLV values |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 1586 | */ |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 1587 | |
| 1588 | |
| 1589 | control { |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 1590 | execute( TC_lu_imsi_noauth_tmsi() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 1591 | execute( TC_lu_imsi_noauth_notmsi() ); |
Harald Welte | a49e36e | 2018-01-21 19:29:33 +0100 | [diff] [blame] | 1592 | execute( TC_lu_imsi_reject() ); |
| 1593 | execute( TC_lu_imsi_timeout_gsup() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 1594 | execute( TC_lu_imsi_auth_tmsi() ); |
| 1595 | execute( TC_cmserv_imsi_unknown() ); |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 1596 | execute( TC_lu_and_mo_call() ); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 1597 | execute( TC_lu_auth_sai_timeout() ); |
| 1598 | execute( TC_lu_auth_sai_err() ); |
Harald Welte | e1a2f3c | 2018-01-24 17:28:48 +0100 | [diff] [blame] | 1599 | execute( TC_lu_clear_request() ); |
| 1600 | execute( TC_lu_disconnect() ); |
| 1601 | execute( TC_lu_by_imei() ); |
| 1602 | execute( TC_lu_by_tmsi_noauth_unknown() ); |
| 1603 | execute( TC_imsi_detach_by_imsi() ); |
| 1604 | execute( TC_imsi_detach_by_tmsi() ); |
| 1605 | execute( TC_imsi_detach_by_imei() ); |
| 1606 | execute( TC_emerg_call_imei_reject() ); |
| 1607 | execute( TC_emerg_call_imsi() ); |
| 1608 | execute( TC_cm_serv_req_vgcs_reject() ); |
| 1609 | execute( TC_cm_serv_req_vbs_reject() ); |
| 1610 | execute( TC_cm_serv_req_lcs_reject() ); |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 1611 | execute( TC_cm_reest_req_reject() ); |
Harald Welte | 1af6ea8 | 2018-01-25 18:33:15 +0100 | [diff] [blame] | 1612 | execute( TC_lu_auth_2G_fail() ); |
| 1613 | execute( TC_lu_imsi_auth_tmsi_encr_13_13() ); |
| 1614 | execute( TC_cl3_no_payload() ); |
| 1615 | execute( TC_cl3_rnd_payload() ); |
Harald Welte | 1852a84 | 2018-01-26 22:53:36 +0100 | [diff] [blame] | 1616 | execute( TC_establish_and_nothing() ); |
| 1617 | execute( TC_mo_setup_and_nothing() ); |
| 1618 | execute( TC_mo_crcx_ran_timeout() ); |
| 1619 | execute( TC_mo_crcx_ran_reject() ); |
Harald Welte | d2328a2 | 2018-01-27 14:27:16 +0100 | [diff] [blame] | 1620 | execute( TC_mt_crcx_ran_reject() ); |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1621 | execute( TC_mo_setup_and_dtmf_dup() ); |
Harald Welte | aa54cf8 | 2018-01-30 08:15:32 +0100 | [diff] [blame] | 1622 | //execute( TC_mt_t310() ); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 1623 | execute( TC_gsup_cancel() ); |
Harald Welte | 9de8479 | 2018-01-28 01:06:35 +0100 | [diff] [blame] | 1624 | execute( TC_lu_imsi_auth_tmsi_encr_1_13() ); |
| 1625 | execute( TC_lu_imsi_auth_tmsi_encr_3_13() ); |
| 1626 | execute( TC_lu_imsi_auth_tmsi_encr_3_1() ); |
| 1627 | execute( TC_lu_imsi_auth_tmsi_encr_13_2() ); |
| 1628 | execute( TC_lu_imsi_auth_tmsi_encr_013_2() ); |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1629 | |
| 1630 | execute( TC_lu_and_mt_call() ); |
| 1631 | |
Harald Welte | f6dd64d | 2017-11-19 12:09:51 +0100 | [diff] [blame] | 1632 | } |
| 1633 | |
| 1634 | |
| 1635 | } |