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