blob: b7448276fd5ab7553307890502c203e937c60fc0 [file] [log] [blame]
Neels Hofmeyr6a29d322017-01-25 15:04:16 +01001/* Osmocom MSC+VLR end-to-end tests */
2
3/* (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
4 *
5 * All Rights Reserved
6 *
7 * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#include "msc_vlr_tests.h"
25
Maxb0a43142018-02-06 19:19:52 +010026void test_no_authen(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010027{
28 struct vlr_subscr *vsub;
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020029
30 /* No auth only works on GERAN */
31 rx_from_ran = RAN_GERAN_A;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010032
Maxb0a43142018-02-06 19:19:52 +010033 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010034
35 btw("Location Update request causes a GSUP LU request to HLR");
36 lu_result_sent = RES_NONE;
37 gsup_expect_tx("04010809710000004026f0");
38 ms_sends_msg("050802008168000130089910070000006402");
39 OSMO_ASSERT(gsup_tx_confirmed);
40 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
41
42 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
43 gsup_rx("10010809710000004026f00804036470f1",
44 "12010809710000004026f0");
45 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
46
47 btw("having received subscriber data does not mean acceptance");
48 EXPECT_ACCEPTED(false);
49
50 thwart_rx_non_initial_requests();
51
52 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
53
54 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
Philipp Maierfbf66102017-04-09 12:32:51 +020055 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010056 gsup_rx("06010809710000004026f0", NULL);
57
58 btw("LU was successful, and the conn has already been closed");
59 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +020060 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010061 EXPECT_CONN_COUNT(0);
62
63 BTW("after a while, a new conn sends a CM Service Request");
64 cm_service_result_sent = RES_NONE;
65 ms_sends_msg("05247803305886089910070000006402");
66 OSMO_ASSERT(g_conn);
67 OSMO_ASSERT(g_conn->conn_fsm);
68 OSMO_ASSERT(g_conn->vsub);
69 VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
70 EXPECT_ACCEPTED(true);
71
72 btw("a USSD request is serviced");
73 dtap_expect_tx_ussd("Your extension is 46071\r");
Philipp Maierfbf66102017-04-09 12:32:51 +020074 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010075 ms_sends_msg("0b3b1c15a11302010002013b300b04010f0406aa510c061b017f0100");
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020076 VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +020077 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010078
79 btw("all requests serviced, conn has been released");
80 EXPECT_CONN_COUNT(0);
81
82 BTW("an SMS is sent, MS is paged");
83 paging_expect_imsi(imsi);
84 paging_sent = false;
85 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
86 OSMO_ASSERT(vsub);
87 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d");
88
89 send_sms(vsub, vsub,
90 "Privacy in residential applications is a desirable"
91 " marketing option.");
92
93 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d");
94 vlr_subscr_put(vsub);
95 vsub = NULL;
96 VERBOSE_ASSERT(paging_sent, == true, "%d");
97 VERBOSE_ASSERT(paging_stopped, == false, "%d");
98
99 btw("the subscriber and its pending request should remain");
100 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
101 OSMO_ASSERT(vsub);
102 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d");
103 vlr_subscr_put(vsub);
104
105 btw("MS replies with Paging Response, we deliver the SMS");
106 dtap_expect_tx("09" /* SMS messages */
107 "01" /* CP-DATA */
108 "58" /* length */
109 "01" /* Network to MS */
110 "00" /* reference */
111 /* originator (gsm411_send_sms() hardcodes this weird nr) */
112 "0791" "447758100650" /* 447785016005 */
113 "00" /* dest */
114 /* SMS TPDU */
115 "4c" /* len */
116 "00" /* SMS deliver */
117 "05806470f1" /* originating address 46071 */
118 "00" /* TP-PID */
119 "00" /* GSM default alphabet */
120 "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/
121 "000000" /* H-M-S */
122 "00" /* GMT+0 */
123 "44" /* data length */
124 "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e"
125 "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb"
126 "0c7ac3e9e9b7db05");
127 ms_sends_msg("06270703305882089910070000006402");
128 VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
129 VERBOSE_ASSERT(paging_stopped, == true, "%d");
130
131 btw("SMS was delivered, no requests pending for subscr");
132 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
133 OSMO_ASSERT(vsub);
134 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d");
135 vlr_subscr_put(vsub);
136
137 btw("conn is still open to wait for SMS ack dance");
138 EXPECT_CONN_COUNT(1);
139
140 btw("MS replies with CP-ACK for received SMS");
141 ms_sends_msg("8904");
142 EXPECT_CONN_COUNT(1);
143
144 btw("MS also sends RP-ACK, MSC in turn sends CP-ACK for that");
145 dtap_expect_tx("0904");
Philipp Maierfbf66102017-04-09 12:32:51 +0200146 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100147 ms_sends_msg("890106020041020000");
148 VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200149 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100150
151 btw("SMS is done, conn is gone");
152 EXPECT_CONN_COUNT(0);
153
154 BTW("subscriber detaches");
Philipp Maierfbf66102017-04-09 12:32:51 +0200155 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100156 ms_sends_msg("050130089910070000006402");
Philipp Maierfbf66102017-04-09 12:32:51 +0200157 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100158
159 EXPECT_CONN_COUNT(0);
160 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100161 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100162}
163
Maxb0a43142018-02-06 19:19:52 +0100164void test_no_authen_tmsi(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100165{
166 struct vlr_subscr *vsub;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100167
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200168 rx_from_ran = RAN_GERAN_A;
169
Maxb0a43142018-02-06 19:19:52 +0100170 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100171
172 net->vlr->cfg.assign_tmsi = true;
173
174 btw("Location Update request causes a GSUP LU request to HLR");
175 lu_result_sent = RES_NONE;
176 gsup_expect_tx("04010809710000004026f0");
177 ms_sends_msg("050802008168000130089910070000006402");
178 OSMO_ASSERT(gsup_tx_confirmed);
179 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
180
181 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
182 gsup_rx("10010809710000004026f00804036470f1",
183 "12010809710000004026f0");
184 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
185
186 btw("having received subscriber data does not mean acceptance");
187 EXPECT_ACCEPTED(false);
188 thwart_rx_non_initial_requests();
189 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
190
191 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
192 gsup_rx("06010809710000004026f0", NULL);
193
194 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
195 EXPECT_CONN_COUNT(1);
196 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
197 EXPECT_ACCEPTED(false);
198 thwart_rx_non_initial_requests();
199
200 btw("even though the TMSI is not acked, we can already find the subscr with it");
201 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100);
202 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
203 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
204 VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x");
205 VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x");
206 vlr_subscr_put(vsub);
207
208 btw("MS sends TMSI Realloc Complete");
Philipp Maierfbf66102017-04-09 12:32:51 +0200209 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100210 ms_sends_msg("055b");
Philipp Maierfbf66102017-04-09 12:32:51 +0200211 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100212
213 btw("LU was successful, and the conn has already been closed");
214 EXPECT_CONN_COUNT(0);
215
216 btw("Subscriber has the new TMSI");
217 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
218 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
219 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
220 VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x");
221 VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x");
222 vlr_subscr_put(vsub);
223
224 BTW("after a while, a new conn sends a CM Service Request using above TMSI");
225 cm_service_result_sent = RES_NONE;
226 ms_sends_msg("05247803305886" "05f4" "03020100");
227 OSMO_ASSERT(g_conn);
228 OSMO_ASSERT(g_conn->conn_fsm);
229 OSMO_ASSERT(g_conn->vsub);
230 VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
231 EXPECT_ACCEPTED(true);
232
233 btw("a USSD request is serviced");
234 dtap_expect_tx_ussd("Your extension is 46071\r");
Philipp Maierfbf66102017-04-09 12:32:51 +0200235 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100236 ms_sends_msg("0b3b1c15a11302010002013b300b04010f0406aa510c061b017f0100");
Philipp Maierfbf66102017-04-09 12:32:51 +0200237 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100238
239 btw("all requests serviced, conn has been released");
240 EXPECT_CONN_COUNT(0);
241
242 BTW("an SMS is sent, MS is paged using above TMSI");
243 paging_expect_tmsi(0x03020100);
244 paging_sent = false;
245 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100);
246 OSMO_ASSERT(vsub);
247 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d");
248
249 send_sms(vsub, vsub,
250 "Privacy in residential applications is a desirable"
251 " marketing option.");
252
253 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d");
254 vlr_subscr_put(vsub);
255 vsub = NULL;
256 VERBOSE_ASSERT(paging_sent, == true, "%d");
257 VERBOSE_ASSERT(paging_stopped, == false, "%d");
258
259 btw("the subscriber and its pending request should remain");
260 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
261 OSMO_ASSERT(vsub);
262 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d");
263 vlr_subscr_put(vsub);
264
265 btw("MS replies with Paging Response using TMSI, we deliver the SMS");
266 dtap_expect_tx("09" /* SMS messages */
267 "01" /* CP-DATA */
268 "58" /* length */
269 "01" /* Network to MS */
270 "00" /* reference */
271 /* originator (gsm411_send_sms() hardcodes this weird nr) */
272 "0791" "447758100650" /* 447785016005 */
273 "00" /* dest */
274 /* SMS TPDU */
275 "4c" /* len */
276 "00" /* SMS deliver */
277 "05806470f1" /* originating address 46071 */
278 "00" /* TP-PID */
279 "00" /* GSM default alphabet */
280 "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/
281 "000000" /* H-M-S */
282 "00" /* GMT+0 */
283 "44" /* data length */
284 "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e"
285 "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb"
286 "0c7ac3e9e9b7db05");
287 ms_sends_msg("06270703305882" "05f4" "03020100");
288 VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
289 VERBOSE_ASSERT(paging_stopped, == true, "%d");
290
291 btw("SMS was delivered, no requests pending for subscr");
292 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
293 OSMO_ASSERT(vsub);
294 VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d");
295 vlr_subscr_put(vsub);
296
297 btw("conn is still open to wait for SMS ack dance");
298 EXPECT_CONN_COUNT(1);
299
300 btw("MS replies with CP-ACK for received SMS");
301 ms_sends_msg("8904");
302 EXPECT_CONN_COUNT(1);
303
304 btw("MS also sends RP-ACK, MSC in turn sends CP-ACK for that");
305 dtap_expect_tx("0904");
Philipp Maierfbf66102017-04-09 12:32:51 +0200306 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100307 ms_sends_msg("890106020041020000");
308 VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200309 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100310
311 btw("SMS is done, conn is gone");
312 EXPECT_CONN_COUNT(0);
313
314 /* TODO: when the subscriber detaches, the vlr_subscr gets
315 * deallocated and we no longer know the TMSI. This case is covered by
316 * test_lu_unknown_tmsi(), so here I'd like to still have the TMSI.
317 BTW("subscriber detaches, using TMSI");
318 ms_sends_msg("050130" "05f4" "03020100");
319 EXPECT_CONN_COUNT(0);
320 */
321
322 BTW("subscriber sends LU Request, this time with the TMSI");
323 btw("Location Update request causes a GSUP LU request to HLR");
324 lu_result_sent = RES_NONE;
325 gsup_expect_tx("04010809710000004026f0");
326 ms_sends_msg("050802008168000130" "05f4" "03020100");
327 OSMO_ASSERT(gsup_tx_confirmed);
328 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
329
330 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
331 gsup_rx("10010809710000004026f00804036470f1",
332 "12010809710000004026f0");
333 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
334
335 btw("having received subscriber data does not mean acceptance");
336 EXPECT_ACCEPTED(false);
337 thwart_rx_non_initial_requests();
338 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
339
340 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
341 gsup_rx("06010809710000004026f0", NULL);
342
343 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
344 EXPECT_CONN_COUNT(1);
345 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
346 EXPECT_ACCEPTED(false);
347 thwart_rx_non_initial_requests();
348
349 btw("even though the TMSI is not acked, we can already find the subscr with it");
350 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504);
351 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
352 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
353 VERBOSE_ASSERT(vsub->tmsi_new, == 0x07060504, "0x%08x");
354 VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x");
355 vlr_subscr_put(vsub);
356
357 btw("MS sends TMSI Realloc Complete");
Philipp Maierfbf66102017-04-09 12:32:51 +0200358 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100359 ms_sends_msg("055b");
Philipp Maierfbf66102017-04-09 12:32:51 +0200360 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100361
362 btw("LU was successful, and the conn has already been closed");
363 EXPECT_CONN_COUNT(0);
364
365 btw("subscriber has the new TMSI");
366 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504);
367 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
368 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
369 VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x");
370 VERBOSE_ASSERT(vsub->tmsi, == 0x07060504, "0x%08x");
371 vlr_subscr_put(vsub);
372
373 BTW("subscriber detaches, using new TMSI");
Philipp Maierfbf66102017-04-09 12:32:51 +0200374 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100375 ms_sends_msg("050130" "05f4" "07060504");
Philipp Maierfbf66102017-04-09 12:32:51 +0200376 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100377
378 EXPECT_CONN_COUNT(0);
379 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100380 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100381}
382
Maxb0a43142018-02-06 19:19:52 +0100383void test_no_authen_imei(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100384{
385 struct vlr_subscr *vsub;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100386
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200387 rx_from_ran = RAN_GERAN_A;
388
Maxb0a43142018-02-06 19:19:52 +0100389 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100390
391 net->vlr->cfg.check_imei_rqd = true;
392
393 btw("Location Update request causes a GSUP LU request to HLR");
394 lu_result_sent = RES_NONE;
395 gsup_expect_tx("04010809710000004026f0");
396 ms_sends_msg("050802008168000130089910070000006402");
397 OSMO_ASSERT(gsup_tx_confirmed);
398 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
399
400 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
401 gsup_rx("10010809710000004026f00804036470f1",
402 "12010809710000004026f0");
403 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
404
405 btw("having received subscriber data does not mean acceptance");
406 EXPECT_ACCEPTED(false);
407 thwart_rx_non_initial_requests();
408 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
409
410 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS");
411 dtap_expect_tx("051802");
412 gsup_rx("06010809710000004026f0", NULL);
413
414 btw("We will only do business when the IMEI is known");
415 EXPECT_CONN_COUNT(1);
416 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
417 OSMO_ASSERT(vsub);
418 VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
419 vlr_subscr_put(vsub);
420 EXPECT_ACCEPTED(false);
421 thwart_rx_non_initial_requests();
422
423 btw("MS replies with an Identity Response");
Philipp Maierfbf66102017-04-09 12:32:51 +0200424 expect_bssap_clear();
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200425 /* 3GPP TS 23.003: 6.2.1 Composition of IMEI: the IMEI ends with a
426 * spare digit that shall be sent as zero by the MS. */
427 ms_sends_msg("0559084a32244332244302");
Philipp Maierfbf66102017-04-09 12:32:51 +0200428 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100429
430 btw("LU was successful, and the conn has already been closed");
431 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
432 EXPECT_CONN_COUNT(0);
433
434 btw("Subscriber has the IMEI");
435 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
436 OSMO_ASSERT(vsub);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200437 VERBOSE_ASSERT(strcmp(vsub->imei, "423423423423420"), == 0, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100438 vlr_subscr_put(vsub);
439
440 BTW("subscriber detaches");
Philipp Maierfbf66102017-04-09 12:32:51 +0200441 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100442 ms_sends_msg("050130089910070000006402");
Philipp Maierfbf66102017-04-09 12:32:51 +0200443 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100444
445 EXPECT_CONN_COUNT(0);
446 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100447 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100448}
449
Maxb0a43142018-02-06 19:19:52 +0100450void test_no_authen_tmsi_imei(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100451{
452 struct vlr_subscr *vsub;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100453
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200454 rx_from_ran = RAN_GERAN_A;
455
Maxb0a43142018-02-06 19:19:52 +0100456 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100457
458 net->vlr->cfg.assign_tmsi = true;
459 net->vlr->cfg.check_imei_rqd = true;
460
461 btw("Location Update request causes a GSUP LU request to HLR");
462 lu_result_sent = RES_NONE;
463 gsup_expect_tx("04010809710000004026f0");
464 ms_sends_msg("050802008168000130089910070000006402");
465 OSMO_ASSERT(gsup_tx_confirmed);
466 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
467
468 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
469 gsup_rx("10010809710000004026f00804036470f1",
470 "12010809710000004026f0");
471 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
472
473 btw("having received subscriber data does not mean acceptance");
474 EXPECT_ACCEPTED(false);
475 thwart_rx_non_initial_requests();
476 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
477
478 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS");
479 dtap_expect_tx("051802");
480 gsup_rx("06010809710000004026f0", NULL);
481
482 btw("We will only do business when the IMEI is known");
483 EXPECT_CONN_COUNT(1);
484 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
485 OSMO_ASSERT(vsub);
486 VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
487 vlr_subscr_put(vsub);
488 EXPECT_ACCEPTED(false);
489 thwart_rx_non_initial_requests();
490
491 btw("MS replies with an Identity Response");
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200492 ms_sends_msg("0559084a32244332244302");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100493
494 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
495 EXPECT_CONN_COUNT(1);
496 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
497 EXPECT_ACCEPTED(false);
498 thwart_rx_non_initial_requests();
499
500 btw("MS sends TMSI Realloc Complete");
Philipp Maierfbf66102017-04-09 12:32:51 +0200501 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100502 ms_sends_msg("055b");
Philipp Maierfbf66102017-04-09 12:32:51 +0200503 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100504
505 btw("LU was successful, and the conn has already been closed");
506 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
507 EXPECT_CONN_COUNT(0);
508
509 btw("Subscriber has the IMEI and TMSI");
510 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
511 OSMO_ASSERT(vsub);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200512 VERBOSE_ASSERT(strcmp(vsub->imei, "423423423423420"), == 0, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100513 VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x");
514 vlr_subscr_put(vsub);
515
516 BTW("subscriber detaches");
Philipp Maierfbf66102017-04-09 12:32:51 +0200517 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100518 ms_sends_msg("050130089910070000006402");
Philipp Maierfbf66102017-04-09 12:32:51 +0200519 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100520
521 EXPECT_CONN_COUNT(0);
522 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100523 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100524}
525
Maxb0a43142018-02-06 19:19:52 +0100526void test_no_authen_imeisv(uint8_t nr, const char *imsi)
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200527{
528 struct vlr_subscr *vsub;
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200529
530 /* No auth only works on GERAN */
531 rx_from_ran = RAN_GERAN_A;
532
Maxb0a43142018-02-06 19:19:52 +0100533 comment_start(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200534
535 net->vlr->cfg.retrieve_imeisv_early = true;
536
537 btw("Location Update request causes an IMEISV ID request back to the MS");
538 lu_result_sent = RES_NONE;
539 dtap_expect_tx("051803");
540 ms_sends_msg("050802008168000130089910070000006402");
541 OSMO_ASSERT(dtap_tx_confirmed);
542
543 btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
544 gsup_expect_tx("04010809710000004026f0");
545 ms_sends_msg("0559094332244332244372f5");
546 OSMO_ASSERT(gsup_tx_confirmed);
547 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
548
549 btw("Subscriber has the IMEISV from the ID Response");
550 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
551 OSMO_ASSERT(vsub);
552 VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
553 vlr_subscr_put(vsub);
554
555 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
556 gsup_rx("10010809710000004026f00804036470f1",
557 "12010809710000004026f0");
558 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
559
560 btw("having received subscriber data does not mean acceptance");
561 EXPECT_ACCEPTED(false);
562
563 thwart_rx_non_initial_requests();
564
565 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
566
567 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
568 expect_bssap_clear();
569 gsup_rx("06010809710000004026f0", NULL);
570
571 btw("LU was successful, and the conn has already been closed");
572 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
573 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
574 EXPECT_CONN_COUNT(0);
575
576 BTW("subscriber detaches");
577 expect_bssap_clear();
578 ms_sends_msg("050130089910070000006402");
579 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
580
581 EXPECT_CONN_COUNT(0);
582 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100583 comment_end(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200584}
585
Maxb0a43142018-02-06 19:19:52 +0100586void test_no_authen_imeisv_imei(uint8_t nr, const char *imsi)
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200587{
588 struct vlr_subscr *vsub;
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200589
590 rx_from_ran = RAN_GERAN_A;
591
Maxb0a43142018-02-06 19:19:52 +0100592 comment_start(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200593
594 net->vlr->cfg.retrieve_imeisv_early = true;
595 net->vlr->cfg.check_imei_rqd = true;
596
597 btw("Location Update request causes an IMEISV ID request back to the MS");
598 lu_result_sent = RES_NONE;
599 dtap_expect_tx("051803");
600 ms_sends_msg("050802008168000130089910070000006402");
601 OSMO_ASSERT(dtap_tx_confirmed);
602
603 btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
604 gsup_expect_tx("04010809710000004026f0");
605 ms_sends_msg("0559094332244332244372f5");
606 OSMO_ASSERT(gsup_tx_confirmed);
607 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
608
609 btw("Subscriber has the IMEISV from the ID Response");
610 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
611 OSMO_ASSERT(vsub);
612 VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
613 vlr_subscr_put(vsub);
614
615 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
616 gsup_rx("10010809710000004026f00804036470f1",
617 "12010809710000004026f0");
618 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
619
620 btw("having received subscriber data does not mean acceptance");
621 EXPECT_ACCEPTED(false);
622 thwart_rx_non_initial_requests();
623 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
624
625 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS");
626 dtap_expect_tx("051802");
627 gsup_rx("06010809710000004026f0", NULL);
628
629 btw("We will only do business when the IMEI is known");
630 EXPECT_CONN_COUNT(1);
631 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
632 OSMO_ASSERT(vsub);
633 VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
634 vlr_subscr_put(vsub);
635 EXPECT_ACCEPTED(false);
636 thwart_rx_non_initial_requests();
637
638 btw("MS replies with an Identity Response");
639 expect_bssap_clear();
640 ms_sends_msg("0559084a32244332244302");
641 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
642
643 btw("LU was successful, and the conn has already been closed");
644 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
645 EXPECT_CONN_COUNT(0);
646
647 btw("Subscriber has the IMEI");
648 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
649 OSMO_ASSERT(vsub);
650 VERBOSE_ASSERT(strcmp(vsub->imei, "423423423423420"), == 0, "%d");
651 vlr_subscr_put(vsub);
652
653 BTW("subscriber detaches");
654 expect_bssap_clear();
655 ms_sends_msg("050130089910070000006402");
656 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
657
658 EXPECT_CONN_COUNT(0);
659 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100660 comment_end(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200661}
662
Maxb0a43142018-02-06 19:19:52 +0100663void test_no_authen_imeisv_tmsi(uint8_t nr, const char *imsi)
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200664{
665 struct vlr_subscr *vsub;
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200666
667 rx_from_ran = RAN_GERAN_A;
668
Maxb0a43142018-02-06 19:19:52 +0100669 comment_start(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200670
671 net->vlr->cfg.retrieve_imeisv_early = true;
672 net->vlr->cfg.assign_tmsi = true;
673
674 btw("Location Update request causes an IMEISV ID request back to the MS");
675 lu_result_sent = RES_NONE;
676 dtap_expect_tx("051803");
677 ms_sends_msg("050802008168000130089910070000006402");
678 OSMO_ASSERT(dtap_tx_confirmed);
679
680 btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
681 gsup_expect_tx("04010809710000004026f0");
682 ms_sends_msg("0559094332244332244372f5");
683 OSMO_ASSERT(gsup_tx_confirmed);
684 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
685
686 btw("Subscriber has the IMEISV from the ID Response");
687 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
688 OSMO_ASSERT(vsub);
689 VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
690 vlr_subscr_put(vsub);
691
692 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
693 gsup_rx("10010809710000004026f00804036470f1",
694 "12010809710000004026f0");
695 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
696
697 btw("having received subscriber data does not mean acceptance");
698 EXPECT_ACCEPTED(false);
699 thwart_rx_non_initial_requests();
700 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
701
702 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
703 gsup_rx("06010809710000004026f0", NULL);
704
705 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
706 EXPECT_CONN_COUNT(1);
707 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
708 EXPECT_ACCEPTED(false);
709 thwart_rx_non_initial_requests();
710
711 btw("even though the TMSI is not acked, we can already find the subscr with it");
712 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100);
713 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
714 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
715 VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x");
716 VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x");
717 vlr_subscr_put(vsub);
718
719 btw("MS sends TMSI Realloc Complete");
720 expect_bssap_clear();
721 ms_sends_msg("055b");
722 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
723
724 btw("LU was successful, and the conn has already been closed");
725 EXPECT_CONN_COUNT(0);
726
727
728 BTW("subscriber sends LU Request, this time with the TMSI");
729 btw("Location Update request causes an IMEISV ID request back to the MS");
730 lu_result_sent = RES_NONE;
731 dtap_expect_tx("051803");
732 ms_sends_msg("050802008168000130089910070000006402");
733 OSMO_ASSERT(dtap_tx_confirmed);
734
735 btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
736 gsup_expect_tx("04010809710000004026f0");
737 ms_sends_msg("0559095332244332244372f6");
738 OSMO_ASSERT(gsup_tx_confirmed);
739 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
740
741 btw("Subscriber has the IMEISV from the ID Response");
742 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
743 OSMO_ASSERT(vsub);
744 VERBOSE_ASSERT(strcmp(vsub->imeisv, "5234234234234276"), == 0, "%d");
745 vlr_subscr_put(vsub);
746
747 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
748 gsup_rx("10010809710000004026f00804036470f1",
749 "12010809710000004026f0");
750 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
751
752 btw("having received subscriber data does not mean acceptance");
753 EXPECT_ACCEPTED(false);
754 thwart_rx_non_initial_requests();
755 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
756
757 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
758 gsup_rx("06010809710000004026f0", NULL);
759
760 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
761 EXPECT_CONN_COUNT(1);
762 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
763 EXPECT_ACCEPTED(false);
764 thwart_rx_non_initial_requests();
765
766 btw("even though the TMSI is not acked, we can already find the subscr with it");
767 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504);
768 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
769 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
770 VERBOSE_ASSERT(vsub->tmsi_new, == 0x07060504, "0x%08x");
771 VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x");
772 vlr_subscr_put(vsub);
773
774 btw("MS sends TMSI Realloc Complete");
775 expect_bssap_clear();
776 ms_sends_msg("055b");
777 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
778
779 btw("LU was successful, and the conn has already been closed");
780 EXPECT_CONN_COUNT(0);
781
782 btw("subscriber has the new TMSI");
783 vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504);
784 VERBOSE_ASSERT(vsub != NULL, == true, "%d");
785 VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
786 VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x");
787 VERBOSE_ASSERT(vsub->tmsi, == 0x07060504, "0x%08x");
788 vlr_subscr_put(vsub);
789
790 BTW("subscriber detaches, using new TMSI");
791 expect_bssap_clear();
792 ms_sends_msg("050130" "05f4" "07060504");
793 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
794
795 EXPECT_CONN_COUNT(0);
796 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100797 comment_end(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200798}
799
Maxb0a43142018-02-06 19:19:52 +0100800void test_no_authen_imeisv_tmsi_imei(uint8_t nr, const char *imsi)
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200801{
802 struct vlr_subscr *vsub;
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200803
804 rx_from_ran = RAN_GERAN_A;
805
Maxb0a43142018-02-06 19:19:52 +0100806 comment_start(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200807
808 net->vlr->cfg.retrieve_imeisv_early = true;
809 net->vlr->cfg.assign_tmsi = true;
810 net->vlr->cfg.check_imei_rqd = true;
811
812 btw("Location Update request causes an IMEISV ID request back to the MS");
813 lu_result_sent = RES_NONE;
814 dtap_expect_tx("051803");
815 ms_sends_msg("050802008168000130089910070000006402");
816 OSMO_ASSERT(dtap_tx_confirmed);
817
818 btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
819 gsup_expect_tx("04010809710000004026f0");
820 ms_sends_msg("0559094332244332244372f5");
821 OSMO_ASSERT(gsup_tx_confirmed);
822 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
823
824 btw("Subscriber has the IMEISV from the ID Response");
825 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
826 OSMO_ASSERT(vsub);
827 VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
828 vlr_subscr_put(vsub);
829
830 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
831 gsup_rx("10010809710000004026f00804036470f1",
832 "12010809710000004026f0");
833 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
834
835 btw("having received subscriber data does not mean acceptance");
836 EXPECT_ACCEPTED(false);
837 thwart_rx_non_initial_requests();
838 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
839
840 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS");
841 dtap_expect_tx("051802");
842 gsup_rx("06010809710000004026f0", NULL);
843
844 btw("We will only do business when the IMEI is known");
845 EXPECT_CONN_COUNT(1);
846 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
847 OSMO_ASSERT(vsub);
848 VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
849 vlr_subscr_put(vsub);
850 EXPECT_ACCEPTED(false);
851 thwart_rx_non_initial_requests();
852
853 btw("MS replies with an Identity Response");
854 ms_sends_msg("0559084a32244332244302");
855
856 btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
857 EXPECT_CONN_COUNT(1);
858 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
859 EXPECT_ACCEPTED(false);
860 thwart_rx_non_initial_requests();
861
862 btw("MS sends TMSI Realloc Complete");
863 expect_bssap_clear();
864 ms_sends_msg("055b");
865 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
866
867 btw("LU was successful, and the conn has already been closed");
868 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
869 EXPECT_CONN_COUNT(0);
870
871 btw("Subscriber has the IMEISV, IMEI and TMSI");
872 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
873 OSMO_ASSERT(vsub);
874 VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
875 VERBOSE_ASSERT(strcmp(vsub->imei, "423423423423420"), == 0, "%d");
876 VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x");
877 vlr_subscr_put(vsub);
878
879 BTW("subscriber detaches");
880 expect_bssap_clear();
881 ms_sends_msg("050130089910070000006402");
882 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
883
884 EXPECT_CONN_COUNT(0);
885 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100886 comment_end(nr, imsi);
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200887}
888
889
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100890msc_vlr_test_func_t msc_vlr_tests[] = {
891 test_no_authen,
892 test_no_authen_tmsi,
893 test_no_authen_imei,
894 test_no_authen_tmsi_imei,
Neels Hofmeyr34d33bd2017-07-20 02:56:21 +0200895 test_no_authen_imeisv,
896 test_no_authen_imeisv_imei,
897 test_no_authen_imeisv_tmsi,
898 test_no_authen_imeisv_tmsi_imei,
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100899 NULL
900};