Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 1 | /* 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 Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 28 | static void test_hlr_timeout_lu_auth_info() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 29 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 30 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 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; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 38 | gsup_expect_tx("08010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 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 Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 56 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 57 | fake_time_passes(1, 235); |
Neels Hofmeyr | c036b79 | 2018-11-29 22:37:51 +0100 | [diff] [blame] | 58 | btw("RAN_CONN_TIMEOUT has passed, conn is gone."); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 59 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 60 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 61 | EXPECT_CONN_COUNT(0); |
| 62 | VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); |
| 63 | |
| 64 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 65 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 66 | } |
| 67 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 68 | static void test_hlr_timeout_lu_upd_loc_result() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 69 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 70 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 71 | |
| 72 | fake_time_start(); |
| 73 | |
| 74 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 75 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 76 | gsup_expect_tx("04010809710000004026f0280102" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 77 | 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"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 82 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 83 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 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 Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 104 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 105 | fake_time_passes(1, 235); |
Neels Hofmeyr | c036b79 | 2018-11-29 22:37:51 +0100 | [diff] [blame] | 106 | btw("RAN_CONN_TIMEOUT has passed, conn is gone."); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 107 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 108 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 109 | EXPECT_CONN_COUNT(0); |
| 110 | VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); |
| 111 | |
| 112 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 113 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | msc_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 | }; |