blob: c2f17c85fd0673654fa260b39bf8075d21948f4e [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
26#include <osmocom/core/logging.h>
27
28void test_hlr_timeout_lu_auth_info()
29{
30 comment_start();
31
32 fake_time_start();
33
34 net->authentication_required = true;
35
36 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
37 lu_result_sent = RES_NONE;
38 gsup_expect_tx("08010809710000004026f0");
39 ms_sends_msg("050802008168000130089910070000006402");
40 OSMO_ASSERT(gsup_tx_confirmed);
41 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
42
43 BTW("HLR never replies");
44
45 btw("At first, we're still waiting");
46 fake_time_passes(0, 423);
47 EXPECT_CONN_COUNT(1);
48 fake_time_passes(1, 235);
49 EXPECT_CONN_COUNT(1);
50 fake_time_passes(1, 235);
51 EXPECT_CONN_COUNT(1);
52 fake_time_passes(1, 235);
53 EXPECT_CONN_COUNT(1);
54 fake_time_passes(1, 235);
55 EXPECT_CONN_COUNT(1);
Philipp Maierfbf66102017-04-09 12:32:51 +020056 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010057 fake_time_passes(1, 235);
58 btw("SUBSCR_CONN_TIMEOUT has passed, conn is gone.");
Philipp Maierfbf66102017-04-09 12:32:51 +020059 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010060 EXPECT_CONN_COUNT(0);
61 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
62
63 clear_vlr();
64 comment_end();
65}
66
67void test_hlr_timeout_lu_upd_loc_result()
68{
69 comment_start();
70
71 fake_time_start();
72
73 btw("Location Update request causes a GSUP LU request to HLR");
74 lu_result_sent = RES_NONE;
75 gsup_expect_tx("04010809710000004026f0");
76 ms_sends_msg("050802008168000130089910070000006402");
77 OSMO_ASSERT(gsup_tx_confirmed);
78 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
79
80 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
81 gsup_rx("10010809710000004026f00804036470f1",
82 "12010809710000004026f0");
83 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
84
85 BTW("HLR never sends GSUP _UPDATE_LOCATION_RESULT");
86
87 btw("At first, we're still waiting");
88 fake_time_passes(0, 423);
89 EXPECT_CONN_COUNT(1);
90 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
91 fake_time_passes(1, 235);
92 EXPECT_CONN_COUNT(1);
93 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
94 fake_time_passes(1, 235);
95 EXPECT_CONN_COUNT(1);
96 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
97 fake_time_passes(1, 235);
98 EXPECT_CONN_COUNT(1);
99 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
100 fake_time_passes(1, 235);
101 EXPECT_CONN_COUNT(1);
102 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200103 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100104 fake_time_passes(1, 235);
105 btw("SUBSCR_CONN_TIMEOUT has passed, conn is gone.");
Philipp Maierfbf66102017-04-09 12:32:51 +0200106 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100107 EXPECT_CONN_COUNT(0);
108 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
109
110 clear_vlr();
111 comment_end();
112}
113
114msc_vlr_test_func_t msc_vlr_tests[] = {
115 test_hlr_timeout_lu_auth_info,
116 test_hlr_timeout_lu_upd_loc_result,
117 NULL
118};