blob: a237695714f5954a28a2c27820cb557c89634961 [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
Neels Hofmeyrf3d81f62018-03-02 01:05:38 +010028static void test_hlr_timeout_lu_auth_info()
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010029{
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010030 comment_start();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010031
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 Hofmeyr4068ab22018-04-01 20:55:54 +020060 bss_sends_clear_complete();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010061 EXPECT_CONN_COUNT(0);
62 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
63
64 clear_vlr();
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010065 comment_end();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010066}
67
Neels Hofmeyrf3d81f62018-03-02 01:05:38 +010068static void test_hlr_timeout_lu_upd_loc_result()
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010069{
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010070 comment_start();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010071
72 fake_time_start();
73
74 btw("Location Update request causes a GSUP LU request to HLR");
75 lu_result_sent = RES_NONE;
Neels Hofmeyrd0756b12018-09-28 02:41:39 +020076 gsup_expect_tx("04010809710000004026f0280102");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010077 ms_sends_msg("050802008168000130089910070000006402");
78 OSMO_ASSERT(gsup_tx_confirmed);
79 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
80
81 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
82 gsup_rx("10010809710000004026f00804036470f1",
83 "12010809710000004026f0");
84 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
85
86 BTW("HLR never sends GSUP _UPDATE_LOCATION_RESULT");
87
88 btw("At first, we're still waiting");
89 fake_time_passes(0, 423);
90 EXPECT_CONN_COUNT(1);
91 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
92 fake_time_passes(1, 235);
93 EXPECT_CONN_COUNT(1);
94 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
95 fake_time_passes(1, 235);
96 EXPECT_CONN_COUNT(1);
97 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
98 fake_time_passes(1, 235);
99 EXPECT_CONN_COUNT(1);
100 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
101 fake_time_passes(1, 235);
102 EXPECT_CONN_COUNT(1);
103 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200104 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100105 fake_time_passes(1, 235);
106 btw("SUBSCR_CONN_TIMEOUT has passed, conn is gone.");
Philipp Maierfbf66102017-04-09 12:32:51 +0200107 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr4068ab22018-04-01 20:55:54 +0200108 bss_sends_clear_complete();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100109 EXPECT_CONN_COUNT(0);
110 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
111
112 clear_vlr();
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +0100113 comment_end();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100114}
115
116msc_vlr_test_func_t msc_vlr_tests[] = {
117 test_hlr_timeout_lu_auth_info,
118 test_hlr_timeout_lu_upd_loc_result,
119 NULL
120};