blob: bb7ef19955b9c13ab7adae2fc8cadd2a8472f26a [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"
Harald Welte0df904d2018-12-03 11:00:04 +010025#include "stubs.h"
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010026
27#include <osmocom/core/logging.h>
28
Neels Hofmeyrf3d81f62018-03-02 01:05:38 +010029static void test_hlr_timeout_lu_auth_info()
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010030{
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010031 comment_start();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010032
33 fake_time_start();
34
35 net->authentication_required = true;
36
37 btw("Location Update request causes a GSUP Send Auth Info request to HLR");
38 lu_result_sent = RES_NONE;
39 gsup_expect_tx("08010809710000004026f0");
40 ms_sends_msg("050802008168000130089910070000006402");
41 OSMO_ASSERT(gsup_tx_confirmed);
42 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
43
44 BTW("HLR never replies");
45
46 btw("At first, we're still waiting");
47 fake_time_passes(0, 423);
48 EXPECT_CONN_COUNT(1);
49 fake_time_passes(1, 235);
50 EXPECT_CONN_COUNT(1);
51 fake_time_passes(1, 235);
52 EXPECT_CONN_COUNT(1);
53 fake_time_passes(1, 235);
54 EXPECT_CONN_COUNT(1);
55 fake_time_passes(1, 235);
56 EXPECT_CONN_COUNT(1);
Philipp Maierfbf66102017-04-09 12:32:51 +020057 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010058 fake_time_passes(1, 235);
Neels Hofmeyrc036b792018-11-29 22:37:51 +010059 btw("RAN_CONN_TIMEOUT has passed, conn is gone.");
Philipp Maierfbf66102017-04-09 12:32:51 +020060 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr4068ab22018-04-01 20:55:54 +020061 bss_sends_clear_complete();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010062 EXPECT_CONN_COUNT(0);
63 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
64
65 clear_vlr();
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010066 comment_end();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010067}
68
Neels Hofmeyrf3d81f62018-03-02 01:05:38 +010069static void test_hlr_timeout_lu_upd_loc_result()
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010070{
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +010071 comment_start();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010072
73 fake_time_start();
74
75 btw("Location Update request causes a GSUP LU request to HLR");
76 lu_result_sent = RES_NONE;
Neels Hofmeyrd0756b12018-09-28 02:41:39 +020077 gsup_expect_tx("04010809710000004026f0280102");
Neels Hofmeyr6a29d322017-01-25 15:04:16 +010078 ms_sends_msg("050802008168000130089910070000006402");
79 OSMO_ASSERT(gsup_tx_confirmed);
80 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
81
82 btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
83 gsup_rx("10010809710000004026f00804036470f1",
84 "12010809710000004026f0");
85 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
86
87 BTW("HLR never sends GSUP _UPDATE_LOCATION_RESULT");
88
89 btw("At first, we're still waiting");
90 fake_time_passes(0, 423);
91 EXPECT_CONN_COUNT(1);
92 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
93 fake_time_passes(1, 235);
94 EXPECT_CONN_COUNT(1);
95 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
96 fake_time_passes(1, 235);
97 EXPECT_CONN_COUNT(1);
98 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
99 fake_time_passes(1, 235);
100 EXPECT_CONN_COUNT(1);
101 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
102 fake_time_passes(1, 235);
103 EXPECT_CONN_COUNT(1);
104 VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
Philipp Maierfbf66102017-04-09 12:32:51 +0200105 expect_bssap_clear();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100106 fake_time_passes(1, 235);
Neels Hofmeyrc036b792018-11-29 22:37:51 +0100107 btw("RAN_CONN_TIMEOUT has passed, conn is gone.");
Philipp Maierfbf66102017-04-09 12:32:51 +0200108 VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
Neels Hofmeyr4068ab22018-04-01 20:55:54 +0200109 bss_sends_clear_complete();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100110 EXPECT_CONN_COUNT(0);
111 VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
112
113 clear_vlr();
Neels Hofmeyrdfdc61d2018-03-02 00:40:58 +0100114 comment_end();
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100115}
116
117msc_vlr_test_func_t msc_vlr_tests[] = {
118 test_hlr_timeout_lu_auth_info,
119 test_hlr_timeout_lu_upd_loc_result,
120 NULL
121};