blob: 2d9b863a664fa46ff12c7acd4bc8fccfb2aff37d [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_hlr_rej_auth_info_unknown_imsi(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010027{
Maxb0a43142018-02-06 19:19:52 +010028 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010029
30 net->authentication_required = true;
31
32 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
33 lu_result_sent = RES_NONE;
34 gsup_expect_tx("08010809710000004026f0");
35 ms_sends_msg("050802008168000130089910070000006402");
36 OSMO_ASSERT(gsup_tx_confirmed);
37 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
38
39 btw("HLR sends _SEND_AUTH_INFO_ERROR = unknown IMSI");
40 auth_request_sent = false;
Philipp Maierfbf66102017-04-09 12:32:51 +020041 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010042 gsup_rx("09" "010809710000004026f0" "020102", NULL);
43 VERBOSE_ASSERT(auth_request_sent, == false, "%d");
44 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +020045 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010046
47 EXPECT_CONN_COUNT(0);
48 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +010049 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010050}
51
Maxb0a43142018-02-06 19:19:52 +010052void test_hlr_rej_auth_info_net_fail(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010053{
Maxb0a43142018-02-06 19:19:52 +010054 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010055
56 net->authentication_required = true;
57
58 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
59 lu_result_sent = RES_NONE;
60 gsup_expect_tx("08010809710000004026f0");
61 ms_sends_msg("050802008168000130089910070000006402");
62 OSMO_ASSERT(gsup_tx_confirmed);
63 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
64
65 btw("HLR sends _SEND_AUTH_INFO_ERROR = net fail");
66 auth_request_sent = false;
Philipp Maierfbf66102017-04-09 12:32:51 +020067 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010068 gsup_rx("09" "010809710000004026f0" "020111", NULL);
69 VERBOSE_ASSERT(auth_request_sent, == false, "%d");
70 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +020071 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010072
73 EXPECT_CONN_COUNT(0);
74 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +010075 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010076}
77
Maxb0a43142018-02-06 19:19:52 +010078void test_hlr_rej_auth_info_net_fail_no_reuse_tuples(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010079{
80 struct vlr_subscr *vsub;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010081
Maxb0a43142018-02-06 19:19:52 +010082 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010083
84 net->authentication_required = true;
85 net->vlr->cfg.auth_reuse_old_sets_on_error = false;
Neels Hofmeyr33f53412017-10-29 02:11:18 +010086 net->vlr->cfg.auth_tuple_max_reuse_count = 0;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010087
88 BTW("Submit a used auth tuple in the VLR");
89 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
90 lu_result_sent = RES_NONE;
91 gsup_expect_tx("08010809710000004026f0");
92 ms_sends_msg("050802008168000130089910070000006402");
93 OSMO_ASSERT(gsup_tx_confirmed);
94 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
95
96 btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS");
97 auth_request_sent = false;
98 auth_request_expect_rand = "585df1ae287f6e273dce07090d61320b";
99 auth_request_expect_autn = NULL;
100 /* Based on a Ki of 000102030405060708090a0b0c0d0e0f */
101 gsup_rx("0a"
102 /* imsi */
103 "0108" "09710000004026f0"
104 /* auth vectors... */
105 /* TL TL rand */
106 "0322" "2010" "585df1ae287f6e273dce07090d61320b"
107 /* TL sres TL kc */
108 "2104" "2d8b2c3e" "2208" "61855fb81fc2a800"
109 ,NULL);
110 VERBOSE_ASSERT(auth_request_sent, == true, "%d");
111 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
112
113 btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
114 gsup_expect_tx("04010809710000004026f0");
115 ms_sends_msg("05542d8b2c3e");
116 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
117
118 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
119 gsup_rx("10010809710000004026f00804036470f1",
120 "12010809710000004026f0");
121 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
122
123 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
Philipp Maierfbf66102017-04-09 12:32:51 +0200124 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100125 gsup_rx("06010809710000004026f0", NULL);
Philipp Maierfbf66102017-04-09 12:32:51 +0200126 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100127
128 btw("LU was successful, and the conn has already been closed");
129 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
130 EXPECT_CONN_COUNT(0);
131
132
133 BTW("Now one auth tuple is available, but used.");
134 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
135 OSMO_ASSERT(vsub);
136 OSMO_ASSERT(vsub->last_tuple);
137 VERBOSE_ASSERT(vsub->last_tuple->use_count, == 1, "%d");
138 /* no need to look at all auth tuples, the ongoing test would take an
139 * unexpected course if there were more. */
140 vlr_subscr_put(vsub);
141
142 BTW("Another LU wants to get new tuples; HLR sends Network Failure, we reject.");
143
144 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
145 lu_result_sent = RES_NONE;
146 gsup_expect_tx("08010809710000004026f0");
147 ms_sends_msg("050802008168000130089910070000006402");
148 OSMO_ASSERT(gsup_tx_confirmed);
149 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
150
151 btw("HLR sends _SEND_AUTH_INFO_ERROR = net fail");
152 auth_request_sent = false;
Philipp Maierfbf66102017-04-09 12:32:51 +0200153 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100154 gsup_rx("09" "010809710000004026f0" "020111", NULL);
155 VERBOSE_ASSERT(auth_request_sent, == false, "%d");
156 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
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_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples(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
Maxb0a43142018-02-06 19:19:52 +0100168 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100169
170 net->authentication_required = true;
171 net->vlr->cfg.auth_reuse_old_sets_on_error = true;
Neels Hofmeyr33f53412017-10-29 02:11:18 +0100172 net->vlr->cfg.auth_tuple_max_reuse_count = 0;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100173
174 BTW("Submit a used auth tuple in the VLR");
175 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
176 lu_result_sent = RES_NONE;
177 gsup_expect_tx("08010809710000004026f0");
178 ms_sends_msg("050802008168000130089910070000006402");
179 OSMO_ASSERT(gsup_tx_confirmed);
180 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
181
182 btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS");
183 auth_request_sent = false;
184 auth_request_expect_rand = "585df1ae287f6e273dce07090d61320b";
185 auth_request_expect_autn = NULL;
186 /* Based on a Ki of 000102030405060708090a0b0c0d0e0f */
187 gsup_rx("0a"
188 /* imsi */
189 "0108" "09710000004026f0"
190 /* auth vectors... */
191 /* TL TL rand */
192 "0322" "2010" "585df1ae287f6e273dce07090d61320b"
193 /* TL sres TL kc */
194 "2104" "2d8b2c3e" "2208" "61855fb81fc2a800"
195 ,NULL);
196 VERBOSE_ASSERT(auth_request_sent, == true, "%d");
197 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
198
199 btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
200 gsup_expect_tx("04010809710000004026f0");
201 ms_sends_msg("05542d8b2c3e");
202 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
203
204 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
205 gsup_rx("10010809710000004026f00804036470f1",
206 "12010809710000004026f0");
207 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
208
209 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
Philipp Maierfbf66102017-04-09 12:32:51 +0200210 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100211 gsup_rx("06010809710000004026f0", NULL);
Philipp Maierfbf66102017-04-09 12:32:51 +0200212 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100213
214 btw("LU was successful, and the conn has already been closed");
215 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
216 EXPECT_CONN_COUNT(0);
217
218
219 BTW("Now one auth tuple is available, but used.");
220 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
221 OSMO_ASSERT(vsub);
222 OSMO_ASSERT(vsub->last_tuple);
223 VERBOSE_ASSERT(vsub->last_tuple->use_count, == 1, "%d");
224 /* no need to look at all auth tuples, the ongoing test would take an
225 * unexpected course if there were more. */
226 vlr_subscr_put(vsub);
227
228 BTW("Another LU wants to get new tuples; HLR sends IMSI Unknown. Even though we would re-use an old tuple, reject the unknown IMSI.");
229 VERBOSE_ASSERT(net->vlr->cfg.auth_reuse_old_sets_on_error, == true, "%d");
230
231 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
232 lu_result_sent = RES_NONE;
233 gsup_expect_tx("08010809710000004026f0");
234 ms_sends_msg("050802008168000130089910070000006402");
235 OSMO_ASSERT(gsup_tx_confirmed);
236 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
237
238 btw("HLR sends _SEND_AUTH_INFO_ERROR = unknown IMSI");
239 auth_request_sent = false;
Philipp Maierfbf66102017-04-09 12:32:51 +0200240 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100241 gsup_rx("09" "010809710000004026f0" "020102", NULL);
242 VERBOSE_ASSERT(auth_request_sent, == false, "%d");
243 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200244 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100245
246 EXPECT_CONN_COUNT(0);
247 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100248 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100249}
250
Maxb0a43142018-02-06 19:19:52 +0100251void test_hlr_acc_but_no_auth_tuples(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100252{
Maxb0a43142018-02-06 19:19:52 +0100253 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100254
255 net->authentication_required = true;
256 net->vlr->cfg.auth_reuse_old_sets_on_error = true;
Neels Hofmeyr33f53412017-10-29 02:11:18 +0100257 net->vlr->cfg.auth_tuple_max_reuse_count = 0;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100258
259 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
260 lu_result_sent = RES_NONE;
261 gsup_expect_tx("08010809710000004026f0");
262 ms_sends_msg("050802008168000130089910070000006402");
263 OSMO_ASSERT(gsup_tx_confirmed);
264 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
265
266 btw("from HLR, rx _SEND_AUTH_INFO_RESULT but it lacks auth tuples");
267 auth_request_sent = false;
Philipp Maierfbf66102017-04-09 12:32:51 +0200268 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100269 gsup_rx("0a"
270 /* imsi */
271 "0108" "09710000004026f0"
272 /* NO auth vectors */
273 ,NULL);
274 VERBOSE_ASSERT(auth_request_sent, == false, "%d");
275 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200276 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100277
278 EXPECT_CONN_COUNT(0);
279 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100280 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100281}
282
Maxb0a43142018-02-06 19:19:52 +0100283void test_hlr_rej_auth_info_net_fail_reuse_tuples(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100284{
285 struct vlr_subscr *vsub;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100286
Maxb0a43142018-02-06 19:19:52 +0100287 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100288
289 net->authentication_required = true;
290 net->vlr->cfg.auth_reuse_old_sets_on_error = true;
Neels Hofmeyr33f53412017-10-29 02:11:18 +0100291 net->vlr->cfg.auth_tuple_max_reuse_count = 0;
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100292
293 BTW("Submit a used auth tuple in the VLR");
294 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
295 lu_result_sent = RES_NONE;
296 gsup_expect_tx("08010809710000004026f0");
297 ms_sends_msg("050802008168000130089910070000006402");
298 OSMO_ASSERT(gsup_tx_confirmed);
299 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
300
301 btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS");
302 auth_request_sent = false;
303 auth_request_expect_rand = "585df1ae287f6e273dce07090d61320b";
304 auth_request_expect_autn = NULL;
305 /* Based on a Ki of 000102030405060708090a0b0c0d0e0f */
306 gsup_rx("0a"
307 /* imsi */
308 "0108" "09710000004026f0"
309 /* auth vectors... */
310 /* TL TL rand */
311 "0322" "2010" "585df1ae287f6e273dce07090d61320b"
312 /* TL sres TL kc */
313 "2104" "2d8b2c3e" "2208" "61855fb81fc2a800"
314 ,NULL);
315 VERBOSE_ASSERT(auth_request_sent, == true, "%d");
316 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
317
318 btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
319 gsup_expect_tx("04010809710000004026f0");
320 ms_sends_msg("05542d8b2c3e");
321 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
322
323 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
324 gsup_rx("10010809710000004026f00804036470f1",
325 "12010809710000004026f0");
326 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
327
328 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
Philipp Maierfbf66102017-04-09 12:32:51 +0200329 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100330 gsup_rx("06010809710000004026f0", NULL);
Philipp Maierfbf66102017-04-09 12:32:51 +0200331 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100332
333 btw("LU was successful, and the conn has already been closed");
334 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
335 EXPECT_CONN_COUNT(0);
336
337
338 BTW("Now one auth tuple is available, but used.");
339 vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
340 OSMO_ASSERT(vsub);
341 OSMO_ASSERT(vsub->last_tuple);
342 VERBOSE_ASSERT(vsub->last_tuple->use_count, == 1, "%d");
343 /* no need to look at all auth tuples, the ongoing test would take an
344 * unexpected course if there were more. */
345 vlr_subscr_put(vsub);
346
347 BTW("Another LU wants to get new tuples; even though HLR sends Network Failure, we are reusing the old tuples.");
348
349 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
350 lu_result_sent = RES_NONE;
351 gsup_expect_tx("08010809710000004026f0");
352 ms_sends_msg("050802008168000130089910070000006402");
353 OSMO_ASSERT(gsup_tx_confirmed);
354 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
355
356 btw("HLR sends _SEND_AUTH_INFO_ERROR = net fail");
357 auth_request_sent = false;
358 gsup_rx("09" "010809710000004026f0" "020111", NULL);
359 VERBOSE_ASSERT(auth_request_sent, == true, "%d");
360 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
361
362 btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
363 gsup_expect_tx("04010809710000004026f0");
364 ms_sends_msg("05542d8b2c3e");
365 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
366
367 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
368 gsup_rx("10010809710000004026f00804036470f1",
369 "12010809710000004026f0");
370 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
371
372 btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
Philipp Maierfbf66102017-04-09 12:32:51 +0200373 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100374 gsup_rx("06010809710000004026f0", NULL);
Philipp Maierfbf66102017-04-09 12:32:51 +0200375 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100376
377 btw("LU was successful, and the conn has already been closed");
378 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
379 EXPECT_CONN_COUNT(0);
380
381 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100382 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100383}
384
Maxb0a43142018-02-06 19:19:52 +0100385void test_hlr_rej_lu(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100386{
Maxb0a43142018-02-06 19:19:52 +0100387 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100388
389 btw("Location Update request causes a GSUP LU request to HLR");
390 lu_result_sent = RES_NONE;
391 gsup_expect_tx("04010809710000004026f0");
392 ms_sends_msg("050802008168000130089910070000006402");
393 OSMO_ASSERT(gsup_tx_confirmed);
394 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
395
396 btw("HLR sends UPDATE_LOCATION_ERROR");
Philipp Maierfbf66102017-04-09 12:32:51 +0200397 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100398 gsup_rx("05" "010809710000004026f0" "020102",
399 NULL);
400 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200401 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100402 EXPECT_CONN_COUNT(0);
403
404 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100405 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100406}
407
Maxb0a43142018-02-06 19:19:52 +0100408void test_hlr_no_insert_data(uint8_t nr, const char *imsi)
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100409{
Maxb0a43142018-02-06 19:19:52 +0100410 comment_start(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100411
412 btw("Location Update request causes a GSUP LU request to HLR");
413 lu_result_sent = RES_NONE;
414 gsup_expect_tx("04010809710000004026f0");
415 ms_sends_msg("050802008168000130089910070000006402");
416 OSMO_ASSERT(gsup_tx_confirmed);
417 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
418
419 btw("HLR sends only _UPDATE_LOCATION_RESULT, no INSERT DATA");
Philipp Maierfbf66102017-04-09 12:32:51 +0200420 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100421 gsup_rx("06010809710000004026f0", NULL);
Philipp Maierfbf66102017-04-09 12:32:51 +0200422 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100423
424 /* TODO should we wait for OSMO_GSUP_MSGT_INSERT_DATA_REQUEST? */
425
426 btw("LU was successful, and the conn has already been closed");
427 VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
428
429 EXPECT_CONN_COUNT(0);
430 clear_vlr();
Maxb0a43142018-02-06 19:19:52 +0100431 comment_end(nr, imsi);
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100432}
433
434msc_vlr_test_func_t msc_vlr_tests[] = {
435 test_hlr_rej_auth_info_unknown_imsi,
436 test_hlr_rej_auth_info_net_fail,
437 test_hlr_rej_auth_info_net_fail_reuse_tuples,
438 test_hlr_rej_auth_info_net_fail_no_reuse_tuples,
439 test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples,
440 test_hlr_acc_but_no_auth_tuples,
441 test_hlr_rej_lu,
442 test_hlr_no_insert_data,
443 NULL
444};