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