Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 1 | module SGSN_Tests { |
| 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* Osmocom SGSN test suite in TTCN-3 |
| 4 | * (C) 2018-2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * (C) 2018-2019 sysmocom - s.f.m.c. GmbH |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 12 | */ |
| 13 | |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 16 | import from Native_Functions all; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 17 | import from NS_Types all; |
| 18 | import from NS_Emulation all; |
| 19 | import from BSSGP_Types all; |
| 20 | import from BSSGP_Emulation all; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 21 | import from Osmocom_Gb_Types all; |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 22 | import from SCCPasp_Types all; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 23 | |
| 24 | import from MobileL3_CommonIE_Types all; |
| 25 | import from MobileL3_GMM_SM_Types all; |
| 26 | import from MobileL3_Types all; |
| 27 | import from L3_Templates all; |
| 28 | import from L3_Common all; |
| 29 | |
| 30 | import from GSUP_Emulation all; |
| 31 | import from GSUP_Types all; |
| 32 | import from IPA_Emulation all; |
| 33 | |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 34 | import from RAN_Adapter all; |
| 35 | import from RAN_Emulation all; |
| 36 | import from RANAP_Templates all; |
| 37 | import from RANAP_PDU_Descriptions all; |
| 38 | import from RANAP_IEs all; |
| 39 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 40 | import from GTP_Emulation all; |
| 41 | import from GTP_Templates all; |
| 42 | import from GTP_CodecPort all; |
| 43 | import from GTPC_Types all; |
| 44 | import from GTPU_Types all; |
| 45 | |
Harald Welte | a2526a8 | 2018-02-18 19:03:36 +0100 | [diff] [blame] | 46 | import from LLC_Types all; |
| 47 | import from LLC_Templates all; |
| 48 | |
| 49 | import from SNDCP_Types all; |
| 50 | |
Harald Welte | bd19472 | 2018-02-16 22:11:08 +0100 | [diff] [blame] | 51 | import from TELNETasp_PortType all; |
| 52 | import from Osmocom_VTY_Functions all; |
| 53 | |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 54 | import from GSM_RR_Types all; |
| 55 | |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 56 | import from MobileL3_MM_Types all; |
| 57 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 58 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 59 | modulepar { |
| 60 | /* IP/port on which we run our internal GSUP/HLR emulation */ |
| 61 | charstring mp_hlr_ip := "127.0.0.1"; |
| 62 | integer mp_hlr_port := 4222; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 63 | charstring mp_ggsn_ip := "127.0.0.2"; |
Alexander Couzens | 2c12b24 | 2018-07-31 00:30:11 +0200 | [diff] [blame] | 64 | |
Alexander Couzens | f3c1b41 | 2018-08-24 00:42:51 +0200 | [diff] [blame] | 65 | NSConfigurations mp_nsconfig := { |
| 66 | { |
| 67 | local_udp_port := 21010, |
| 68 | local_ip := "127.0.0.1", |
| 69 | remote_udp_port := 23000, |
| 70 | remote_ip := "127.0.0.1", |
| 71 | nsvci := 97, |
Harald Welte | 5e514fa | 2018-07-05 00:01:45 +0200 | [diff] [blame] | 72 | nsei := 96, |
| 73 | role_sgsn := false, |
| 74 | handle_sns := false |
Alexander Couzens | f3c1b41 | 2018-08-24 00:42:51 +0200 | [diff] [blame] | 75 | }, |
| 76 | { |
| 77 | local_udp_port := 21011, |
| 78 | local_ip := "127.0.0.1", |
| 79 | remote_udp_port := 23000, |
| 80 | remote_ip := "127.0.0.1", |
| 81 | nsvci := 98, |
Harald Welte | 5e514fa | 2018-07-05 00:01:45 +0200 | [diff] [blame] | 82 | nsei := 97, |
| 83 | role_sgsn := false, |
| 84 | handle_sns := false |
Alexander Couzens | f3c1b41 | 2018-08-24 00:42:51 +0200 | [diff] [blame] | 85 | }, |
| 86 | { |
| 87 | local_udp_port := 21012, |
| 88 | local_ip := "127.0.0.1", |
| 89 | remote_udp_port := 23000, |
| 90 | remote_ip := "127.0.0.1", |
| 91 | nsvci := 99, |
Harald Welte | 5e514fa | 2018-07-05 00:01:45 +0200 | [diff] [blame] | 92 | nsei := 98, |
| 93 | role_sgsn := false, |
| 94 | handle_sns := false |
Alexander Couzens | f3c1b41 | 2018-08-24 00:42:51 +0200 | [diff] [blame] | 95 | } |
Alexander Couzens | 2c12b24 | 2018-07-31 00:30:11 +0200 | [diff] [blame] | 96 | }; |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 97 | |
| 98 | RAN_Configurations mp_ranap_cfg := { |
| 99 | { |
| 100 | transport := RANAP_TRANSPORT_IuCS, |
| 101 | sccp_service_type := "mtp3_itu", |
| 102 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
| 103 | own_pc := 195, |
| 104 | own_ssn := 142, |
| 105 | peer_pc := 188, /* 0.23.4 */ |
| 106 | peer_ssn := 142, |
| 107 | sio := '83'O, |
| 108 | rctx := 2 |
| 109 | } |
| 110 | } |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | type record GbInstance { |
| 114 | NS_CT vc_NS, |
| 115 | BSSGP_CT vc_BSSGP, |
| 116 | BssgpConfig cfg |
| 117 | }; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 118 | |
Harald Welte | 2fa771f | 2019-05-02 20:13:53 +0200 | [diff] [blame] | 119 | const integer NUM_GB := 3; |
| 120 | type record length(NUM_GB) of GbInstance GbInstances; |
| 121 | type record length(NUM_GB) of NSConfiguration NSConfigurations; |
| 122 | type record length(NUM_GB) of BssgpCellId BssgpCellIds; |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 123 | |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 124 | const integer NUM_RNC := 1; |
| 125 | type record of RAN_Configuration RAN_Configurations; |
| 126 | |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 127 | type component test_CT { |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 128 | var GbInstances g_gb; |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 129 | var RAN_Adapter g_ranap[NUM_RNC]; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 130 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 131 | var GSUP_Emulation_CT vc_GSUP; |
| 132 | var IPA_Emulation_CT vc_GSUP_IPA; |
| 133 | /* only to get events from IPA underneath GSUP */ |
| 134 | port IPA_CTRL_PT GSUP_IPA_EVENT; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 135 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 136 | var GTP_Emulation_CT vc_GTP; |
| 137 | |
Harald Welte | bd19472 | 2018-02-16 22:11:08 +0100 | [diff] [blame] | 138 | port TELNETasp_PT SGSNVTY; |
| 139 | |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 140 | var boolean g_initialized := false; |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 141 | var boolean g_use_echo := false; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 142 | }; |
| 143 | |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 144 | type component BSSGP_ConnHdlr extends BSSGP_Client_CT, GSUP_ConnHdlr, GTP_ConnHdlr, RAN_ConnHdlr { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 145 | var BSSGP_ConnHdlrPars g_pars; |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 146 | timer g_Tguard; |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 147 | var LLC_Entities llc; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | type record SGSN_ConnHdlrNetworkPars { |
| 151 | boolean expect_ptmsi, |
| 152 | boolean expect_auth, |
| 153 | boolean expect_ciph |
| 154 | }; |
| 155 | |
| 156 | type record BSSGP_ConnHdlrPars { |
| 157 | /* IMEI of the simulated ME */ |
| 158 | hexstring imei, |
Alexander Couzens | 8f0fb00 | 2018-05-02 19:30:55 +0200 | [diff] [blame] | 159 | /* IMSI of the simulated MS */ |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 160 | hexstring imsi, |
| 161 | /* MSISDN of the simulated MS (probably unused) */ |
| 162 | hexstring msisdn, |
| 163 | /* P-TMSI allocated to the simulated MS */ |
| 164 | OCT4 p_tmsi optional, |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 165 | OCT3 p_tmsi_sig optional, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 166 | /* TLLI of the simulated MS */ |
| 167 | OCT4 tlli, |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 168 | OCT4 tlli_old optional, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 169 | RoutingAreaIdentificationV ra optional, |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 170 | BssgpCellIds bssgp_cell_id, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 171 | AuthVector vec optional, |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 172 | SGSN_ConnHdlrNetworkPars net, |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 173 | float t_guard, |
| 174 | /* only in IuPS / RANAP case */ |
| 175 | SCCP_PAR_Address sccp_addr_local, |
| 176 | SCCP_PAR_Address sccp_addr_peer |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 177 | }; |
| 178 | |
Alexander Couzens | 8950870 | 2018-07-31 04:16:10 +0200 | [diff] [blame] | 179 | private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdentificationV { |
Alexander Couzens | c7dddbd | 2019-04-11 19:18:35 +0200 | [diff] [blame] | 180 | /* mcc_mnc is encoded as of 24.008 10.5.5.15 */ |
Alexander Couzens | 8950870 | 2018-07-31 04:16:10 +0200 | [diff] [blame] | 181 | var BcdMccMnc mcc_mnc := cell_id.ra_id.lai.mcc_mnc; |
| 182 | |
| 183 | var RoutingAreaIdentificationV ret := { |
| 184 | mccDigit1 := mcc_mnc[0], |
| 185 | mccDigit2 := mcc_mnc[1], |
| 186 | mccDigit3 := mcc_mnc[2], |
Alexander Couzens | c7dddbd | 2019-04-11 19:18:35 +0200 | [diff] [blame] | 187 | mncDigit3 := mcc_mnc[3], |
| 188 | mncDigit1 := mcc_mnc[4], |
| 189 | mncDigit2 := mcc_mnc[5], |
Alexander Couzens | 8950870 | 2018-07-31 04:16:10 +0200 | [diff] [blame] | 190 | lac := int2oct(cell_id.ra_id.lai.lac, 16), |
| 191 | rac := int2oct(cell_id.ra_id.rac, 8) |
| 192 | } |
| 193 | return ret; |
| 194 | }; |
| 195 | |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 196 | private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT { |
| 197 | gb.vc_NS := NS_CT.create(id & "-NS" & int2str(offset)); |
| 198 | gb.vc_BSSGP := BSSGP_CT.create(id & "-BSSGP" & int2str(offset)); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 199 | /* connect lower end of BSSGP emulation with NS upper port */ |
| 200 | connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP); |
| 201 | /* connect lower end of NS emulation to NS codec port (on top of IPL4) */ |
| 202 | map(gb.vc_NS:NSCP, system:NS_CODEC_PORT); |
| 203 | |
Alexander Couzens | f3c1b41 | 2018-08-24 00:42:51 +0200 | [diff] [blame] | 204 | gb.vc_NS.start(NSStart(mp_nsconfig[offset])); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 205 | gb.vc_BSSGP.start(BssgpStart(gb.cfg)); |
| 206 | } |
| 207 | |
| 208 | private function f_init_gsup(charstring id) runs on test_CT { |
| 209 | id := id & "-GSUP"; |
| 210 | var GsupOps ops := { |
| 211 | create_cb := refers(GSUP_Emulation.ExpectedCreateCallback) |
| 212 | }; |
| 213 | |
| 214 | vc_GSUP_IPA := IPA_Emulation_CT.create(id & "-IPA"); |
| 215 | vc_GSUP := GSUP_Emulation_CT.create(id); |
| 216 | |
| 217 | map(vc_GSUP_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 218 | connect(vc_GSUP:GSUP, vc_GSUP_IPA:IPA_GSUP_PORT); |
| 219 | /* we use this hack to get events like ASP_IPA_EVENT_UP */ |
| 220 | connect(vc_GSUP_IPA:IPA_CTRL_PORT, self:GSUP_IPA_EVENT); |
| 221 | |
| 222 | vc_GSUP.start(GSUP_Emulation.main(ops, id)); |
| 223 | vc_GSUP_IPA.start(IPA_Emulation.main_server(mp_hlr_ip, mp_hlr_port)); |
| 224 | |
| 225 | /* wait for incoming connection to GSUP port before proceeding */ |
| 226 | timer T := 10.0; |
| 227 | T.start; |
| 228 | alt { |
| 229 | [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { } |
| 230 | [] T.timeout { |
| 231 | setverdict(fail, "No connection to GSUP Port"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 232 | mtc.stop; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 237 | private function f_init_gtp(charstring id) runs on test_CT { |
| 238 | id := id & "-GTP"; |
| 239 | |
| 240 | var GtpEmulationCfg gtp_cfg := { |
| 241 | gtpc_bind_ip := mp_ggsn_ip, |
| 242 | gtpc_bind_port := GTP1C_PORT, |
| 243 | gtpu_bind_ip := mp_ggsn_ip, |
| 244 | gtpu_bind_port := GTP1U_PORT, |
| 245 | sgsn_role := false |
| 246 | }; |
| 247 | |
| 248 | vc_GTP := GTP_Emulation_CT.create(id); |
| 249 | vc_GTP.start(GTP_Emulation.main(gtp_cfg)); |
| 250 | } |
| 251 | |
Harald Welte | bd19472 | 2018-02-16 22:11:08 +0100 | [diff] [blame] | 252 | private function f_init_vty() runs on test_CT { |
| 253 | map(self:SGSNVTY, system:SGSNVTY); |
| 254 | f_vty_set_prompts(SGSNVTY); |
| 255 | f_vty_transceive(SGSNVTY, "enable"); |
Alexander Couzens | 1d1744f | 2018-08-07 11:56:14 +0200 | [diff] [blame] | 256 | f_vty_transceive(SGSNVTY, "reset sgsn state"); |
Harald Welte | bd19472 | 2018-02-16 22:11:08 +0100 | [diff] [blame] | 257 | f_vty_config(SGSNVTY, "sgsn", "auth-policy remote"); |
| 258 | } |
| 259 | |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 260 | private function f_vty_enable_echo_interval(boolean enable) runs on test_CT { |
| 261 | if (enable) { |
| 262 | f_vty_config(SGSNVTY, "sgsn", "ggsn 0 echo-interval 5"); |
| 263 | } else { |
| 264 | f_vty_config(SGSNVTY, "sgsn", "ggsn 0 no echo-interval"); |
| 265 | } |
| 266 | } |
| 267 | |
Harald Welte | bd19472 | 2018-02-16 22:11:08 +0100 | [diff] [blame] | 268 | |
Alexander Couzens | c7dddbd | 2019-04-11 19:18:35 +0200 | [diff] [blame] | 269 | /* mcc_mnc is 24.008 10.5.5.15 encoded. 262 42 */ |
| 270 | function f_init(BcdMccMnc mcc_mnc := '262F42'H) runs on test_CT { |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 271 | var integer i; |
| 272 | |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 273 | if (g_initialized == true) { |
| 274 | return; |
| 275 | } |
| 276 | g_initialized := true; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 277 | g_gb[0].cfg := { |
| 278 | nsei := 96, |
| 279 | bvci := 196, |
| 280 | cell_id := { |
| 281 | ra_id := { |
| 282 | lai := { |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 283 | mcc_mnc := mcc_mnc, lac := 13135}, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 284 | rac := 0 |
| 285 | }, |
| 286 | cell_id := 20960 |
| 287 | }, |
| 288 | sgsn_role := false |
| 289 | }; |
Alexander Couzens | 5e2ba75 | 2018-07-03 15:13:07 +0200 | [diff] [blame] | 290 | g_gb[1].cfg := { |
| 291 | nsei := 97, |
| 292 | bvci := 210, |
| 293 | cell_id := { |
| 294 | ra_id := { |
| 295 | lai := { |
| 296 | mcc_mnc := mcc_mnc, lac := 13200}, |
| 297 | rac := 0 |
| 298 | }, |
| 299 | cell_id := 20961 |
| 300 | }, |
| 301 | sgsn_role := false |
| 302 | }; |
| 303 | g_gb[2].cfg := { |
| 304 | nsei := 98, |
| 305 | bvci := 220, |
| 306 | cell_id := { |
| 307 | ra_id := { |
| 308 | lai := { |
| 309 | mcc_mnc := mcc_mnc, lac := 13300}, |
| 310 | rac := 0 |
| 311 | }, |
| 312 | cell_id := 20962 |
| 313 | }, |
| 314 | sgsn_role := false |
| 315 | }; |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 316 | |
Alexander Couzens | 1d1744f | 2018-08-07 11:56:14 +0200 | [diff] [blame] | 317 | f_init_vty(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 318 | f_init_gb(g_gb[0], "SGSN_Test-Gb0", 0); |
| 319 | f_init_gb(g_gb[1], "SGSN_Test-Gb1", 1); |
| 320 | f_init_gb(g_gb[2], "SGSN_Test-Gb2", 2); |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 321 | |
| 322 | for (i := 0; i < NUM_RNC; i := i+1) { |
| 323 | f_ran_adapter_init(g_ranap[i], mp_ranap_cfg[i], "SGSN_Test_" & int2str(i), RNC_RanOps); |
| 324 | f_ran_adapter_start(g_ranap[i]); |
| 325 | } |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 326 | f_init_gsup("SGSN_Test"); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 327 | f_init_gtp("SGSN_Test"); |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 328 | f_vty_enable_echo_interval(g_use_echo); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 329 | } |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 330 | |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 331 | private function RncUnitdataCallback(RANAP_PDU ranap) |
| 332 | runs on RAN_Emulation_CT return template RANAP_PDU { |
| 333 | var template RANAP_PDU resp := omit; |
| 334 | |
| 335 | log ("RANAP_RncUnitDataCallback"); |
| 336 | /* answer all RESET with RESET ACK */ |
| 337 | if (match(ranap, tr_RANAP_Reset)) { |
| 338 | log("RANAP_RncUnitdataCallback: Responding to RESET with RESET-ACK"); |
| 339 | var CN_DomainIndicator dom; |
| 340 | dom := ranap.initiatingMessage.value_.Reset.protocolIEs[1].value_.cN_DomainIndicator; |
| 341 | resp := ts_RANAP_ResetAck(dom); |
| 342 | } |
| 343 | return resp; |
| 344 | } |
| 345 | |
| 346 | const RanOps RNC_RanOps := { |
| 347 | ranap_create_cb := refers(RAN_Emulation.RanapExpectedCreateCallback), |
| 348 | ranap_unitdata_cb := refers(RncUnitdataCallback), |
| 349 | ps_domain := true, |
| 350 | decode_dtap := true, |
| 351 | role_ms := true, |
| 352 | protocol := RAN_PROTOCOL_RANAP, |
| 353 | transport := RANAP_TRANSPORT_IuCS, |
| 354 | use_osmux := false, |
| 355 | sccp_addr_local := omit, |
| 356 | sccp_addr_peer := omit |
| 357 | }; |
| 358 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 359 | type function void_fn(charstring id) runs on BSSGP_ConnHdlr; |
| 360 | |
| 361 | /* helper function to create, connect and start a BSSGP_ConnHdlr component */ |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 362 | function f_start_handler(void_fn fn, charstring id, GbInstances gb, integer imsi_suffix, |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 363 | float t_guard := 30.0) |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 364 | runs on test_CT return BSSGP_ConnHdlr { |
| 365 | var BSSGP_ConnHdlr vc_conn; |
| 366 | var SGSN_ConnHdlrNetworkPars net_pars := { |
| 367 | expect_ptmsi := true, |
| 368 | expect_auth := true, |
| 369 | expect_ciph := false |
| 370 | }; |
| 371 | var BSSGP_ConnHdlrPars pars := { |
| 372 | imei := f_gen_imei(imsi_suffix), |
| 373 | imsi := f_gen_imsi(imsi_suffix), |
| 374 | msisdn := f_gen_msisdn(imsi_suffix), |
| 375 | p_tmsi := omit, |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 376 | p_tmsi_sig := omit, |
Harald Welte | 14a0f94 | 2018-02-16 20:42:23 +0100 | [diff] [blame] | 377 | tlli := f_gprs_tlli_random(), |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 378 | tlli_old := omit, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 379 | ra := omit, |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 380 | bssgp_cell_id := { gb[0].cfg.cell_id, gb[1].cfg.cell_id, gb[2].cfg.cell_id }, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 381 | vec := omit, |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 382 | net := net_pars, |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 383 | t_guard := t_guard, |
| 384 | sccp_addr_local := g_ranap[0].sccp_addr_own, |
| 385 | sccp_addr_peer := g_ranap[0].sccp_addr_peer |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 386 | }; |
| 387 | |
| 388 | vc_conn := BSSGP_ConnHdlr.create(id); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 389 | connect(vc_conn:BSSGP[0], gb[0].vc_BSSGP:BSSGP_SP); |
| 390 | connect(vc_conn:BSSGP_PROC[0], gb[0].vc_BSSGP:BSSGP_PROC); |
| 391 | connect(vc_conn:BSSGP[1], gb[1].vc_BSSGP:BSSGP_SP); |
| 392 | connect(vc_conn:BSSGP_PROC[1], gb[1].vc_BSSGP:BSSGP_PROC); |
| 393 | connect(vc_conn:BSSGP[2], gb[2].vc_BSSGP:BSSGP_SP); |
| 394 | connect(vc_conn:BSSGP_PROC[2], gb[2].vc_BSSGP:BSSGP_PROC); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 395 | |
Harald Welte | 26fbb6e | 2019-04-14 17:32:46 +0200 | [diff] [blame^] | 396 | /* FIXME: support multiple RNCs */ |
| 397 | connect(vc_conn:BSSAP, g_ranap[0].vc_RAN:CLIENT); |
| 398 | connect(vc_conn:BSSAP_PROC, g_ranap[0].vc_RAN:PROC); |
| 399 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 400 | connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT); |
| 401 | connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC); |
| 402 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 403 | connect(vc_conn:GTP, vc_GTP:CLIENT); |
| 404 | connect(vc_conn:GTP_PROC, vc_GTP:CLIENT_PROC); |
| 405 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 406 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 407 | return vc_conn; |
| 408 | } |
| 409 | |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 410 | private altstep as_Tguard() runs on BSSGP_ConnHdlr { |
| 411 | [] g_Tguard.timeout { |
| 412 | setverdict(fail, "Tguard timeout"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 413 | mtc.stop; |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 414 | } |
| 415 | } |
| 416 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 417 | /* first function called in every ConnHdlr */ |
| 418 | private function f_handler_init(void_fn fn, charstring id, BSSGP_ConnHdlrPars pars) |
| 419 | runs on BSSGP_ConnHdlr { |
| 420 | /* do some common stuff like setting up g_pars */ |
| 421 | g_pars := pars; |
| 422 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 423 | llc := f_llc_create(false); |
| 424 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 425 | /* register with BSSGP core */ |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 426 | f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 427 | /* tell GSUP dispatcher to send this IMSI to us */ |
| 428 | f_create_gsup_expect(hex2str(g_pars.imsi)); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 429 | /* tell GTP dispatcher to send this IMSI to us */ |
| 430 | f_gtp_register_imsi(g_pars.imsi); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 431 | |
Harald Welte | 62e2958 | 2018-02-16 21:17:11 +0100 | [diff] [blame] | 432 | g_Tguard.start(pars.t_guard); |
| 433 | activate(as_Tguard()); |
| 434 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 435 | /* call the user-supplied test case function */ |
| 436 | fn.apply(id); |
| 437 | f_bssgp_client_unregister(g_pars.imsi); |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 438 | } |
| 439 | |
| 440 | /* TODO: |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 441 | * Detach without Attach |
| 442 | * SM procedures without attach / RAU |
| 443 | * ATTACH / RAU |
| 444 | ** with / without authentication |
| 445 | ** with / without P-TMSI allocation |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 446 | * re-transmissions of LLC frames |
| 447 | * PDP Context activation |
| 448 | ** with different GGSN config in SGSN VTY |
| 449 | ** with different PDP context type (v4/v6/v46) |
| 450 | ** timeout from GGSN |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 451 | ** multiple / secondary PDP context |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 452 | */ |
| 453 | |
| 454 | testcase TC_wait_ns_up() runs on test_CT { |
| 455 | f_init(); |
| 456 | f_sleep(20.0); |
| 457 | } |
| 458 | |
Harald Welte | a05b807 | 2019-04-23 22:35:05 +0200 | [diff] [blame] | 459 | function f_send_llc(template (value) PDU_LLC llc_pdu, integer gb_index := 0) runs on BSSGP_ConnHdlr { |
| 460 | var octetstring llc_enc := enc_PDU_LLC(valueof(llc_pdu)); |
| 461 | BSSGP[gb_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[gb_index], llc_enc)); |
| 462 | } |
| 463 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 464 | function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 0) runs on BSSGP_ConnHdlr { |
| 465 | var octetstring l3_enc := enc_PDU_L3_MS_SGSN(valueof(l3_mo)); |
| 466 | var BIT4 sapi := f_llc_sapi_by_l3_mo(valueof(l3_mo)); |
| 467 | var integer n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]); |
Alexander Couzens | ad35222 | 2019-05-11 02:06:04 +0200 | [diff] [blame] | 468 | f_send_llc(ts_LLC_UI(l3_enc, sapi, '0'B, n_u), gb_index); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 469 | } |
| 470 | |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 471 | altstep as_mm_identity(integer gb_idx := 0) runs on BSSGP_ConnHdlr { |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 472 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 473 | [] BSSGP[gb_idx].receive(tr_GMM_ID_REQ('001'B)) { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 474 | mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 475 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 476 | repeat; |
| 477 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 478 | [] BSSGP[gb_idx].receive(tr_GMM_ID_REQ('010'B)) { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 479 | mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 480 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 481 | repeat; |
| 482 | } |
| 483 | } |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 484 | |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 485 | /* receive a L3 (GMM/SM) message over whatever is the appropriate lower-layer bearer */ |
| 486 | function f_receive_l3(template PDU_L3_SGSN_MS rx_tpl := ?, integer gb_idx := 0) |
| 487 | runs on BSSGP_ConnHdlr return PDU_L3_SGSN_MS { |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 488 | var PDU_L3_SGSN_MS l3_mt; |
| 489 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 490 | [] BSSGP[gb_idx].receive(rx_tpl) -> value l3_mt { } |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 491 | } |
| 492 | return l3_mt; |
| 493 | } |
| 494 | |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 495 | /* perform GMM authentication (if expected). |
| 496 | * Note, for umts_aka_challenge to work, the revisionLevelIndicatior needs to |
| 497 | * be 1 to mark R99 capability, in the GMM Attach Request, see f_gmm_attach(). */ |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 498 | function f_gmm_auth (boolean umts_aka_challenge := false, boolean force_gsm_sres := false, integer gb_idx := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 499 | var PDU_L3_MS_SGSN l3_mo; |
| 500 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 501 | var default di := activate(as_mm_identity(gb_idx)); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 502 | if (g_pars.net.expect_auth) { |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 503 | var GSUP_IE auth_tuple; |
| 504 | var template AuthenticationParameterAUTNTLV autn; |
| 505 | |
| 506 | if (umts_aka_challenge) { |
| 507 | g_pars.vec := f_gen_auth_vec_3g(); |
| 508 | autn := { |
| 509 | elementIdentifier := '28'O, |
| 510 | lengthIndicator := lengthof(g_pars.vec.autn), |
| 511 | autnValue := g_pars.vec.autn |
| 512 | }; |
| 513 | |
| 514 | auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand, |
| 515 | g_pars.vec.sres, |
| 516 | g_pars.vec.kc, |
| 517 | g_pars.vec.ik, |
| 518 | g_pars.vec.ck, |
| 519 | g_pars.vec.autn, |
| 520 | g_pars.vec.res)); |
| 521 | log("GSUP sends 2G and 3G auth tuples", auth_tuple); |
| 522 | } else { |
| 523 | g_pars.vec := f_gen_auth_vec_2g(); |
| 524 | autn := omit; |
| 525 | auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(g_pars.vec.rand, |
| 526 | g_pars.vec.sres, |
| 527 | g_pars.vec.kc)); |
| 528 | log("GSUP sends only 2G auth tuple", auth_tuple); |
| 529 | } |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 530 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 531 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 532 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 533 | |
| 534 | var template PDU_L3_SGSN_MS auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand); |
| 535 | auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn; |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 536 | l3_mt := f_receive_l3(auth_ciph_req, gb_idx); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 537 | var BIT4 ac_ref := l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.acReferenceNumber.valueField; |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 538 | var template PDU_L3_MS_SGSN auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres); |
| 539 | |
| 540 | if (umts_aka_challenge and not force_gsm_sres) { |
| 541 | /* set UMTS response instead */ |
| 542 | auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationParResp := { |
| 543 | valueField := substr(g_pars.vec.res, 0, 4) |
| 544 | }; |
| 545 | auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationRespParExt := { |
| 546 | elementIdentifier := '21'O, |
| 547 | lengthIndicator := lengthof(g_pars.vec.res) - 4, |
| 548 | valueField := substr(g_pars.vec.res, 4, lengthof(g_pars.vec.res) - 4) |
| 549 | }; |
| 550 | } |
| 551 | |
| 552 | l3_mo := valueof(auth_ciph_resp); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 553 | if (ispresent(l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest) and |
| 554 | l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest.valueField == '001'B) { |
| 555 | l3_mo.msgs.gprs_mm.authenticationAndCipheringResponse.imeisv := |
| 556 | valueof(ts_MI_IMEISV_TLV(g_pars.imei & '0'H)); |
| 557 | } |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 558 | f_send_l3_gmm_llc(l3_mo, gb_idx); |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 559 | } else { |
| 560 | /* wait for identity procedure */ |
| 561 | f_sleep(1.0); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 562 | } |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 563 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 564 | deactivate(di); |
| 565 | } |
| 566 | |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 567 | function f_upd_ptmsi_and_tlli(OCT4 p_tmsi, integer bssgp_index := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 568 | g_pars.p_tmsi := p_tmsi; |
| 569 | /* update TLLI */ |
| 570 | g_pars.tlli_old := g_pars.tlli; |
| 571 | g_pars.tlli := g_pars.p_tmsi or4b 'c0000000'O; |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 572 | f_bssgp_client_llgmm_assign(g_pars.tlli_old, g_pars.tlli, BSSGP_PROC[bssgp_index]); |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 573 | } |
| 574 | |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 575 | function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr { |
| 576 | /* mandatory IE */ |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 577 | var hexstring aa_plmn := f_RAI_to_plmn_hexstr(aa.routingAreaIdentification); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 578 | if (not (g_pars.bssgp_cell_id[0].ra_id.lai.mcc_mnc == aa_plmn)) { |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 579 | setverdict(fail, "mismatching PLMN in Attach Accept: " & hex2str(aa_plmn) |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 580 | & "; expected " & hex2str(g_pars.bssgp_cell_id[0].ra_id.lai.mcc_mnc)); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 581 | mtc.stop; |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 582 | } |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 583 | g_pars.ra := aa.routingAreaIdentification; |
| 584 | if (ispresent(aa.allocatedPTMSI)) { |
| 585 | if (not g_pars.net.expect_ptmsi) { |
| 586 | setverdict(fail, "unexpected P-TMSI allocation"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 587 | mtc.stop; |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 588 | } |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 589 | f_upd_ptmsi_and_tlli(aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 590 | } |
| 591 | if (ispresent(aa.msIdentity)) { |
| 592 | setverdict(fail, "unexpected TMSI allocation in non-combined attach"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 593 | mtc.stop; |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 594 | } |
| 595 | /* P-TMSI.sig */ |
| 596 | if (ispresent(aa.ptmsiSignature)) { |
| 597 | g_pars.p_tmsi_sig := aa.ptmsiSignature.valueField; |
| 598 | } |
| 599 | /* updateTimer */ |
| 600 | // aa.readyTimer |
| 601 | /* T3302, T3319, T3323, T3312_ext, T3324 */ |
| 602 | } |
| 603 | |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 604 | function f_process_rau_accept(PDU_GMM_RoutingAreaUpdateAccept ra, integer bssgp_index := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 605 | /* mandatory IE */ |
| 606 | g_pars.ra := ra.routingAreaId; |
| 607 | if (ispresent(ra.allocatedPTMSI)) { |
| 608 | if (not g_pars.net.expect_ptmsi) { |
| 609 | setverdict(fail, "unexpected P-TMSI allocation"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 610 | mtc.stop; |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 611 | } |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 612 | f_upd_ptmsi_and_tlli(ra.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets, bssgp_index); |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 613 | } |
| 614 | if (ispresent(ra.msIdentity)) { |
| 615 | setverdict(fail, "unexpected TMSI allocation in non-combined attach"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 616 | mtc.stop; |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 617 | } |
| 618 | /* P-TMSI.sig */ |
| 619 | if (ispresent(ra.ptmsiSignature)) { |
| 620 | g_pars.p_tmsi_sig := ra.ptmsiSignature.valueField; |
| 621 | } |
| 622 | /* updateTimer */ |
| 623 | // aa.readyTimer |
| 624 | /* T3302, T3319, T3323, T3312_ext, T3324 */ |
| 625 | } |
| 626 | |
| 627 | |
Harald Welte | 5a4fa04 | 2018-02-16 20:59:21 +0100 | [diff] [blame] | 628 | function f_random_RAI(HEX0_3n mcc := '262'H, HEX0_3n mnc := '42'H) return RoutingAreaIdentificationV { |
| 629 | return f_RAI(mcc, mnc, f_rnd_octstring(2), f_rnd_octstring(1)); |
| 630 | } |
| 631 | |
Harald Welte | 23178c5 | 2018-02-17 09:36:33 +0100 | [diff] [blame] | 632 | /* return a MobileIdentityLV: P-TMSI if we have one, IMSI otherwise */ |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 633 | private function f_mi_get_lv() runs on BSSGP_ConnHdlr return MobileL3_CommonIE_Types.MobileIdentityLV { |
Harald Welte | 23178c5 | 2018-02-17 09:36:33 +0100 | [diff] [blame] | 634 | if (ispresent(g_pars.p_tmsi)) { |
| 635 | return valueof(ts_MI_TMSI_LV(g_pars.p_tmsi)); |
| 636 | } else { |
| 637 | return valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 638 | } |
| 639 | } |
| 640 | |
Harald Welte | 311ec27 | 2018-02-17 09:40:03 +0100 | [diff] [blame] | 641 | private function f_gmm_gsup_lu_isd() runs on BSSGP_ConnHdlr { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 642 | var GSUP_PDU gsup; |
Harald Welte | 311ec27 | 2018-02-17 09:40:03 +0100 | [diff] [blame] | 643 | /* Expect MSC to perform LU with HLR */ |
| 644 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 645 | gsup := valueof(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn)); |
| 646 | gsup.ies := gsup.ies & { valueof(ts_GSUP_IE_PdpInfo(char2oct("*"), '0121'O, ''O)) }; |
| 647 | GSUP.send(gsup); |
Harald Welte | 311ec27 | 2018-02-17 09:40:03 +0100 | [diff] [blame] | 648 | GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); |
| 649 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 650 | } |
| 651 | |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 652 | friend function f_gmm_attach(boolean umts_aka_challenge, boolean force_gsm_sres, integer gb_idx := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 5a4fa04 | 2018-02-16 20:59:21 +0100 | [diff] [blame] | 653 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 654 | var template PDU_L3_MS_SGSN attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit); |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 655 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 656 | |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 657 | /* indicate R99 capability of the MS to enable UMTS AKA in presence of |
| 658 | * 3G auth vectors */ |
| 659 | attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.revisionLevelIndicatior := '1'B; |
| 660 | /* The thing is, if the solSACapability is 'omit', then the |
| 661 | * revisionLevelIndicatior is at the wrong place! */ |
| 662 | attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.solSACapability := '0'B; |
| 663 | |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 664 | f_send_l3_gmm_llc(attach_req, gb_idx); |
| 665 | f_gmm_auth(umts_aka_challenge, force_gsm_sres, gb_idx); |
Alexander Couzens | 5844d5b | 2018-05-14 06:30:56 +0200 | [diff] [blame] | 666 | /* Expect SGSN to perform LU with HLR */ |
Harald Welte | 311ec27 | 2018-02-17 09:40:03 +0100 | [diff] [blame] | 667 | f_gmm_gsup_lu_isd(); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 668 | |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 669 | l3_mt := f_receive_l3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?), gb_idx); |
| 670 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
| 671 | |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 672 | /* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */ |
Harald Welte | ca36246 | 2019-05-02 20:11:21 +0200 | [diff] [blame] | 673 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL, gb_idx); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | private function f_TC_attach(charstring id) runs on BSSGP_ConnHdlr { |
| 677 | f_gmm_attach(false, false); |
Harald Welte | 5a4fa04 | 2018-02-16 20:59:21 +0100 | [diff] [blame] | 678 | setverdict(pass); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | testcase TC_attach() runs on test_CT { |
| 682 | var BSSGP_ConnHdlr vc_conn; |
| 683 | f_init(); |
| 684 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 685 | vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 686 | vc_conn.done; |
| 687 | } |
| 688 | |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 689 | testcase TC_attach_mnc3() runs on test_CT { |
| 690 | var BSSGP_ConnHdlr vc_conn; |
| 691 | f_init('023042'H); |
| 692 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 693 | vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1001); |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 694 | vc_conn.done; |
| 695 | } |
| 696 | |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 697 | private function f_TC_attach_umts_aka_umts_res(charstring id) runs on BSSGP_ConnHdlr { |
| 698 | f_gmm_attach(true, false); |
| 699 | setverdict(pass); |
| 700 | } |
| 701 | testcase TC_attach_umts_aka_umts_res() runs on test_CT { |
| 702 | var BSSGP_ConnHdlr vc_conn; |
| 703 | f_init(); |
| 704 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 705 | vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_umts_res), testcasename(), g_gb, 1002); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 706 | vc_conn.done; |
| 707 | } |
| 708 | |
| 709 | private function f_TC_attach_umts_aka_gsm_sres(charstring id) runs on BSSGP_ConnHdlr { |
| 710 | f_gmm_attach(true, true); |
| 711 | setverdict(pass); |
| 712 | } |
| 713 | testcase TC_attach_umts_aka_gsm_sres() runs on test_CT { |
| 714 | var BSSGP_ConnHdlr vc_conn; |
| 715 | f_init(); |
| 716 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 717 | vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_gsm_sres), testcasename(), g_gb, 1003); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 718 | vc_conn.done; |
| 719 | } |
| 720 | |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 721 | /* MS never responds to ID REQ, expect ATTACH REJECT */ |
| 722 | private function f_TC_attach_auth_id_timeout(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 723 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 724 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 725 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 726 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 727 | [] BSSGP[0].receive(tr_GMM_ID_REQ(?)) { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 728 | /* don't send ID Response */ |
| 729 | repeat; |
| 730 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 731 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT('09'O)) { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 732 | setverdict(pass); |
| 733 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 734 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 735 | setverdict(fail, "Wrong Attach Reject Cause"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 736 | mtc.stop; |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 737 | } |
| 738 | } |
| 739 | } |
| 740 | testcase TC_attach_auth_id_timeout() runs on test_CT { |
| 741 | var BSSGP_ConnHdlr vc_conn; |
| 742 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 743 | vc_conn := f_start_handler(refers(f_TC_attach_auth_id_timeout), testcasename(), g_gb, 2, 40.0); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 744 | vc_conn.done; |
| 745 | } |
| 746 | |
| 747 | /* HLR never responds to SAI REQ, expect ATTACH REJECT */ |
| 748 | private function f_TC_attach_auth_sai_timeout(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 749 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 750 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 751 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 752 | alt { |
| 753 | [] as_mm_identity(); |
| 754 | [] GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); { } |
| 755 | } |
| 756 | /* don't send SAI-response from HLR */ |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 757 | BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 758 | setverdict(pass); |
| 759 | } |
| 760 | testcase TC_attach_auth_sai_timeout() runs on test_CT { |
| 761 | var BSSGP_ConnHdlr vc_conn; |
| 762 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 763 | vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_timeout), testcasename(), g_gb, 3); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 764 | vc_conn.done; |
| 765 | } |
| 766 | |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 767 | /* HLR rejects SAI, expect ATTACH REJECT */ |
| 768 | private function f_TC_attach_auth_sai_reject(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 769 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 770 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 771 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 772 | alt { |
| 773 | [] as_mm_identity(); |
| 774 | [] GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); { |
| 775 | GSUP.send(ts_GSUP_SAI_ERR(g_pars.imsi, 23)); |
| 776 | } |
| 777 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 778 | BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)); |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 779 | setverdict(pass); |
| 780 | } |
| 781 | testcase TC_attach_auth_sai_reject() runs on test_CT { |
| 782 | var BSSGP_ConnHdlr vc_conn; |
| 783 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 784 | vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_reject), testcasename(), g_gb, 4); |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 785 | vc_conn.done; |
| 786 | } |
| 787 | |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 788 | /* HLR never responds to UL REQ, expect ATTACH REJECT */ |
| 789 | private function f_TC_attach_gsup_lu_timeout(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 790 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 791 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 792 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 793 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 794 | f_gmm_auth(); |
| 795 | /* Expect MSC to perform LU with HLR */ |
| 796 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)); |
| 797 | /* Never follow-up with ISD_REQ or UL_RES */ |
| 798 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 799 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 800 | setverdict(pass); |
| 801 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 802 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 803 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 804 | setverdict(fail); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 805 | mtc.stop; |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 806 | } |
| 807 | } |
| 808 | } |
| 809 | testcase TC_attach_gsup_lu_timeout() runs on test_CT { |
| 810 | var BSSGP_ConnHdlr vc_conn; |
| 811 | f_init(); |
| 812 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 813 | vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_timeout), testcasename(), g_gb, 5); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 814 | vc_conn.done; |
| 815 | } |
| 816 | |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 817 | /* HLR rejects UL REQ, expect ATTACH REJECT */ |
| 818 | private function f_TC_attach_gsup_lu_reject(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 819 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 820 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 821 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 822 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 823 | f_gmm_auth(); |
| 824 | /* Expect MSC to perform LU with HLR */ |
| 825 | GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) { |
| 826 | GSUP.send(ts_GSUP_UL_ERR(g_pars.imsi, 0)); |
| 827 | } |
| 828 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 829 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 830 | setverdict(pass); |
| 831 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 832 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 833 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 834 | setverdict(fail); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 835 | mtc.stop; |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 836 | } |
| 837 | } |
| 838 | } |
| 839 | testcase TC_attach_gsup_lu_reject() runs on test_CT { |
| 840 | var BSSGP_ConnHdlr vc_conn; |
| 841 | f_init(); |
| 842 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 843 | vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_reject), testcasename(), g_gb, 6); |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 844 | vc_conn.done; |
| 845 | } |
| 846 | |
| 847 | |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 848 | /* Attempt of combined GPRS + IMSI attach: network should ACK only GPRS attach */ |
| 849 | private function f_TC_attach_combined(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 850 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 851 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 852 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 853 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, true, false, omit, omit)); |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 854 | f_gmm_auth(); |
| 855 | /* Expect MSC to perform LU with HLR */ |
Harald Welte | 311ec27 | 2018-02-17 09:40:03 +0100 | [diff] [blame] | 856 | f_gmm_gsup_lu_isd(); |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 857 | |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 858 | BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 859 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 860 | } |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 861 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL); |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 862 | setverdict(pass); |
| 863 | } |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 864 | testcase TC_attach_combined() runs on test_CT { |
| 865 | var BSSGP_ConnHdlr vc_conn; |
| 866 | f_init(); |
| 867 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 868 | vc_conn := f_start_handler(refers(f_TC_attach_combined), testcasename(), g_gb, 7); |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 869 | vc_conn.done; |
| 870 | } |
| 871 | |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 872 | /* Attempt of GPRS ATTACH in 'accept all' mode */ |
| 873 | private function f_TC_attach_accept_all(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 874 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 875 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 876 | |
| 877 | g_pars.net.expect_auth := false; |
| 878 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 879 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 880 | f_gmm_auth(); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 881 | BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 882 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 883 | } |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 884 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL); |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 885 | setverdict(pass); |
| 886 | } |
| 887 | testcase TC_attach_accept_all() runs on test_CT { |
| 888 | var BSSGP_ConnHdlr vc_conn; |
| 889 | f_init(); |
| 890 | f_sleep(1.0); |
| 891 | f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all"); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 892 | vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 8); |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 893 | vc_conn.done; |
| 894 | } |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 895 | |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 896 | /* Attempt of GPRS ATTACH in 'accept all' mode */ |
| 897 | private function f_TC_attach_closed_foreign(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 898 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 899 | |
| 900 | /* Simulate a foreign IMSI */ |
| 901 | g_pars.imsi := '001010123456789'H; |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 902 | f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]); |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 903 | |
| 904 | g_pars.net.expect_auth := false; |
| 905 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 906 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 907 | alt { |
| 908 | [] as_mm_identity(); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 909 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT('07'O)) { |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 910 | setverdict(pass); |
| 911 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 912 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 913 | setverdict(pass); |
| 914 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 915 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT(*, *, *)) { |
Alexander Couzens | 0ca0d9c | 2018-06-12 14:01:34 +0200 | [diff] [blame] | 916 | setverdict(fail); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 917 | mtc.stop; |
Alexander Couzens | 0ca0d9c | 2018-06-12 14:01:34 +0200 | [diff] [blame] | 918 | } |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 919 | } |
| 920 | } |
| 921 | testcase TC_attach_closed() runs on test_CT { |
| 922 | var BSSGP_ConnHdlr vc_conn; |
| 923 | f_init(); |
| 924 | f_sleep(1.0); |
| 925 | f_vty_config(SGSNVTY, "sgsn", "auth-policy closed"); |
| 926 | /* test with foreign IMSI: Must Reject */ |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 927 | vc_conn := f_start_handler(refers(f_TC_attach_closed_foreign), testcasename(), g_gb, 9); |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 928 | vc_conn.done; |
| 929 | /* test with home IMSI: Must Accept */ |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 930 | vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 10); |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 931 | vc_conn.done; |
| 932 | } |
| 933 | |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 934 | /* Routing Area Update from Unknown TLLI -> REJECT */ |
| 935 | private function f_TC_rau_unknown(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 936 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 937 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 938 | f_send_l3_gmm_llc(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, old_ra, false, omit, omit)); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 939 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 940 | [] BSSGP[0].receive(tr_GMM_RAU_REJECT('0a'O)) { |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 941 | setverdict(pass); |
| 942 | } |
| 943 | /* FIXME: Expect XID RESET? */ |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 944 | [] BSSGP[0].receive { repeat; } |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 945 | } |
| 946 | } |
| 947 | testcase TC_rau_unknown() runs on test_CT { |
| 948 | var BSSGP_ConnHdlr vc_conn; |
| 949 | f_init(); |
| 950 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 951 | vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb, 11); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 952 | vc_conn.done; |
| 953 | } |
| 954 | |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 955 | private function f_TC_attach_rau(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 956 | /* first perform regular attach */ |
| 957 | f_TC_attach(id); |
| 958 | |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 959 | f_routing_area_update(g_pars.ra); |
| 960 | |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 961 | } |
| 962 | testcase TC_attach_rau() runs on test_CT { |
| 963 | var BSSGP_ConnHdlr vc_conn; |
| 964 | f_init(); |
| 965 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 966 | vc_conn := f_start_handler(refers(f_TC_attach_rau), testcasename(), g_gb, 12); |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 967 | vc_conn.done; |
| 968 | } |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 969 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 970 | /* general GPRS DETACH helper */ |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 971 | function f_detach_mo(BIT3 detach_type, boolean power_off, boolean expect_purge, integer bssgp_index := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 972 | var PDU_L3_SGSN_MS l3_mt; |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 973 | timer T := 5.0; |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 974 | f_send_l3_gmm_llc(ts_GMM_DET_REQ_MO(detach_type, power_off), bssgp_index); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 975 | if (expect_purge) { |
| 976 | GSUP.receive(tr_GSUP_PURGE_MS_REQ(g_pars.imsi, OSMO_GSUP_CN_DOMAIN_PS)); |
| 977 | GSUP.send(ts_GSUP_PURGE_MS_RES(g_pars.imsi)); |
| 978 | } |
| 979 | T.start; |
| 980 | alt { |
| 981 | [not expect_purge] GSUP.receive(tr_GSUP_PURGE_MS_REQ(?)) { |
| 982 | setverdict(fail, "Unexpected GSUP PURGE MS for unregistered TLLI"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 983 | mtc.stop; |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 984 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 985 | [power_off] BSSGP[bssgp_index].receive(tr_GMM_DET_ACCEPT_MT) -> value l3_mt { |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 986 | g_pars.ra := omit; |
Alexander Couzens | 8e0fd46 | 2019-05-11 01:20:55 +0200 | [diff] [blame] | 987 | setverdict(fail, "Unexpected DETACH ACCEPT in power-off DETACH"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 988 | mtc.stop; |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 989 | /* TODO: check if any PDP contexts are deactivated on network side? */ |
| 990 | } |
| 991 | [power_off] T.timeout { |
| 992 | setverdict(pass); |
| 993 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 994 | [not power_off] BSSGP[bssgp_index].receive(tr_GMM_DET_ACCEPT_MT) -> value l3_mt { |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 995 | g_pars.ra := omit; |
| 996 | setverdict(pass); |
| 997 | /* TODO: check if any PDP contexts are deactivated on network side? */ |
| 998 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 999 | [] BSSGP[bssgp_index].receive(PDU_L3_SGSN_MS:?) -> value l3_mt { |
Alexander Couzens | 4630e74 | 2019-05-11 01:50:10 +0200 | [diff] [blame] | 1000 | if (power_off) { |
| 1001 | setverdict(fail, "Unexpected Layer 3 package received in power-off DETACH"); |
| 1002 | } else { |
| 1003 | setverdict(fail, "Unexpected Layer 3 package received in normal DETACH"); |
| 1004 | } |
| 1005 | mtc.stop; |
| 1006 | } |
Alexander Couzens | 90fe6a2 | 2018-07-31 19:37:32 +0200 | [diff] [blame] | 1007 | [] BSSGP[bssgp_index].receive { repeat; } |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1008 | } |
| 1009 | } |
| 1010 | |
| 1011 | /* IMSI DETACH (non-power-off) for unknown TLLI */ |
| 1012 | private function f_TC_detach_unknown_nopoweroff(charstring id) runs on BSSGP_ConnHdlr { |
| 1013 | f_detach_mo(c_GMM_DTT_MO_GPRS, false, false); |
| 1014 | } |
| 1015 | testcase TC_detach_unknown_nopoweroff() runs on test_CT { |
| 1016 | var BSSGP_ConnHdlr vc_conn; |
| 1017 | f_init(); |
| 1018 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1019 | vc_conn := f_start_handler(refers(f_TC_detach_unknown_nopoweroff), testcasename(), g_gb, 13); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1020 | vc_conn.done; |
| 1021 | } |
| 1022 | |
| 1023 | /* IMSI DETACH (power-off) for unknown TLLI */ |
| 1024 | private function f_TC_detach_unknown_poweroff(charstring id) runs on BSSGP_ConnHdlr { |
| 1025 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, false); |
| 1026 | } |
| 1027 | testcase TC_detach_unknown_poweroff() runs on test_CT { |
| 1028 | var BSSGP_ConnHdlr vc_conn; |
| 1029 | f_init(); |
| 1030 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1031 | vc_conn := f_start_handler(refers(f_TC_detach_unknown_poweroff), testcasename(), g_gb, 14); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1032 | vc_conn.done; |
| 1033 | } |
| 1034 | |
| 1035 | /* IMSI DETACH (non-power-off) for known TLLI */ |
| 1036 | private function f_TC_detach_nopoweroff(charstring id) runs on BSSGP_ConnHdlr { |
| 1037 | /* first perform regular attach */ |
| 1038 | f_TC_attach(id); |
| 1039 | |
| 1040 | f_detach_mo(c_GMM_DTT_MO_GPRS, false, true); |
| 1041 | } |
| 1042 | testcase TC_detach_nopoweroff() runs on test_CT { |
| 1043 | var BSSGP_ConnHdlr vc_conn; |
| 1044 | f_init(); |
| 1045 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1046 | vc_conn := f_start_handler(refers(f_TC_detach_nopoweroff), testcasename(), g_gb, 15); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1047 | vc_conn.done; |
| 1048 | } |
| 1049 | |
| 1050 | /* IMSI DETACH (power-off) for known TLLI */ |
| 1051 | private function f_TC_detach_poweroff(charstring id) runs on BSSGP_ConnHdlr { |
| 1052 | /* first perform regular attach */ |
| 1053 | f_TC_attach(id); |
| 1054 | |
| 1055 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, true); |
| 1056 | } |
| 1057 | testcase TC_detach_poweroff() runs on test_CT { |
| 1058 | var BSSGP_ConnHdlr vc_conn; |
| 1059 | f_init(); |
| 1060 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1061 | vc_conn := f_start_handler(refers(f_TC_detach_poweroff), testcasename(), g_gb, 16); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1062 | vc_conn.done; |
| 1063 | } |
| 1064 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1065 | type record PdpActPars { |
Harald Welte | 822f910 | 2018-02-18 20:39:06 +0100 | [diff] [blame] | 1066 | BIT3 tid, /* L3 Transaction ID */ |
| 1067 | BIT4 nsapi, /* SNDCP NSAPI */ |
| 1068 | BIT4 sapi, /* LLC SAPI */ |
| 1069 | QoSV qos, /* QoS parameters */ |
| 1070 | PDPAddressV addr, /* IP address */ |
| 1071 | octetstring apn optional, /* APN name */ |
| 1072 | ProtocolConfigOptionsV pco optional, /* protoco config opts */ |
| 1073 | OCT1 exp_rej_cause optional, /* expected SM reject cause */ |
Harald Welte | 1d6ae93 | 2018-02-18 21:24:44 +0100 | [diff] [blame] | 1074 | OCT1 gtp_resp_cause, /* GTP response cause */ |
Harald Welte | 822f910 | 2018-02-18 20:39:06 +0100 | [diff] [blame] | 1075 | OCT4 chg_id, /* GTP Charging Identifier */ |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 1076 | |
Harald Welte | 822f910 | 2018-02-18 20:39:06 +0100 | [diff] [blame] | 1077 | OCT4 ggsn_tei_c, /* GGSN TEI Control*/ |
| 1078 | OCT4 ggsn_tei_u, /* GGSN TEI User */ |
| 1079 | octetstring ggsn_ip_c, /* GGSN IP Control */ |
| 1080 | octetstring ggsn_ip_u, /* GGSN IP User */ |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1081 | OCT1 ggsn_restart_ctr, /* GGSN Restart Counter */ |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1082 | |
Harald Welte | 822f910 | 2018-02-18 20:39:06 +0100 | [diff] [blame] | 1083 | OCT4 sgsn_tei_c optional, /* SGSN TEI Control */ |
| 1084 | OCT4 sgsn_tei_u optional, /* SGSN TEI User */ |
| 1085 | octetstring sgsn_ip_c optional, /* SGSN IP Control */ |
| 1086 | octetstring sgsn_ip_u optional /* SGSN IP USer */ |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1087 | }; |
| 1088 | |
Harald Welte | 5b5ca1b | 2018-02-18 21:25:03 +0100 | [diff] [blame] | 1089 | |
| 1090 | private function f_process_gtp_ctx_act_req(inout PdpActPars apars, PDU_GTPC gtpc) runs on BSSGP_ConnHdlr { |
| 1091 | var GTPC_PDUs gtpc_rx := gtpc.gtpc_pdu; |
| 1092 | apars.sgsn_tei_c := gtpc_rx.createPDPContextRequest.teidControlPlane.teidControlPlane; |
| 1093 | apars.sgsn_tei_u := gtpc_rx.createPDPContextRequest.teidDataI.teidDataI; |
| 1094 | apars.sgsn_ip_c := gtpc_rx.createPDPContextRequest.sgsn_addr_signalling.addressf; |
| 1095 | apars.sgsn_ip_u := gtpc_rx.createPDPContextRequest.sgsn_addr_traffic.addressf; |
| 1096 | f_gtp_register_teid(apars.ggsn_tei_c); |
| 1097 | f_gtp_register_teid(apars.ggsn_tei_u); |
| 1098 | } |
| 1099 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1100 | function f_pdp_ctx_act(inout PdpActPars apars, boolean send_recovery := false, integer gb_idx := 0) |
| 1101 | runs on BSSGP_ConnHdlr { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1102 | var boolean exp_rej := ispresent(apars.exp_rej_cause); |
| 1103 | var Gtp1cUnitdata g_ud; |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1104 | var template Recovery_gtpc recovery := omit; |
| 1105 | |
| 1106 | if (send_recovery) { |
| 1107 | recovery := ts_Recovery(apars.ggsn_restart_ctr); |
| 1108 | } |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1109 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1110 | f_send_l3_gmm_llc(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr, |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1111 | apars.apn, apars.pco), gb_idx); |
Harald Welte | 5b5ca1b | 2018-02-18 21:25:03 +0100 | [diff] [blame] | 1112 | GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud { |
| 1113 | f_process_gtp_ctx_act_req(apars, g_ud.gtpc); |
| 1114 | var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber); |
| 1115 | GTP.send(ts_GTPC_CreatePdpResp(g_ud.peer, seq_nr, |
| 1116 | apars.sgsn_tei_c, apars.gtp_resp_cause, |
| 1117 | apars.ggsn_tei_c, apars.ggsn_tei_u, |
| 1118 | apars.nsapi, |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1119 | apars.ggsn_ip_c, apars.ggsn_ip_u, apars.chg_id, |
| 1120 | omit, recovery)); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1121 | } |
| 1122 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1123 | [exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, apars.exp_rej_cause)) { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1124 | setverdict(pass); |
| 1125 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1126 | [exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_ACCEPT) { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1127 | setverdict(fail, "Unexpected PDP CTX ACT ACC"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1128 | mtc.stop; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1129 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1130 | [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1131 | setverdict(fail, "Unexpected PDP CTX ACT FAIL"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1132 | mtc.stop; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1133 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1134 | [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) { |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1135 | setverdict(fail, "Unexpected PDP CTX ACT FAIL"); |
| 1136 | mtc.stop; |
| 1137 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1138 | [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_ACCEPT(apars.tid, apars.sapi)) { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1139 | setverdict(pass); |
| 1140 | } |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1141 | [] as_xid(apars, gb_idx); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1142 | } |
| 1143 | } |
| 1144 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1145 | function f_pdp_ctx_deact_mo(inout PdpActPars apars, OCT1 cause, integer gb_idx := 0) |
| 1146 | runs on BSSGP_ConnHdlr { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1147 | var boolean exp_rej := ispresent(apars.exp_rej_cause); |
| 1148 | var Gtp1cUnitdata g_ud; |
| 1149 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1150 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, cause, false, omit), gb_idx); |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1151 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud { |
| 1152 | var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber); |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1153 | BSSGP[gb_idx].clear; |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1154 | GTP.send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr, apars.sgsn_tei_c, '7F'O)); |
| 1155 | } |
| 1156 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1157 | [] BSSGP[gb_idx].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1158 | setverdict(pass); |
| 1159 | } |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1160 | [] as_xid(apars, gb_idx); |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1161 | } |
| 1162 | } |
| 1163 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1164 | function f_pdp_ctx_deact_mt(inout PdpActPars apars, boolean error_ind := false, integer gb_idx := 0) |
| 1165 | runs on BSSGP_ConnHdlr { |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1166 | var Gtp1cUnitdata g_ud; |
| 1167 | var integer seq_nr := 23; |
| 1168 | var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c)); |
| 1169 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1170 | BSSGP[gb_idx].clear; |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 1171 | if (error_ind) { |
| 1172 | GTP.send(ts_GTPU_ErrorIndication(peer, 0 /* seq */, apars.ggsn_tei_u, apars.ggsn_ip_u)); |
| 1173 | } else { |
| 1174 | GTP.send(ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B)); |
| 1175 | } |
Alexander Couzens | 5e71c14 | 2018-08-07 17:21:24 +0200 | [diff] [blame] | 1176 | |
| 1177 | timer T := 5.0; |
| 1178 | T.start; |
| 1179 | |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 1180 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1181 | [] BSSGP[gb_idx].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true)) { |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1182 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), gb_idx); |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1183 | } |
Alexander Couzens | 5e71c14 | 2018-08-07 17:21:24 +0200 | [diff] [blame] | 1184 | [not error_ind] GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) { |
| 1185 | repeat; |
| 1186 | } |
| 1187 | [] T.timeout { |
| 1188 | setverdict(fail, "Waiting for SM_DEACT_PDP_REQ_MT"); |
| 1189 | } |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1190 | } |
| 1191 | } |
| 1192 | |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1193 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1194 | /* Table 10.5.156/3GPP TS 24.008 */ |
| 1195 | template (value) QoSV t_QosDefault := { |
| 1196 | reliabilityClass := '011'B, /* unacknowledged GTP+LLC, acknowledged RLC */ |
| 1197 | delayClass := '100'B, /* best effort */ |
| 1198 | spare1 := '00'B, |
| 1199 | precedenceClass := '010'B, /* normal */ |
| 1200 | spare2 := '0'B, |
| 1201 | peakThroughput := '0000'B, /* subscribed */ |
| 1202 | meanThroughput := '00000'B, /* subscribed */ |
| 1203 | spare3 := '000'B, |
| 1204 | deliverErroneusSDU := omit, |
| 1205 | deliveryOrder := omit, |
| 1206 | trafficClass := omit, |
| 1207 | maxSDUSize := omit, |
| 1208 | maxBitrateUplink := omit, |
| 1209 | maxBitrateDownlink := omit, |
| 1210 | sduErrorRatio := omit, |
| 1211 | residualBER := omit, |
| 1212 | trafficHandlingPriority := omit, |
| 1213 | transferDelay := omit, |
| 1214 | guaranteedBitRateUplink := omit, |
| 1215 | guaranteedBitRateDownlink := omit, |
| 1216 | sourceStatisticsDescriptor := omit, |
| 1217 | signallingIndication := omit, |
| 1218 | spare4 := omit, |
| 1219 | maxBitrateDownlinkExt := omit, |
| 1220 | guaranteedBitRateDownlinkExt := omit, |
| 1221 | maxBitrateUplinkExt := omit, |
| 1222 | guaranteedBitRateUplinkExt := omit, |
| 1223 | maxBitrateDownlinkExt2 := omit, |
| 1224 | guaranteedBitRateDownlinkExt2 := omit, |
| 1225 | maxBitrateUplinkExt2 := omit, |
| 1226 | guaranteedBitRateUplinkExt2 := omit |
| 1227 | } |
| 1228 | |
| 1229 | /* 10.5.6.4 / 3GPP TS 24.008 */ |
| 1230 | template (value) PDPAddressV t_AddrIPv4dyn := { |
| 1231 | pdpTypeOrg := '0001'B, /* IETF */ |
| 1232 | spare := '0000'B, |
| 1233 | pdpTypeNum := '21'O, /* IPv4 */ |
| 1234 | addressInfo := omit |
| 1235 | } |
| 1236 | template (value) PDPAddressV t_AddrIPv6dyn := { |
| 1237 | pdpTypeOrg := '0001'B, /* IETF */ |
| 1238 | spare := '0000'B, |
| 1239 | pdpTypeNum := '53'O, /* IPv6 */ |
| 1240 | addressInfo := omit |
| 1241 | } |
| 1242 | |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1243 | template (value) PdpActPars t_PdpActPars(charstring ggsn_ip) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1244 | tid := '000'B, |
| 1245 | nsapi := '0101'B, /* < 5 are reserved */ |
| 1246 | sapi := '0011'B, /* 3/5/9/11 */ |
| 1247 | qos := t_QosDefault, |
| 1248 | addr := t_AddrIPv4dyn, |
| 1249 | apn := omit, |
| 1250 | pco := omit, |
| 1251 | exp_rej_cause := omit, |
Harald Welte | 1d6ae93 | 2018-02-18 21:24:44 +0100 | [diff] [blame] | 1252 | gtp_resp_cause := int2oct(128, 1), |
| 1253 | chg_id := f_rnd_octstring(4), |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1254 | |
| 1255 | /* FIXME: make below dynamic !! */ |
Harald Welte | 1d6ae93 | 2018-02-18 21:24:44 +0100 | [diff] [blame] | 1256 | ggsn_tei_c := f_rnd_octstring(4), |
| 1257 | ggsn_tei_u := f_rnd_octstring(4), |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1258 | ggsn_ip_c := f_inet_addr(ggsn_ip), |
| 1259 | ggsn_ip_u := f_inet_addr(ggsn_ip), |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1260 | ggsn_restart_ctr := int2oct(2, 1), |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1261 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1262 | sgsn_tei_c := omit, |
Harald Welte | f8af5d6 | 2018-02-18 15:06:42 +0100 | [diff] [blame] | 1263 | sgsn_tei_u := omit, |
| 1264 | sgsn_ip_c := omit, |
| 1265 | sgsn_ip_u := omit |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1266 | } |
| 1267 | |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1268 | template (value) GtpPeer ts_GtpPeerU(octetstring ip) := { |
| 1269 | connId := 1, |
| 1270 | remName := f_inet_ntoa(ip), |
| 1271 | remPort := GTP1U_PORT |
| 1272 | } |
| 1273 | |
| 1274 | template (value) GtpPeer ts_GtpPeerC(octetstring ip) := { |
| 1275 | connId := 1, |
| 1276 | remName := f_inet_ntoa(ip), |
| 1277 | remPort := GTP1C_PORT |
| 1278 | } |
| 1279 | |
| 1280 | private function f_gtpu_send(inout PdpActPars apars, octetstring payload) runs on BSSGP_ConnHdlr { |
| 1281 | var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u)); |
| 1282 | GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, apars.sgsn_tei_u, payload)); |
| 1283 | } |
| 1284 | |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1285 | private altstep as_xid(PdpActPars apars, integer gb_idx := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1286 | [] BSSGP[gb_idx].receive(tr_LLC_XID_MT_CMD(?, apars.sapi)) { |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1287 | repeat; |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | template PDU_SN tr_SN_UD(template BIT4 nsapi, template octetstring payload) := { |
| 1292 | pDU_SN_UNITDATA := { |
| 1293 | nsapi := nsapi, |
| 1294 | moreBit := ?, |
| 1295 | snPduType := '1'B, |
| 1296 | firstSegmentIndicator := ?, |
| 1297 | spareBit := ?, |
| 1298 | pcomp := ?, |
| 1299 | dcomp := ?, |
| 1300 | npduNumber := ?, |
| 1301 | segmentNumber := ?, |
| 1302 | npduNumberContinued := ?, |
| 1303 | dataSegmentSnUnitdataPdu := payload |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | /* simple case: single segment, no compression */ |
| 1308 | template (value) PDU_SN ts_SN_UD(BIT4 nsapi, octetstring payload) := { |
| 1309 | pDU_SN_UNITDATA := { |
| 1310 | nsapi := nsapi, |
| 1311 | moreBit := '0'B, |
| 1312 | snPduType := '1'B, |
| 1313 | firstSegmentIndicator := '1'B, |
| 1314 | spareBit := '0'B, |
| 1315 | pcomp := '0000'B, |
| 1316 | dcomp := '0000'B, |
| 1317 | npduNumber := '0000'B, |
| 1318 | segmentNumber := '0000'B, |
| 1319 | npduNumberContinued := '00'O, |
| 1320 | dataSegmentSnUnitdataPdu := payload |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | /* Transceive given 'payload' as MT message from GTP -> OsmoSGSN -> Gb */ |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1325 | private function f_gtpu_xceive_mt(inout PdpActPars apars, octetstring payload, integer gb_idx := 0) |
| 1326 | runs on BSSGP_ConnHdlr { |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1327 | /* Send PDU via GTP from our simulated GGSN to the SGSN */ |
| 1328 | f_gtpu_send(apars, payload); |
| 1329 | /* Expect PDU via BSSGP/LLC on simulated PCU from SGSN */ |
| 1330 | alt { |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1331 | [] as_xid(apars, gb_idx); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1332 | //[] BSSGP[gb_idx].receive(tr_BD_SNDCP(apars.sapi, tr_SN_UD(apars.nsapi, payload))); |
| 1333 | [] BSSGP[gb_idx].receive(tr_SN_UD(apars.nsapi, payload)); |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1334 | } |
| 1335 | } |
| 1336 | |
Pau Espin Pedrol | 8be4d19 | 2018-07-18 13:43:44 +0200 | [diff] [blame] | 1337 | /* Transceive given 'payload' as MT message from Gb -> OsmoSGSN -> GTP */ |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1338 | private function f_gtpu_xceive_mo(inout PdpActPars apars, octetstring payload, integer gb_idx := 0) |
| 1339 | runs on BSSGP_ConnHdlr { |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1340 | /* Send PDU via SNDCP/LLC/BSSGP/NS via simulated MS/PCU to the SGSN */ |
| 1341 | var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u)); |
| 1342 | var PDU_SN sndcp := valueof(ts_SN_UD(apars.nsapi, payload)); |
Harald Welte | f719167 | 2019-05-02 20:37:23 +0200 | [diff] [blame] | 1343 | BSSGP[gb_idx].send(ts_LLC_UI(enc_PDU_SN(sndcp), apars.sapi, '0'B, 0)); |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1344 | /* Expect PDU via GTP from SGSN on simulated GGSN */ |
| 1345 | alt { |
| 1346 | [] GTP.receive(tr_GTPU_GPDU(peer, apars.ggsn_tei_u, payload)); |
| 1347 | } |
| 1348 | } |
| 1349 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1350 | private function f_TC_attach_pdp_act(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1351 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1352 | |
| 1353 | /* first perform regular attach */ |
| 1354 | f_TC_attach(id); |
| 1355 | |
| 1356 | f_pdp_ctx_act(apars); |
| 1357 | } |
| 1358 | testcase TC_attach_pdp_act() runs on test_CT { |
| 1359 | var BSSGP_ConnHdlr vc_conn; |
| 1360 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1361 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act), testcasename(), g_gb, 17); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 1362 | vc_conn.done; |
| 1363 | } |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 1364 | |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1365 | /* PDP Context activation for not-attached subscriber; expect fail */ |
| 1366 | private function f_TC_pdp_act_unattached(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1367 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1368 | f_send_l3_gmm_llc(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr, |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1369 | apars.apn, apars.pco)); |
| 1370 | alt { |
| 1371 | /* We might want toalso actually expect a PDPC CTX ACT REJ? */ |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1372 | [] BSSGP[0].receive(tr_GMM_DET_REQ_MT(?, ?)) { |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1373 | setverdict(pass); |
| 1374 | } |
| 1375 | [] GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) { |
| 1376 | setverdict(fail, "Unexpected GTP PDP CTX ACT"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1377 | mtc.stop; |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1378 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1379 | [] BSSGP[0].receive(tr_SM_ACT_PDP_ACCEPT(?, ?)) { |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1380 | setverdict(fail, "Unexpected SM PDP CTX ACT ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1381 | mtc.stop; |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1382 | } |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 1383 | [] BSSGP[0].receive { repeat; } |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1384 | } |
| 1385 | } |
| 1386 | testcase TC_pdp_act_unattached() runs on test_CT { |
| 1387 | var BSSGP_ConnHdlr vc_conn; |
| 1388 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1389 | vc_conn := f_start_handler(refers(f_TC_pdp_act_unattached), testcasename(), g_gb, 18); |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1390 | vc_conn.done; |
| 1391 | } |
| 1392 | |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1393 | /* ATTACH + PDP CTX ACT + user plane traffic */ |
| 1394 | private function f_TC_attach_pdp_act_user(charstring id) runs on BSSGP_ConnHdlr { |
| 1395 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1396 | |
| 1397 | /* first perform regular attach */ |
| 1398 | f_TC_attach(id); |
| 1399 | /* then activate PDP context */ |
| 1400 | f_pdp_ctx_act(apars); |
| 1401 | /* then transceive a downlink PDU */ |
| 1402 | f_gtpu_xceive_mt(apars, f_rnd_octstring(100)); |
| 1403 | f_gtpu_xceive_mo(apars, f_rnd_octstring(200)); |
| 1404 | } |
| 1405 | testcase TC_attach_pdp_act_user() runs on test_CT { |
| 1406 | var BSSGP_ConnHdlr vc_conn; |
| 1407 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1408 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user), testcasename(), g_gb, 19); |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 1409 | vc_conn.done; |
| 1410 | } |
| 1411 | |
Harald Welte | 5b5ca1b | 2018-02-18 21:25:03 +0100 | [diff] [blame] | 1412 | /* ATTACH + PDP CTX ACT; reject from GGSN */ |
| 1413 | private function f_TC_attach_pdp_act_ggsn_reject(charstring id) runs on BSSGP_ConnHdlr { |
| 1414 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1415 | |
| 1416 | apars.gtp_resp_cause := int2oct(199, 1); /* no resources available */ |
| 1417 | apars.exp_rej_cause := '1a'O; /* insufficient resources */ |
| 1418 | |
| 1419 | /* first perform regular attach */ |
| 1420 | f_TC_attach(id); |
| 1421 | /* then activate PDP context */ |
| 1422 | f_pdp_ctx_act(apars); |
| 1423 | } |
| 1424 | testcase TC_attach_pdp_act_ggsn_reject() runs on test_CT { |
| 1425 | var BSSGP_ConnHdlr vc_conn; |
| 1426 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1427 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_ggsn_reject), testcasename(), g_gb, 20); |
Harald Welte | 5b5ca1b | 2018-02-18 21:25:03 +0100 | [diff] [blame] | 1428 | vc_conn.done; |
| 1429 | } |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 1430 | |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1431 | /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MO direction */ |
| 1432 | private function f_TC_attach_pdp_act_user_deact_mo(charstring id) runs on BSSGP_ConnHdlr { |
| 1433 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1434 | |
| 1435 | /* first perform regular attach */ |
| 1436 | f_TC_attach(id); |
| 1437 | /* then activate PDP context */ |
| 1438 | f_pdp_ctx_act(apars); |
| 1439 | /* then transceive a downlink PDU */ |
| 1440 | f_gtpu_xceive_mt(apars, f_rnd_octstring(100)); |
| 1441 | f_gtpu_xceive_mo(apars, f_rnd_octstring(200)); |
| 1442 | |
| 1443 | f_pdp_ctx_deact_mo(apars, '00'O); |
| 1444 | } |
| 1445 | testcase TC_attach_pdp_act_user_deact_mo() runs on test_CT { |
| 1446 | var BSSGP_ConnHdlr vc_conn; |
| 1447 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1448 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mo), testcasename(), g_gb, 21); |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1449 | vc_conn.done; |
| 1450 | } |
| 1451 | |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1452 | /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction */ |
| 1453 | private function f_TC_attach_pdp_act_user_deact_mt(charstring id) runs on BSSGP_ConnHdlr { |
| 1454 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1455 | |
| 1456 | /* first perform regular attach */ |
| 1457 | f_TC_attach(id); |
| 1458 | /* then activate PDP context */ |
| 1459 | f_pdp_ctx_act(apars); |
| 1460 | /* then transceive a downlink PDU */ |
| 1461 | f_gtpu_xceive_mt(apars, f_rnd_octstring(100)); |
| 1462 | f_gtpu_xceive_mo(apars, f_rnd_octstring(200)); |
| 1463 | |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 1464 | f_pdp_ctx_deact_mt(apars, false); |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1465 | } |
| 1466 | testcase TC_attach_pdp_act_user_deact_mt() runs on test_CT { |
| 1467 | var BSSGP_ConnHdlr vc_conn; |
| 1468 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1469 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mt), testcasename(), g_gb, 22); |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1470 | vc_conn.done; |
| 1471 | } |
| 1472 | |
Alexander Couzens | 187ad5d | 2018-05-02 19:31:10 +0200 | [diff] [blame] | 1473 | /* ATTACH + ATTACH (2nd) */ |
| 1474 | private function f_TC_attach_forget_tlli_attach(charstring id) runs on BSSGP_ConnHdlr { |
| 1475 | g_pars.t_guard := 5.0; |
| 1476 | |
| 1477 | /* first perform regular attach */ |
| 1478 | f_TC_attach(id); |
| 1479 | |
| 1480 | /* second to perform regular attach */ |
| 1481 | f_TC_attach(id); |
| 1482 | } |
| 1483 | |
| 1484 | |
| 1485 | testcase TC_attach_second_attempt() runs on test_CT { |
| 1486 | var BSSGP_ConnHdlr vc_conn; |
| 1487 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1488 | vc_conn := f_start_handler(refers(f_TC_attach_forget_tlli_attach), testcasename(), g_gb, 22); |
Alexander Couzens | 187ad5d | 2018-05-02 19:31:10 +0200 | [diff] [blame] | 1489 | vc_conn.done; |
| 1490 | } |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1491 | |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1492 | private function f_TC_attach_restart_ctr_echo(charstring id) runs on BSSGP_ConnHdlr { |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1493 | var Gtp1cUnitdata g_ud; |
| 1494 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1495 | |
| 1496 | /* first perform regular attach */ |
| 1497 | f_TC_attach(id); |
| 1498 | /* Activate a pdp context against the GGSN */ |
| 1499 | f_pdp_ctx_act(apars); |
| 1500 | /* Wait to receive first echo request and send initial Restart counter */ |
| 1501 | GTP.receive(tr_GTPC_MsgType(?, echoRequest, ?)) -> value g_ud { |
| 1502 | var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber); |
| 1503 | GTP.send(ts_GTPC_PONG(g_ud.peer, seq_nr, apars.ggsn_restart_ctr)); |
| 1504 | } |
| 1505 | /* Wait to receive second echo request and send incremented Restart |
| 1506 | counter. This will fake a restarted GGSN, and pdp ctx allocated |
| 1507 | should be released by SGSN */ |
| 1508 | apars.ggsn_restart_ctr := int2oct(oct2int(apars.ggsn_restart_ctr) + 1, 1); |
| 1509 | GTP.receive(tr_GTPC_MsgType(?, echoRequest, ?)) -> value g_ud { |
| 1510 | var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber); |
| 1511 | GTP.send(ts_GTPC_PONG(g_ud.peer, seq_nr, apars.ggsn_restart_ctr)); |
| 1512 | } |
| 1513 | var OCT1 cause_network_failure := int2oct(38, 1) |
| 1514 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1515 | [] BSSGP[0].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, cause_network_failure, true)) { |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1516 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid)); |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1517 | setverdict(pass); |
| 1518 | } |
| 1519 | [] as_xid(apars); |
| 1520 | } |
| 1521 | setverdict(pass); |
| 1522 | } |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1523 | /* ATTACH + trigger Recovery procedure through EchoResp */ |
| 1524 | testcase TC_attach_restart_ctr_echo() runs on test_CT { |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1525 | var BSSGP_ConnHdlr vc_conn; |
| 1526 | g_use_echo := true |
| 1527 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1528 | vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_echo), testcasename(), g_gb, 23, 30.0); |
Pau Espin Pedrol | dc27e48 | 2018-07-10 14:02:49 +0200 | [diff] [blame] | 1529 | vc_conn.done; |
| 1530 | g_use_echo := false |
| 1531 | } |
| 1532 | |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1533 | private function f_TC_attach_restart_ctr_create(charstring id) runs on BSSGP_ConnHdlr { |
| 1534 | var Gtp1cUnitdata g_ud; |
| 1535 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1536 | var integer seq_nr := 23; |
| 1537 | var GtpPeer peer; |
| 1538 | /* first perform regular attach */ |
| 1539 | f_TC_attach(id); |
| 1540 | |
| 1541 | /* Use this CTX ACT to send initial Restart counter to SGSN. */ |
| 1542 | apars.gtp_resp_cause := int2oct(199, 1); /* no resources available */ |
| 1543 | apars.exp_rej_cause := '1a'O; /* insufficient resources */ |
| 1544 | f_pdp_ctx_act(apars, true); |
| 1545 | |
| 1546 | /* Increment restart_ctr. This will fake a restarted GGSN when CreatePdpResp is |
| 1547 | /* received. */ |
| 1548 | apars.ggsn_restart_ctr := int2oct(oct2int(apars.ggsn_restart_ctr) + 1, 1); |
| 1549 | |
| 1550 | /* FIXME: Once we can easily handle different pdp ctx simultaneously, it |
| 1551 | would be great to have an active pdp context here before triggering |
| 1552 | Recovery, and making sure the the DEACT request is sent by the SGSN. |
| 1553 | */ |
| 1554 | |
| 1555 | /* Activate a pdp context against the GGSN, send incremented Recovery |
| 1556 | IE. This should trigger the recovery path, but still this specific |
| 1557 | CTX activation should work. */ |
| 1558 | apars.exp_rej_cause := omit; /* default value for tests */ |
| 1559 | apars.gtp_resp_cause := int2oct(128, 1); /* default value for tests */ |
| 1560 | f_pdp_ctx_act(apars, true); |
| 1561 | |
| 1562 | setverdict(pass); |
| 1563 | } |
| 1564 | /* ATTACH + trigger Recovery procedure through CreatePdpResp */ |
| 1565 | testcase TC_attach_restart_ctr_create() runs on test_CT { |
| 1566 | var BSSGP_ConnHdlr vc_conn; |
| 1567 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1568 | vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_create), testcasename(), g_gb, 24, 30.0); |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 1569 | vc_conn.done; |
| 1570 | } |
| 1571 | |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 1572 | /* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction + trigger T3395 */ |
| 1573 | private function f_TC_attach_pdp_act_deact_mt_t3395_expire(charstring id) runs on BSSGP_ConnHdlr { |
| 1574 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1575 | var integer seq_nr := 23; |
| 1576 | var GtpPeer peer; |
| 1577 | var integer i; |
| 1578 | |
| 1579 | /* first perform regular attach */ |
| 1580 | f_TC_attach(id); |
| 1581 | /* then activate PDP context */ |
| 1582 | f_pdp_ctx_act(apars); |
| 1583 | |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 1584 | BSSGP[0].clear; |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 1585 | peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c)); |
| 1586 | GTP.send(ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B)); |
| 1587 | |
| 1588 | for (i := 0; i < 5; i := i+1) { |
| 1589 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1590 | [] BSSGP[0].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true)) {} |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 1591 | [] as_xid(apars); |
| 1592 | } |
| 1593 | } |
| 1594 | |
| 1595 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) {} |
| 1596 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1597 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid)); |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 1598 | setverdict(pass); |
| 1599 | } |
| 1600 | testcase TC_attach_pdp_act_deact_mt_t3395_expire() runs on test_CT { |
| 1601 | var BSSGP_ConnHdlr vc_conn; |
| 1602 | f_init(); |
| 1603 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1604 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_mt_t3395_expire), testcasename(), g_gb, 25, 60.0); |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 1605 | vc_conn.done; |
| 1606 | } |
| 1607 | |
Pau Espin Pedrol | e6f071f | 2019-05-29 13:02:42 +0200 | [diff] [blame] | 1608 | /* ATTACH + PDP CTX ACT dropped + retrans */ |
| 1609 | private function f_TC_attach_pdp_act_deact_gtp_retrans(charstring id) runs on BSSGP_ConnHdlr { |
| 1610 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1611 | var Gtp1cUnitdata g_ud_first, g_ud_second; |
| 1612 | /* first perform regular attach */ |
| 1613 | f_TC_attach(id); |
| 1614 | |
| 1615 | /* then activate PDP context on the Gb side */ |
| 1616 | f_send_l3_gmm_llc(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr, |
| 1617 | apars.apn, apars.pco), 0); |
| 1618 | |
| 1619 | GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud_first {} |
| 1620 | log("First createPDPContextRequest received, dropping & waiting for retransmission"); |
| 1621 | GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud_second { |
| 1622 | if (g_ud_first != g_ud_second) { |
| 1623 | setverdict(fail, "Retransmitted GTP message createPDPContextRequest is different from original one!"); |
| 1624 | mtc.stop; |
| 1625 | } |
| 1626 | f_process_gtp_ctx_act_req(apars, g_ud_second.gtpc); |
| 1627 | var integer seq_nr := oct2int(g_ud_second.gtpc.opt_part.sequenceNumber); |
| 1628 | GTP.send(ts_GTPC_CreatePdpResp(g_ud_second.peer, seq_nr, |
| 1629 | apars.sgsn_tei_c, apars.gtp_resp_cause, |
| 1630 | apars.ggsn_tei_c, apars.ggsn_tei_u, |
| 1631 | apars.nsapi, |
| 1632 | apars.ggsn_ip_c, apars.ggsn_ip_u, apars.chg_id, |
| 1633 | omit, omit)); |
| 1634 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1635 | BSSGP[0].receive(tr_SM_ACT_PDP_ACCEPT) {} |
Pau Espin Pedrol | e6f071f | 2019-05-29 13:02:42 +0200 | [diff] [blame] | 1636 | |
| 1637 | /* Now the same with Deact */ |
| 1638 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, '00'O, false, omit), 0); |
| 1639 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud_first {} |
| 1640 | log("First deletePDPContextRequest received, dropping & waiting for retransmission"); |
| 1641 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud_second { |
| 1642 | if (g_ud_first != g_ud_second) { |
| 1643 | setverdict(fail, "Retransmitted GTP message deletePDPContextRequest is different from original one!"); |
| 1644 | mtc.stop; |
| 1645 | } |
| 1646 | var integer seq_nr := oct2int(g_ud_second.gtpc.opt_part.sequenceNumber); |
| 1647 | BSSGP[0].clear; |
| 1648 | GTP.send(ts_GTPC_DeletePdpResp(g_ud_second.peer, seq_nr, apars.sgsn_tei_c, '7F'O)); |
| 1649 | } |
| 1650 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1651 | [] BSSGP[0].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) { |
Pau Espin Pedrol | e6f071f | 2019-05-29 13:02:42 +0200 | [diff] [blame] | 1652 | setverdict(pass); |
| 1653 | } |
| 1654 | [] as_xid(apars, 0); |
| 1655 | } |
| 1656 | |
| 1657 | setverdict(pass); |
| 1658 | } |
| 1659 | testcase TC_attach_pdp_act_deact_gtp_retrans() runs on test_CT { |
| 1660 | var BSSGP_ConnHdlr vc_conn; |
| 1661 | f_init(); |
| 1662 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans), testcasename(), g_gb, 27); |
| 1663 | vc_conn.done; |
| 1664 | } |
| 1665 | |
| 1666 | /* Test that SGSN GTP response retransmit queue works fine */ |
| 1667 | private function f_TC_attach_pdp_act_deact_gtp_retrans_resp(charstring id) runs on BSSGP_ConnHdlr { |
| 1668 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1669 | var integer seq_nr := 23; |
| 1670 | var Gtp1cUnitdata g_ud_first, g_ud_second; |
| 1671 | var template Gtp1cUnitdata g_delete_req; |
| 1672 | /* first perform regular attach + PDP context act */ |
| 1673 | f_TC_attach(id); |
| 1674 | f_pdp_ctx_act(apars); |
| 1675 | |
| 1676 | /* Now perform an MT DeleteCtxReq and emulate GGSN didn't receive response and sends a duplicated DeleteCtxReq */ |
| 1677 | BSSGP[0].clear; |
| 1678 | var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c)); |
| 1679 | g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B); |
| 1680 | GTP.send(g_delete_req); |
| 1681 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1682 | [] BSSGP[0].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true)) { |
Pau Espin Pedrol | e6f071f | 2019-05-29 13:02:42 +0200 | [diff] [blame] | 1683 | f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), 0); |
| 1684 | } |
| 1685 | [] as_xid(apars, 0); |
| 1686 | } |
| 1687 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) -> value g_ud_first { |
| 1688 | if (g_ud_first.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue != '80'O) { |
| 1689 | setverdict(fail, "Received deletePDPContextResponse cause is not 'Request accepted'"); |
| 1690 | mtc.stop; |
| 1691 | } |
| 1692 | }; |
| 1693 | |
| 1694 | /* Send duplicate DeleteCtxReq */ |
| 1695 | log("First deletePDPContextResponse received, dropping & retransmitting retransmission of deletePDPContextRequest"); |
| 1696 | GTP.send(g_delete_req); |
| 1697 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) -> value g_ud_second { |
| 1698 | if (g_ud_first != g_ud_second) { |
| 1699 | setverdict(fail, "Retransmitted GTP message deletePDPContextResponse is different from original one!"); |
| 1700 | mtc.stop; |
| 1701 | } |
| 1702 | } |
| 1703 | |
| 1704 | /* Let's send now a new DeleteCtxReq (increased seq_nr) to make sure it |
| 1705 | * is handled differently by SGSN (expect "non-existent" cause) */ |
| 1706 | g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr + 1, apars.sgsn_tei_c, apars.nsapi, '1'B); |
| 1707 | GTP.send(g_delete_req); |
| 1708 | /* Response with cause "non-existent" must be sent with TEID 0 according to specs */ |
| 1709 | GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, '00000000'O)) -> value g_ud_second { |
| 1710 | if (g_ud_second.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue != 'C0'O) { |
| 1711 | setverdict(fail, "Received deletePDPContextResponse cause is not 'Non-existent'"); |
| 1712 | mtc.stop; |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | setverdict(pass); |
| 1717 | } |
| 1718 | testcase TC_attach_pdp_act_deact_gtp_retrans_resp() runs on test_CT { |
| 1719 | var BSSGP_ConnHdlr vc_conn; |
| 1720 | f_init(); |
| 1721 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans_resp), testcasename(), g_gb, 28); |
| 1722 | vc_conn.done; |
| 1723 | } |
| 1724 | |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1725 | private function f_TC_hlr_location_cancel_request_update(charstring id) runs on BSSGP_ConnHdlr { |
| 1726 | /* MS: perform regular attach */ |
| 1727 | f_TC_attach(id); |
| 1728 | |
| 1729 | /* HLR: cancel the location request */ |
| 1730 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_UPDATE)); |
| 1731 | GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)); |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1732 | |
| 1733 | /* ensure no Detach Request got received */ |
| 1734 | timer T := 5.0; |
| 1735 | T.start; |
| 1736 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1737 | [] BSSGP[0].receive(tr_GMM_DET_REQ_MT(*, *, *)) { |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1738 | T.stop; |
| 1739 | setverdict(fail, "Unexpected GMM Detach Request"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1740 | mtc.stop; |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1741 | } |
| 1742 | [] T.timeout { |
| 1743 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1744 | mtc.stop; |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1745 | } |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 1746 | [] BSSGP[0].receive { |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1747 | repeat; |
| 1748 | } |
| 1749 | } |
| 1750 | } |
| 1751 | |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 1752 | /* ATTACH + PDP CTX ACT + user plane traffic + ERROR IND in MT direction */ |
| 1753 | private function f_TC_attach_pdp_act_user_error_ind_ggsn(charstring id) runs on BSSGP_ConnHdlr { |
| 1754 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 1755 | |
| 1756 | /* first perform regular attach */ |
| 1757 | f_TC_attach(id); |
| 1758 | /* then activate PDP context */ |
| 1759 | f_pdp_ctx_act(apars); |
| 1760 | /* then transceive a downlink PDU */ |
| 1761 | f_gtpu_xceive_mo(apars, f_rnd_octstring(200)); |
| 1762 | |
| 1763 | /* Send Error indication as response from upload PDU and expect deact towards MS */ |
| 1764 | f_pdp_ctx_deact_mt(apars, true); |
| 1765 | } |
| 1766 | testcase TC_attach_pdp_act_user_error_ind_ggsn() runs on test_CT { |
| 1767 | var BSSGP_ConnHdlr vc_conn; |
| 1768 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1769 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_error_ind_ggsn), testcasename(), g_gb, 26); |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 1770 | vc_conn.done; |
| 1771 | } |
| 1772 | |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1773 | testcase TC_hlr_location_cancel_request_update() runs on test_CT { |
| 1774 | /* MS <-> SGSN: GMM Attach |
| 1775 | * HLR -> SGSN: Cancel Location Request |
| 1776 | * HLR <- SGSN: Cancel Location Ack |
| 1777 | */ |
| 1778 | var BSSGP_ConnHdlr vc_conn; |
| 1779 | f_init(); |
| 1780 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1781 | vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_update), testcasename(), g_gb, 31); |
Alexander Couzens | 5e307b4 | 2018-05-22 18:12:20 +0200 | [diff] [blame] | 1782 | vc_conn.done; |
| 1783 | } |
| 1784 | |
| 1785 | |
Alexander Couzens | c87967a | 2018-05-22 16:09:54 +0200 | [diff] [blame] | 1786 | private function f_TC_hlr_location_cancel_request_withdraw(charstring id) runs on BSSGP_ConnHdlr { |
| 1787 | /* MS: perform regular attach */ |
| 1788 | f_TC_attach(id); |
| 1789 | |
| 1790 | /* HLR: cancel the location request */ |
| 1791 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_WITHDRAW)); |
| 1792 | GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)); |
| 1793 | GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); |
| 1794 | |
| 1795 | /* MS: receive a Detach Request */ |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1796 | BSSGP[0].receive(tr_GMM_DET_REQ_MT(c_GMM_DTT_MT_IMSI_DETACH, ?, ?)); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1797 | f_send_l3_gmm_llc(ts_GMM_DET_ACCEPT_MO); |
Alexander Couzens | c87967a | 2018-05-22 16:09:54 +0200 | [diff] [blame] | 1798 | |
| 1799 | setverdict(pass); |
| 1800 | } |
| 1801 | |
| 1802 | testcase TC_hlr_location_cancel_request_withdraw() runs on test_CT { |
| 1803 | /* MS <-> SGSN: GMM Attach |
| 1804 | * HLR -> SGSN: Cancel Location Request |
| 1805 | * HLR <- SGSN: Cancel Location Ack |
| 1806 | * MS <- SGSN: Detach Request |
| 1807 | * SGSN-> MS: Detach Complete |
| 1808 | */ |
| 1809 | var BSSGP_ConnHdlr vc_conn; |
| 1810 | f_init(); |
| 1811 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1812 | vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_withdraw), testcasename(), g_gb, 29); |
Alexander Couzens | c87967a | 2018-05-22 16:09:54 +0200 | [diff] [blame] | 1813 | vc_conn.done; |
| 1814 | } |
| 1815 | |
| 1816 | |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1817 | private function f_hlr_location_cancel_request_unknown_subscriber( |
| 1818 | charstring id, |
| 1819 | GSUP_CancelType canceltype) runs on BSSGP_ConnHdlr { |
| 1820 | |
| 1821 | /* HLR: cancel the location request */ |
| 1822 | GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, canceltype)); |
| 1823 | |
| 1824 | /* cause 2 = IMSI_UNKNOWN */ |
| 1825 | GSUP.receive(tr_GSUP_CL_ERR(g_pars.imsi, 2)); |
| 1826 | |
| 1827 | setverdict(pass); |
| 1828 | } |
| 1829 | |
| 1830 | private function f_TC_hlr_location_cancel_request_unknown_subscriber_withdraw(charstring id) runs on BSSGP_ConnHdlr { |
Alexander Couzens | ace6fc6 | 2018-06-05 16:29:02 +0200 | [diff] [blame] | 1831 | f_hlr_location_cancel_request_unknown_subscriber(id, OSMO_GSUP_CANCEL_TYPE_WITHDRAW); |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1832 | } |
| 1833 | |
| 1834 | testcase TC_hlr_location_cancel_request_unknown_subscriber_withdraw() runs on test_CT { |
| 1835 | /* HLR -> SGSN: Cancel Location Request |
| 1836 | * HLR <- SGSN: Cancel Location Error |
| 1837 | */ |
| 1838 | |
| 1839 | var BSSGP_ConnHdlr vc_conn; |
| 1840 | f_init(); |
| 1841 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1842 | vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_withdraw), testcasename(), g_gb, 30); |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1843 | vc_conn.done; |
| 1844 | } |
| 1845 | |
| 1846 | private function f_TC_hlr_location_cancel_request_unknown_subscriber_update(charstring id) runs on BSSGP_ConnHdlr { |
Alexander Couzens | ace6fc6 | 2018-06-05 16:29:02 +0200 | [diff] [blame] | 1847 | f_hlr_location_cancel_request_unknown_subscriber(id, OSMO_GSUP_CANCEL_TYPE_WITHDRAW); |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1848 | } |
| 1849 | |
| 1850 | testcase TC_hlr_location_cancel_request_unknown_subscriber_update() runs on test_CT { |
| 1851 | /* HLR -> SGSN: Cancel Location Request |
| 1852 | * HLR <- SGSN: Cancel Location Error |
| 1853 | */ |
| 1854 | |
| 1855 | var BSSGP_ConnHdlr vc_conn; |
| 1856 | f_init(); |
| 1857 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1858 | vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_update), testcasename(), g_gb, 30); |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1859 | vc_conn.done; |
| 1860 | } |
| 1861 | |
Alexander Couzens | 49bb4b4 | 2018-06-05 16:28:36 +0200 | [diff] [blame] | 1862 | private function f_TC_attach_detach_check_subscriber_list(charstring id) runs on BSSGP_ConnHdlr { |
| 1863 | f_TC_attach(id); |
| 1864 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, true); |
| 1865 | } |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1866 | |
Alexander Couzens | 49bb4b4 | 2018-06-05 16:28:36 +0200 | [diff] [blame] | 1867 | testcase TC_attach_detach_check_subscriber_list() runs on test_CT { |
| 1868 | /* MS <-> SGSN: Attach |
| 1869 | * MS -> SGSN: Detach Req (Power off) |
| 1870 | * VTY -> SGSN: Check if MS is NOT in subscriber cache |
| 1871 | */ |
| 1872 | var BSSGP_ConnHdlr vc_conn; |
| 1873 | var integer id := 33; |
| 1874 | var charstring imsi := hex2str(f_gen_imsi(id)); |
| 1875 | |
| 1876 | f_init(); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1877 | vc_conn := f_start_handler(refers(f_TC_attach_detach_check_subscriber_list), testcasename(), g_gb, id); |
Alexander Couzens | 49bb4b4 | 2018-06-05 16:28:36 +0200 | [diff] [blame] | 1878 | vc_conn.done; |
| 1879 | |
| 1880 | f_vty_transceive_not_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*"); |
| 1881 | } |
Alexander Couzens | 6c47f29 | 2018-05-22 17:09:49 +0200 | [diff] [blame] | 1882 | |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1883 | /* Attempt an attach, but loose the Identification Request (IMEI) */ |
| 1884 | private function f_TC_attach_no_imei_response(charstring id) runs on BSSGP_ConnHdlr { |
| 1885 | var integer count_req := 0; |
| 1886 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 1887 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1888 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), f_random_RAI(), true, false, omit, omit)); |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1889 | |
| 1890 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1891 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1892 | /* break */ |
| 1893 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1894 | [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) { |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1895 | mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1896 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi)); |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1897 | repeat; |
| 1898 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1899 | [] BSSGP[0].receive(tr_GMM_ID_REQ('010'B)) { |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1900 | /* ignore ID REQ IMEI */ |
| 1901 | count_req := count_req + 1; |
| 1902 | repeat; |
| 1903 | } |
| 1904 | } |
| 1905 | if (count_req != 5) { |
| 1906 | setverdict(fail, "Did not received GMM ID Request Type IMEI 5 times!"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1907 | mtc.stop; |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1908 | } |
| 1909 | setverdict(pass); |
| 1910 | } |
| 1911 | |
| 1912 | testcase TC_attach_no_imei_response() runs on test_CT { |
| 1913 | /* MS -> SGSN: Attach Request IMSI |
| 1914 | * MS <- SGSN: Identity Request IMSI (optional) |
| 1915 | * MS -> SGSN: Identity Response IMSI (optional) |
| 1916 | * MS <- SGSN: Identity Request IMEI |
| 1917 | * MS -x SGSN: no response |
| 1918 | * MS <- SGSN: re-send: Identity Request IMEI 4x |
| 1919 | * MS <- SGSN: Attach Reject |
| 1920 | */ |
| 1921 | var BSSGP_ConnHdlr vc_conn; |
| 1922 | f_init(); |
| 1923 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1924 | vc_conn := f_start_handler(refers(f_TC_attach_no_imei_response), testcasename(), g_gb, 32, 60.0); |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 1925 | vc_conn.done; |
| 1926 | } |
| 1927 | |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1928 | /* Attempt an attach, but loose the Identification Request (IMSI) */ |
| 1929 | private function f_TC_attach_no_imsi_response(charstring id) runs on BSSGP_ConnHdlr { |
| 1930 | var integer count_req := 0; |
| 1931 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 1932 | |
| 1933 | /* set p_tmsi to use it in Attach Req via f_mi_get_lv() */ |
| 1934 | g_pars.p_tmsi := 'c0000035'O; |
| 1935 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1936 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), f_random_RAI(), true, false, omit, omit)); |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1937 | |
| 1938 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1939 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1940 | /* break */ |
| 1941 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1942 | [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) { |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1943 | /* ignore ID REQ IMSI */ |
| 1944 | count_req := count_req + 1; |
| 1945 | repeat; |
| 1946 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1947 | [] BSSGP[0].receive(tr_GMM_ID_REQ('010'B)) { |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1948 | mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 1949 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi)); |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1950 | repeat; |
| 1951 | } |
| 1952 | } |
| 1953 | if (count_req != 5) { |
| 1954 | setverdict(fail, "Did not received GMM ID Request Type IMSI 5 times!"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1955 | mtc.stop; |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1956 | } |
| 1957 | setverdict(pass); |
| 1958 | } |
| 1959 | |
| 1960 | testcase TC_attach_no_imsi_response() runs on test_CT { |
| 1961 | /* MS -> SGSN: Attach Request TMSI (unknown) |
| 1962 | * MS <- SGSN: Identity Request IMEI (optional) |
| 1963 | * MS -> SGSN: Identity Response IMEI (optional) |
| 1964 | * MS <- SGSN: Identity Request IMSI |
| 1965 | * MS -x SGSN: no response |
| 1966 | * MS <- SGSN: re-send: Identity Request IMSI 4x |
| 1967 | * MS <- SGSN: Attach Reject |
| 1968 | */ |
| 1969 | var BSSGP_ConnHdlr vc_conn; |
| 1970 | f_init(); |
| 1971 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1972 | vc_conn := f_start_handler(refers(f_TC_attach_no_imsi_response), testcasename(), g_gb, 35, 60.0); |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 1973 | vc_conn.done; |
| 1974 | } |
| 1975 | |
Alexander Couzens | cf81896 | 2018-06-05 18:00:00 +0200 | [diff] [blame] | 1976 | private function f_sgsn_vty_destroy_subscriber_imsi(TELNETasp_PT pt, charstring imsi) { |
| 1977 | f_vty_transceive(pt, "update-subscriber imsi " & imsi & " destroy"); |
| 1978 | } |
| 1979 | |
| 1980 | testcase TC_attach_check_subscriber_list() runs on test_CT { |
| 1981 | /* MS <-> SGSN: Attach |
| 1982 | * VTY -> SGSN: Check if MS is in subscriber cache |
| 1983 | */ |
| 1984 | var BSSGP_ConnHdlr vc_conn; |
| 1985 | var integer id := 34; |
| 1986 | var charstring imsi := hex2str(f_gen_imsi(id)); |
| 1987 | |
| 1988 | f_init(); |
| 1989 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 1990 | vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, id); |
Alexander Couzens | cf81896 | 2018-06-05 18:00:00 +0200 | [diff] [blame] | 1991 | vc_conn.done; |
| 1992 | |
| 1993 | f_vty_transceive_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*"); |
| 1994 | f_sgsn_vty_destroy_subscriber_imsi(SGSNVTY, imsi); |
| 1995 | } |
| 1996 | |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 1997 | private function f_TC_attach_closed_imsi_added(charstring id) runs on BSSGP_ConnHdlr { |
| 1998 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 1999 | var PDU_L3_SGSN_MS l3_mt; |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2000 | |
| 2001 | /* unregister the old IMSI */ |
| 2002 | f_bssgp_client_unregister(g_pars.imsi); |
| 2003 | /* Simulate a foreign IMSI */ |
Alexander Couzens | 03d1224 | 2018-08-07 16:13:52 +0200 | [diff] [blame] | 2004 | g_pars.imsi := '001010123456700'H; |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 2005 | f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]); |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2006 | |
| 2007 | /* there is no auth */ |
| 2008 | g_pars.net.expect_auth := false; |
| 2009 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 2010 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit)); |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2011 | f_gmm_auth(); |
| 2012 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2013 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2014 | setverdict(fail, "Received unexpected GMM Attach REJECT"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2015 | mtc.stop; |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2016 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2017 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT(*, *, *)) -> value l3_mt { |
| 2018 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 2019 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL); |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2020 | setverdict(pass); |
| 2021 | } |
| 2022 | } |
| 2023 | } |
Alexander Couzens | 03d1224 | 2018-08-07 16:13:52 +0200 | [diff] [blame] | 2024 | |
| 2025 | private function f_TC_attach_closed_add_vty(charstring id) runs on BSSGP_ConnHdlr { |
| 2026 | |
| 2027 | f_TC_attach_closed_foreign(id); |
| 2028 | f_TC_attach_closed_imsi_added(id); |
| 2029 | |
| 2030 | } |
| 2031 | |
| 2032 | |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2033 | testcase TC_attach_closed_add_vty() runs on test_CT { |
| 2034 | /* VTY-> SGSN: policy close |
| 2035 | * MS -> SGSN: Attach Request |
| 2036 | * MS <- SGSN: Identity Request IMSI |
| 2037 | * MS -> SGSN: Identity Response IMSI |
| 2038 | * MS <- SGSN: Attach Reject |
| 2039 | * VTY-> SGSN: policy imsi-acl add IMSI |
| 2040 | * MS -> SGSN: Attach Request |
| 2041 | * MS <- SGSN: Identity Request IMSI |
| 2042 | * MS -> SGSN: Identity Response IMSI |
| 2043 | * MS <- SGSN: Identity Request IMEI |
| 2044 | * MS -> SGSN: Identity Response IMEI |
| 2045 | * MS <- SGSN: Attach Accept |
| 2046 | */ |
| 2047 | var BSSGP_ConnHdlr vc_conn; |
| 2048 | f_init(); |
| 2049 | f_sleep(1.0); |
| 2050 | f_vty_config(SGSNVTY, "sgsn", "auth-policy closed"); |
| 2051 | f_vty_config(SGSNVTY, "sgsn", "imsi-acl del 001010123456789"); |
Alexander Couzens | 03d1224 | 2018-08-07 16:13:52 +0200 | [diff] [blame] | 2052 | f_vty_config(SGSNVTY, "sgsn", "imsi-acl del 001010123456700"); |
| 2053 | f_vty_config(SGSNVTY, "sgsn", "imsi-acl add 001010123456700"); |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2054 | /* test with foreign IMSI: Must Reject */ |
Alexander Couzens | 03d1224 | 2018-08-07 16:13:52 +0200 | [diff] [blame] | 2055 | vc_conn := f_start_handler(refers(f_TC_attach_closed_add_vty), testcasename(), g_gb, 9); |
Alexander Couzens | f985865 | 2018-06-07 16:14:53 +0200 | [diff] [blame] | 2056 | vc_conn.done; |
| 2057 | } |
| 2058 | |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2059 | /* Attempt an attach, but never answer a Attach Complete */ |
| 2060 | private function f_TC_attach_check_complete_resend(charstring id) runs on BSSGP_ConnHdlr { |
| 2061 | var integer count_req := 0; |
| 2062 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 2063 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), f_random_RAI(), true, false, omit, omit)); |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2064 | f_gmm_auth(); |
| 2065 | |
Alexander Couzens | fa0a75f | 2018-08-07 15:45:04 +0200 | [diff] [blame] | 2066 | timer T := 10.0; |
| 2067 | T.start; |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2068 | alt { |
Alexander Couzens | fa0a75f | 2018-08-07 15:45:04 +0200 | [diff] [blame] | 2069 | [] T.timeout { |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2070 | /* break */ |
| 2071 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2072 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT(*, *, *)) { |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2073 | /* ignore */ |
| 2074 | count_req := count_req + 1; |
Alexander Couzens | fa0a75f | 2018-08-07 15:45:04 +0200 | [diff] [blame] | 2075 | T.start; |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2076 | repeat; |
| 2077 | } |
| 2078 | } |
| 2079 | if (count_req != 5) { |
| 2080 | setverdict(fail, "Did not received GMM Attach Complete."); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2081 | mtc.stop; |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2082 | } |
| 2083 | setverdict(pass); |
| 2084 | } |
| 2085 | |
| 2086 | testcase TC_attach_check_complete_resend() runs on test_CT { |
| 2087 | /* MS -> SGSN: Attach Request IMSI |
| 2088 | * MS <- SGSN: Identity Request * |
| 2089 | * MS -> SGSN: Identity Response * |
| 2090 | * MS <- SGSN: Attach Complete 5x |
| 2091 | */ |
| 2092 | var BSSGP_ConnHdlr vc_conn; |
| 2093 | f_init(); |
| 2094 | f_sleep(1.0); |
Alexander Couzens | 51114d1 | 2018-07-31 18:41:56 +0200 | [diff] [blame] | 2095 | vc_conn := f_start_handler(refers(f_TC_attach_check_complete_resend), testcasename(), g_gb, 36, 60.0); |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2096 | vc_conn.done; |
| 2097 | } |
| 2098 | |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 2099 | private function f_routing_area_update(RoutingAreaIdentificationV ra, integer bssgp := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2100 | var PDU_L3_SGSN_MS l3_mt; |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 2101 | |
| 2102 | /* then send RAU */ |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 2103 | f_send_l3_gmm_llc(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, g_pars.ra, false, omit, omit), bssgp); |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 2104 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2105 | [] BSSGP[bssgp].receive(tr_GMM_RAU_ACCEPT) -> value l3_mt { |
| 2106 | f_process_rau_accept(l3_mt.msgs.gprs_mm.routingAreaUpdateAccept, bssgp); |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 2107 | f_send_l3_gmm_llc(ts_GMM_RAU_COMPL, bssgp); |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 2108 | setverdict(pass); |
| 2109 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2110 | [] BSSGP[bssgp].receive(tr_GMM_RAU_REJECT) { |
Alexander Couzens | 5dce90d | 2018-07-31 03:16:37 +0200 | [diff] [blame] | 2111 | setverdict(fail, "Unexpected RAU Reject"); |
| 2112 | mtc.stop; |
| 2113 | } |
| 2114 | [] BSSGP[bssgp].receive { repeat; } |
| 2115 | } |
| 2116 | } |
| 2117 | |
Alexander Couzens | bfda921 | 2018-07-31 03:17:33 +0200 | [diff] [blame] | 2118 | private function f_TC_attach_rau_a_a(charstring id) runs on BSSGP_ConnHdlr { |
Alexander Couzens | bfda921 | 2018-07-31 03:17:33 +0200 | [diff] [blame] | 2119 | /* first perform regular attach */ |
| 2120 | f_TC_attach(id); |
| 2121 | |
| 2122 | /* then send RAU */ |
| 2123 | f_routing_area_update(g_pars.ra); |
| 2124 | |
| 2125 | /* do another RAU */ |
| 2126 | f_routing_area_update(g_pars.ra); |
| 2127 | |
| 2128 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, true); |
| 2129 | } |
| 2130 | |
| 2131 | testcase TC_attach_rau_a_a() runs on test_CT { |
| 2132 | /* MS <-> SGSN: Successful Attach |
| 2133 | * MS -> SGSN: Routing Area Update Request |
| 2134 | * MS <- SGSN: Routing Area Update Accept |
| 2135 | * MS -> SGSN: Routing Area Update Request |
| 2136 | * MS <- SGSN: Routing Area Update Accept |
| 2137 | * MS -> SGSN: Detach (PowerOff) |
| 2138 | */ |
| 2139 | var BSSGP_ConnHdlr vc_conn; |
| 2140 | f_init(); |
| 2141 | f_sleep(1.0); |
| 2142 | vc_conn := f_start_handler(refers(f_TC_attach_rau_a_a), testcasename(), g_gb, 37); |
| 2143 | vc_conn.done; |
| 2144 | } |
| 2145 | |
Alexander Couzens | be837bd | 2018-07-31 04:20:11 +0200 | [diff] [blame] | 2146 | private function f_TC_attach_rau_a_b(charstring id) runs on BSSGP_ConnHdlr { |
Alexander Couzens | be837bd | 2018-07-31 04:20:11 +0200 | [diff] [blame] | 2147 | f_TC_attach(id); |
| 2148 | |
| 2149 | log("attach complete sending rau"); |
| 2150 | f_routing_area_update(g_pars.ra, 0); |
| 2151 | |
| 2152 | log("rau complete unregistering"); |
| 2153 | f_bssgp_client_unregister(g_pars.imsi); |
| 2154 | f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[1], BSSGP_PROC[1]); |
| 2155 | |
| 2156 | log("sending second RAU via different RA"); |
| 2157 | f_routing_area_update(f_cellid_to_RAI(g_pars.bssgp_cell_id[1]), 1); |
| 2158 | |
| 2159 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, true, 1); |
| 2160 | } |
| 2161 | |
| 2162 | testcase TC_attach_rau_a_b() runs on test_CT { |
| 2163 | /* MS <-> SGSN: Successful Attach |
| 2164 | * MS -> SGSN: Routing Area _a_ Update Request |
| 2165 | * MS <- SGSN: Routing Area _a_ Update Accept |
| 2166 | * MS -> SGSN: Routing Area _b_ Update Request |
| 2167 | * MS <- SGSN: Routing Area _b_ Update Accept |
| 2168 | * MS -> SGSN: Detach (PowerOff) |
| 2169 | */ |
| 2170 | var BSSGP_ConnHdlr vc_conn; |
| 2171 | f_init(); |
| 2172 | f_sleep(1.0); |
| 2173 | vc_conn := f_start_handler(refers(f_TC_attach_rau_a_b), testcasename(), g_gb, 38); |
| 2174 | vc_conn.done; |
| 2175 | } |
| 2176 | |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2177 | private function f_TC_attach_gmm_attach_req_while_gmm_attach(charstring id) runs on BSSGP_ConnHdlr { |
| 2178 | var integer count_req := 0; |
| 2179 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 2180 | var RoutingAreaIdentificationV rand_rai := f_random_RAI(); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2181 | var PDU_L3_SGSN_MS l3_mt; |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2182 | |
| 2183 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit)); |
| 2184 | |
| 2185 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2186 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2187 | setverdict(fail, "Unexpected GMM ATTACH REJECT"); |
| 2188 | mtc.stop; |
| 2189 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2190 | [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2191 | mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 2192 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi)); |
| 2193 | repeat; |
| 2194 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2195 | [] BSSGP[0].receive(tr_GMM_ID_REQ('010'B)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2196 | /* send out a second GMM_Attach Request. |
| 2197 | * If the SGSN follows the rules, this 2nd ATTACH REQ should be ignored, because |
| 2198 | * of the same content */ |
| 2199 | f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit)); |
| 2200 | mi := valueof(ts_MI_IMEI_LV(g_pars.imei)); |
| 2201 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi)); |
| 2202 | } |
| 2203 | } |
| 2204 | f_sleep(1.0); |
| 2205 | |
| 2206 | /* we've sent already a IMEI answer, we should NOT asked again for IMEI */ |
| 2207 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2208 | [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2209 | mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 2210 | f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi)); |
| 2211 | repeat; |
| 2212 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2213 | [] BSSGP[0].receive(tr_GMM_ID_REQ('010'B)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2214 | setverdict(fail, "Unexpected GMM ID REQ (IMEI)."); |
| 2215 | mtc.stop; |
| 2216 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2217 | [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) { |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2218 | setverdict(fail, "Unexpected GMM ATTACH REJECT"); |
| 2219 | mtc.stop; |
| 2220 | } |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2221 | [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 2222 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2223 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL); |
| 2224 | setverdict(pass); |
| 2225 | /* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */ |
| 2226 | } |
| 2227 | } |
| 2228 | } |
| 2229 | |
| 2230 | testcase TC_attach_gmm_attach_req_while_gmm_attach() runs on test_CT { |
| 2231 | /* Testing if the SGSN ignore Attach Request with the exact same content */ |
| 2232 | /* MS -> SGSN: Attach Request IMSI |
| 2233 | * MS <- SGSN: Identity Request IMSI (optional) |
| 2234 | * MS -> SGSN: Identity Response IMSI (optional) |
| 2235 | * MS <- SGSN: Identity Request IMEI |
| 2236 | * MS -> SGSN: Attach Request (2nd) |
| 2237 | * MS <- SGSN: Identity Response IMEI |
| 2238 | * MS <- SGSN: Attach Accept |
| 2239 | * MS -> SGSN: Attach Complete |
| 2240 | */ |
| 2241 | var BSSGP_ConnHdlr vc_conn; |
| 2242 | f_init(); |
| 2243 | f_sleep(1.0); |
| 2244 | f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all"); |
| 2245 | vc_conn := f_start_handler(refers(f_TC_attach_gmm_attach_req_while_gmm_attach), testcasename(), g_gb, 39); |
| 2246 | vc_conn.done; |
| 2247 | } |
| 2248 | |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2249 | private function f_TC_attach_usim_resync(charstring id) runs on BSSGP_ConnHdlr { |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2250 | var RoutingAreaIdentificationV old_ra := f_random_RAI(); |
| 2251 | |
| 2252 | var template PDU_L3_MS_SGSN attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit); |
| 2253 | |
| 2254 | /* send Attach Request */ |
| 2255 | /* indicate R99 capability of the MS to enable UMTS AKA in presence of |
| 2256 | * 3G auth vectors */ |
| 2257 | attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.revisionLevelIndicatior := '1'B; |
| 2258 | /* The thing is, if the solSACapability is 'omit', then the |
| 2259 | * revisionLevelIndicatior is at the wrong place! */ |
| 2260 | attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.solSACapability := '0'B; |
| 2261 | f_send_l3_gmm_llc(attach_req); |
| 2262 | |
| 2263 | /* do the auth */ |
| 2264 | var PDU_L3_MS_SGSN l3_mo; |
| 2265 | var PDU_L3_SGSN_MS l3_mt; |
| 2266 | var default di := activate(as_mm_identity()); |
| 2267 | |
| 2268 | var GSUP_IE auth_tuple; |
| 2269 | var template AuthenticationParameterAUTNTLV autn; |
| 2270 | |
| 2271 | g_pars.vec := f_gen_auth_vec_3g(); |
| 2272 | autn := { |
| 2273 | elementIdentifier := '28'O, |
| 2274 | lengthIndicator := lengthof(g_pars.vec.autn), |
| 2275 | autnValue := g_pars.vec.autn |
| 2276 | }; |
| 2277 | auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand, |
| 2278 | g_pars.vec.sres, |
| 2279 | g_pars.vec.kc, |
| 2280 | g_pars.vec.ik, |
| 2281 | g_pars.vec.ck, |
| 2282 | g_pars.vec.autn, |
| 2283 | g_pars.vec.res)); |
| 2284 | log("GSUP sends 2G and 3G auth tuples", auth_tuple); |
| 2285 | GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi)); |
| 2286 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 2287 | |
| 2288 | var template PDU_L3_SGSN_MS auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand); |
| 2289 | auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn; |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2290 | BSSGP[0].receive(auth_ciph_req) -> value l3_mt; |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2291 | |
| 2292 | /* send the gmm auth failure with resync IE */ |
| 2293 | f_send_l3_gmm_llc(ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(g_pars.vec.auts)); |
| 2294 | |
| 2295 | /* wait for the GSUP resync request */ |
| 2296 | GSUP.receive(tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC( |
| 2297 | g_pars.imsi, |
| 2298 | g_pars.vec.auts, |
| 2299 | g_pars.vec.rand)); |
| 2300 | |
| 2301 | /* generate new key material */ |
| 2302 | g_pars.vec := f_gen_auth_vec_3g(); |
| 2303 | autn := { |
| 2304 | elementIdentifier := '28'O, |
| 2305 | lengthIndicator := lengthof(g_pars.vec.autn), |
| 2306 | autnValue := g_pars.vec.autn |
| 2307 | }; |
| 2308 | |
| 2309 | auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand, |
| 2310 | g_pars.vec.sres, |
| 2311 | g_pars.vec.kc, |
| 2312 | g_pars.vec.ik, |
| 2313 | g_pars.vec.ck, |
| 2314 | g_pars.vec.autn, |
| 2315 | g_pars.vec.res)); |
| 2316 | /* send new key material */ |
| 2317 | GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple)); |
| 2318 | |
| 2319 | /* wait for the new Auth Request */ |
| 2320 | auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand); |
| 2321 | auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn; |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2322 | BSSGP[0].receive(auth_ciph_req) -> value l3_mt; |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2323 | var BIT4 ac_ref := l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.acReferenceNumber.valueField; |
| 2324 | var template PDU_L3_MS_SGSN auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres); |
| 2325 | auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres); |
| 2326 | auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationParResp := { |
| 2327 | valueField := substr(g_pars.vec.res, 0, 4) |
| 2328 | }; |
| 2329 | auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationRespParExt := { |
| 2330 | elementIdentifier := '21'O, |
| 2331 | lengthIndicator := lengthof(g_pars.vec.res) - 4, |
| 2332 | valueField := substr(g_pars.vec.res, 4, lengthof(g_pars.vec.res) - 4) |
| 2333 | }; |
| 2334 | l3_mo := valueof(auth_ciph_resp); |
| 2335 | if (ispresent(l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest) and |
| 2336 | l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest.valueField == '001'B) { |
| 2337 | l3_mo.msgs.gprs_mm.authenticationAndCipheringResponse.imeisv := |
| 2338 | valueof(ts_MI_IMEISV_TLV(g_pars.imei & '0'H)); |
| 2339 | } |
| 2340 | f_send_l3_gmm_llc(l3_mo); |
| 2341 | deactivate(di); |
| 2342 | |
| 2343 | /* Expect SGSN to perform LU with HLR */ |
| 2344 | f_gmm_gsup_lu_isd(); |
| 2345 | |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2346 | BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> value l3_mt { |
| 2347 | f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept); |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2348 | } |
| 2349 | f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL); |
| 2350 | setverdict(pass); |
| 2351 | } |
| 2352 | |
| 2353 | testcase TC_attach_usim_resync() runs on test_CT { |
| 2354 | /* MS -> SGSN: Attach Request |
| 2355 | * MS <- SGSN: Identity Request IMSI |
| 2356 | * MS -> SGSN: Identity Response IMSI |
| 2357 | * MS <- SGSN: Identity Request IMEI |
| 2358 | * MS -> SGSN: Identity Response IMEI |
| 2359 | * HLR<- SGSN: SAI Request |
| 2360 | * HLR-> SGSN: SAI Response |
| 2361 | * MS <- SGSN: Auth Request |
| 2362 | * MS -> SGSN: Auth Failure (with AUTS) |
| 2363 | * HLR<- SGSN: SAI Request (with AUTS & RAND) |
| 2364 | * HLR-> SGSN: SAI Response (new key material) |
| 2365 | * MS <- SGSN: Auth Request (new key material) |
| 2366 | * MS -> SGSN: Auth Response |
| 2367 | * MS <- SGSN: Attach Accept |
| 2368 | * MS -> SGSN: Attach Complete |
| 2369 | */ |
| 2370 | var BSSGP_ConnHdlr vc_conn; |
| 2371 | f_init(); |
| 2372 | f_sleep(1.0); |
| 2373 | vc_conn := f_start_handler(refers(f_TC_attach_usim_resync), testcasename(), g_gb, 40); |
| 2374 | vc_conn.done; |
| 2375 | } |
| 2376 | |
Harald Welte | a05b807 | 2019-04-23 22:35:05 +0200 | [diff] [blame] | 2377 | |
| 2378 | /* Send LLC NULL to see if the SGSN survives it (OS#3952) */ |
| 2379 | private function f_TC_llc_null(charstring id) runs on BSSGP_ConnHdlr { |
| 2380 | f_gmm_attach(false, false); |
| 2381 | f_sleep(1.0); |
| 2382 | f_send_llc(ts_LLC_NULL('0'B, c_LLC_SAPI_LLGMM, LLC_CR_UL_CMD)); |
| 2383 | /* try to detach to check if SGSN is still alive */ |
| 2384 | f_detach_mo(c_GMM_DTT_MO_GPRS, true, true); |
| 2385 | } |
| 2386 | testcase TC_llc_null() runs on test_CT { |
| 2387 | var BSSGP_ConnHdlr vc_conn; |
| 2388 | f_init(); |
| 2389 | f_sleep(1.0); |
| 2390 | vc_conn := f_start_handler(refers(f_TC_llc_null), testcasename(), g_gb, 41); |
| 2391 | vc_conn.done; |
| 2392 | } |
| 2393 | |
Harald Welte | 645a151 | 2019-04-23 23:18:23 +0200 | [diff] [blame] | 2394 | /* Send LLC SABM to see if the SGSN rejects it properly with DM */ |
| 2395 | private function f_TC_llc_sabm_dm_llgmm(charstring id) runs on BSSGP_ConnHdlr { |
| 2396 | f_gmm_attach(false, false); |
| 2397 | f_sleep(1.0); |
| 2398 | f_send_llc(ts_LLC_SABM({}, '1'B, c_LLC_SAPI_LLGMM, LLC_CR_UL_CMD)); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2399 | BSSGP[0].receive(tr_LLC_DM(?, c_LLC_SAPI_LLGMM, LLC_CR_DL_RSP)); |
Harald Welte | 645a151 | 2019-04-23 23:18:23 +0200 | [diff] [blame] | 2400 | setverdict(pass); |
| 2401 | } |
| 2402 | testcase TC_llc_sabm_dm_llgmm() runs on test_CT { |
| 2403 | var BSSGP_ConnHdlr vc_conn; |
| 2404 | f_init(); |
| 2405 | f_sleep(1.0); |
| 2406 | vc_conn := f_start_handler(refers(f_TC_llc_sabm_dm_llgmm), testcasename(), g_gb, 42); |
| 2407 | vc_conn.done; |
| 2408 | } |
| 2409 | |
| 2410 | /* Send LLC SABM to see if the SGSN rejects it properly with DM */ |
| 2411 | private function f_TC_llc_sabm_dm_ll5(charstring id) runs on BSSGP_ConnHdlr { |
| 2412 | f_gmm_attach(false, false); |
| 2413 | f_sleep(1.0); |
| 2414 | f_send_llc(ts_LLC_SABM({}, '1'B, c_LLC_SAPI_LL5, LLC_CR_UL_CMD)); |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2415 | BSSGP[0].receive(tr_LLC_DM(?, c_LLC_SAPI_LL5, LLC_CR_DL_RSP)); |
Harald Welte | 645a151 | 2019-04-23 23:18:23 +0200 | [diff] [blame] | 2416 | setverdict(pass); |
| 2417 | } |
| 2418 | testcase TC_llc_sabm_dm_ll5() runs on test_CT { |
| 2419 | var BSSGP_ConnHdlr vc_conn; |
| 2420 | f_init(); |
| 2421 | f_sleep(1.0); |
| 2422 | vc_conn := f_start_handler(refers(f_TC_llc_sabm_dm_ll5), testcasename(), g_gb, 43); |
| 2423 | vc_conn.done; |
| 2424 | } |
| 2425 | |
Harald Welte | 2aaac1b | 2019-05-02 10:02:53 +0200 | [diff] [blame] | 2426 | /* test XID handshake with empty L3 info: expect empty return (some phones require that, OS#3426 */ |
| 2427 | private function f_TC_xid_empty_l3(charstring id) runs on BSSGP_ConnHdlr { |
| 2428 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 2429 | var template (value) XID_Information xid; |
| 2430 | var template XID_Information xid_rx; |
| 2431 | |
| 2432 | /* first perform regular attach */ |
| 2433 | f_TC_attach(id); |
| 2434 | /* then activate PDP context */ |
| 2435 | f_pdp_ctx_act(apars); |
| 2436 | |
| 2437 | /* start MO XID */ |
| 2438 | xid := { ts_XID_L3(''O) }; |
| 2439 | xid_rx := { tr_XID_L3(''O) }; |
| 2440 | f_send_llc(ts_LLC_XID_MO_CMD(xid, apars.sapi)); |
| 2441 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2442 | [] BSSGP[0].receive(tr_LLC_XID(xid_rx, apars.sapi)); |
Harald Welte | 2aaac1b | 2019-05-02 10:02:53 +0200 | [diff] [blame] | 2443 | [] as_xid(apars); |
| 2444 | } |
| 2445 | setverdict(pass); |
| 2446 | } |
| 2447 | testcase TC_xid_empty_l3() runs on test_CT { |
| 2448 | var BSSGP_ConnHdlr vc_conn; |
| 2449 | f_init(); |
| 2450 | f_sleep(1.0); |
| 2451 | vc_conn := f_start_handler(refers(f_TC_xid_empty_l3), testcasename(), g_gb, 44); |
| 2452 | vc_conn.done; |
| 2453 | } |
| 2454 | |
| 2455 | private function f_TC_xid_n201u(charstring id) runs on BSSGP_ConnHdlr { |
| 2456 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 2457 | var template (value) XID_Information xid; |
| 2458 | var template XID_Information xid_rx; |
| 2459 | |
| 2460 | /* first perform regular attach */ |
| 2461 | f_TC_attach(id); |
| 2462 | /* then activate PDP context */ |
| 2463 | f_pdp_ctx_act(apars); |
| 2464 | |
| 2465 | /* start MO XID */ |
| 2466 | xid := { ts_XID_N201U(1234) }; |
| 2467 | xid_rx := { tr_XID_N201U(1234) }; |
| 2468 | f_send_llc(ts_LLC_XID_MO_CMD(xid, apars.sapi)); |
| 2469 | alt { |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 2470 | [] BSSGP[0].receive(tr_LLC_XID_MT_RSP(xid_rx, apars.sapi)); |
Harald Welte | 2aaac1b | 2019-05-02 10:02:53 +0200 | [diff] [blame] | 2471 | [] as_xid(apars); |
| 2472 | } |
| 2473 | setverdict(pass); |
| 2474 | } |
| 2475 | testcase TC_xid_n201u() runs on test_CT { |
| 2476 | var BSSGP_ConnHdlr vc_conn; |
| 2477 | f_init(); |
| 2478 | f_sleep(1.0); |
| 2479 | vc_conn := f_start_handler(refers(f_TC_xid_n201u), testcasename(), g_gb, 45); |
| 2480 | vc_conn.done; |
| 2481 | } |
| 2482 | |
Alexander Couzens | 6bee087 | 2019-05-11 01:48:50 +0200 | [diff] [blame] | 2483 | private function f_TC_attach_pdp_act_gmm_detach(charstring id) runs on BSSGP_ConnHdlr { |
| 2484 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 2485 | |
| 2486 | /* first perform regular attach */ |
| 2487 | f_TC_attach(id); |
| 2488 | /* then activate PDP context */ |
| 2489 | f_pdp_ctx_act(apars); |
| 2490 | /* do a normal detach */ |
| 2491 | f_detach_mo(c_GMM_DTT_MO_GPRS, false, true); |
| 2492 | } |
| 2493 | |
| 2494 | testcase TC_attach_pdp_act_gmm_detach() runs on test_CT { |
| 2495 | /* MS -> SGSN: Attach Request |
| 2496 | * MS <-> SGSN: [..] |
| 2497 | * MS -> SGSN: Attach Complete |
| 2498 | * MS -> SGSN: PDP Activate Request |
| 2499 | * MS <- SGSN: PDP Activate Accept |
| 2500 | * MS -> SGSN: GMM Detach Request |
| 2501 | * MS <- SGSN: GMM Detach Accept |
| 2502 | */ |
| 2503 | var BSSGP_ConnHdlr vc_conn; |
| 2504 | f_init(); |
| 2505 | vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_gmm_detach), testcasename(), g_gb, 26); |
| 2506 | vc_conn.done; |
| 2507 | } |
Harald Welte | 645a151 | 2019-04-23 23:18:23 +0200 | [diff] [blame] | 2508 | |
| 2509 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 2510 | control { |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 2511 | execute( TC_attach() ); |
Neels Hofmeyr | 8df7d15 | 2018-03-14 19:03:28 +0100 | [diff] [blame] | 2512 | execute( TC_attach_mnc3() ); |
Neels Hofmeyr | 0ecb2e3 | 2018-04-30 15:13:55 +0200 | [diff] [blame] | 2513 | execute( TC_attach_umts_aka_umts_res() ); |
| 2514 | execute( TC_attach_umts_aka_gsm_sres() ); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 2515 | execute( TC_attach_auth_id_timeout() ); |
| 2516 | execute( TC_attach_auth_sai_timeout() ); |
Harald Welte | fe25388 | 2018-02-17 09:25:00 +0100 | [diff] [blame] | 2517 | execute( TC_attach_auth_sai_reject() ); |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 2518 | execute( TC_attach_gsup_lu_timeout() ); |
Harald Welte | b7c14e9 | 2018-02-17 09:29:16 +0100 | [diff] [blame] | 2519 | execute( TC_attach_gsup_lu_reject() ); |
Harald Welte | 3823e2e | 2018-02-16 21:53:48 +0100 | [diff] [blame] | 2520 | execute( TC_attach_combined() ); |
Harald Welte | 76dee09 | 2018-02-16 22:12:59 +0100 | [diff] [blame] | 2521 | execute( TC_attach_accept_all() ); |
Harald Welte | b2124b2 | 2018-02-16 22:26:56 +0100 | [diff] [blame] | 2522 | execute( TC_attach_closed() ); |
Alexander Couzens | 667dd7f | 2018-06-12 16:24:01 +0200 | [diff] [blame] | 2523 | execute( TC_attach_no_imei_response() ); |
Alexander Couzens | 53f2056 | 2018-06-12 16:24:12 +0200 | [diff] [blame] | 2524 | execute( TC_attach_no_imsi_response() ); |
Alexander Couzens | d81876a | 2018-08-07 12:43:16 +0200 | [diff] [blame] | 2525 | execute( TC_attach_closed_add_vty(), 20.0 ); |
| 2526 | execute( TC_attach_check_subscriber_list(), 20.0 ); |
| 2527 | execute( TC_attach_detach_check_subscriber_list(), 20.0 ); |
Alexander Couzens | 0085bd7 | 2018-06-12 19:08:44 +0200 | [diff] [blame] | 2528 | execute( TC_attach_check_complete_resend() ); |
Alexander Couzens | d81876a | 2018-08-07 12:43:16 +0200 | [diff] [blame] | 2529 | execute( TC_hlr_location_cancel_request_update(), 20.0 ); |
| 2530 | execute( TC_hlr_location_cancel_request_withdraw(), 20.0 ); |
| 2531 | execute( TC_hlr_location_cancel_request_unknown_subscriber_withdraw(), 20.0 ); |
| 2532 | execute( TC_hlr_location_cancel_request_unknown_subscriber_update(), 20.0 ); |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 2533 | execute( TC_rau_unknown() ); |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 2534 | execute( TC_attach_rau() ); |
Alexander Couzens | bfda921 | 2018-07-31 03:17:33 +0200 | [diff] [blame] | 2535 | execute( TC_attach_rau_a_a() ); |
Alexander Couzens | be837bd | 2018-07-31 04:20:11 +0200 | [diff] [blame] | 2536 | execute( TC_attach_rau_a_b() ); |
Alexander Couzens | 0c6324f | 2018-09-14 16:37:04 +0200 | [diff] [blame] | 2537 | execute( TC_attach_usim_resync() ); |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2538 | execute( TC_detach_unknown_nopoweroff() ); |
| 2539 | execute( TC_detach_unknown_poweroff() ); |
| 2540 | execute( TC_detach_nopoweroff() ); |
| 2541 | execute( TC_detach_poweroff() ); |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2542 | execute( TC_attach_pdp_act() ); |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 2543 | execute( TC_pdp_act_unattached() ); |
Harald Welte | 37692d8 | 2018-02-18 15:21:34 +0100 | [diff] [blame] | 2544 | execute( TC_attach_pdp_act_user() ); |
Harald Welte | 5b5ca1b | 2018-02-18 21:25:03 +0100 | [diff] [blame] | 2545 | execute( TC_attach_pdp_act_ggsn_reject() ); |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2546 | execute( TC_attach_pdp_act_user_deact_mo() ); |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2547 | execute( TC_attach_pdp_act_user_deact_mt() ); |
Alexander Couzens | 187ad5d | 2018-05-02 19:31:10 +0200 | [diff] [blame] | 2548 | execute( TC_attach_second_attempt() ); |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 2549 | execute( TC_attach_restart_ctr_echo() ); |
| 2550 | execute( TC_attach_restart_ctr_create() ); |
Pau Espin Pedrol | 72edc8a | 2018-07-16 15:10:08 +0200 | [diff] [blame] | 2551 | execute( TC_attach_pdp_act_deact_mt_t3395_expire() ); |
Pau Espin Pedrol | e6f071f | 2019-05-29 13:02:42 +0200 | [diff] [blame] | 2552 | execute( TC_attach_pdp_act_deact_gtp_retrans() ); |
| 2553 | execute( TC_attach_pdp_act_deact_gtp_retrans_resp() ); |
Pau Espin Pedrol | 482dde6 | 2018-07-18 13:47:42 +0200 | [diff] [blame] | 2554 | execute( TC_attach_pdp_act_user_error_ind_ggsn() ); |
Alexander Couzens | 6bee087 | 2019-05-11 01:48:50 +0200 | [diff] [blame] | 2555 | execute( TC_attach_pdp_act_gmm_detach() ); |
Alexander Couzens | cf3c93d | 2018-08-07 19:48:27 +0200 | [diff] [blame] | 2556 | execute( TC_attach_gmm_attach_req_while_gmm_attach() ); |
Harald Welte | a05b807 | 2019-04-23 22:35:05 +0200 | [diff] [blame] | 2557 | |
Harald Welte | 2aaac1b | 2019-05-02 10:02:53 +0200 | [diff] [blame] | 2558 | execute( TC_xid_empty_l3() ); |
| 2559 | execute( TC_xid_n201u() ); |
| 2560 | |
Harald Welte | a05b807 | 2019-04-23 22:35:05 +0200 | [diff] [blame] | 2561 | execute( TC_llc_null() ); |
Harald Welte | 645a151 | 2019-04-23 23:18:23 +0200 | [diff] [blame] | 2562 | execute( TC_llc_sabm_dm_llgmm() ); |
| 2563 | execute( TC_llc_sabm_dm_ll5() ); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 2564 | } |
Harald Welte | 96a33b0 | 2018-02-04 10:36:22 +0100 | [diff] [blame] | 2565 | |
| 2566 | |
| 2567 | |
| 2568 | } |