Neels Hofmeyr | 3dc2c64 | 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 | |
| 28 | void 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); |
| 56 | fake_time_passes(1, 235); |
| 57 | btw("SUBSCR_CONN_TIMEOUT has passed, conn is gone."); |
| 58 | EXPECT_CONN_COUNT(0); |
| 59 | VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); |
| 60 | |
| 61 | clear_vlr(); |
| 62 | comment_end(); |
| 63 | } |
| 64 | |
| 65 | void test_hlr_timeout_lu_upd_loc_result() |
| 66 | { |
| 67 | comment_start(); |
| 68 | |
| 69 | fake_time_start(); |
| 70 | |
| 71 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 72 | lu_result_sent = RES_NONE; |
| 73 | gsup_expect_tx("04010809710000004026f0"); |
| 74 | ms_sends_msg("050802008168000130089910070000006402"); |
| 75 | OSMO_ASSERT(gsup_tx_confirmed); |
| 76 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 77 | |
| 78 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
| 79 | gsup_rx("10010809710000004026f00804036470f1", |
| 80 | "12010809710000004026f0"); |
| 81 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 82 | |
| 83 | BTW("HLR never sends GSUP _UPDATE_LOCATION_RESULT"); |
| 84 | |
| 85 | btw("At first, we're still waiting"); |
| 86 | fake_time_passes(0, 423); |
| 87 | EXPECT_CONN_COUNT(1); |
| 88 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 89 | fake_time_passes(1, 235); |
| 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 | btw("SUBSCR_CONN_TIMEOUT has passed, conn is gone."); |
| 103 | EXPECT_CONN_COUNT(0); |
| 104 | VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); |
| 105 | |
| 106 | clear_vlr(); |
| 107 | comment_end(); |
| 108 | } |
| 109 | |
| 110 | msc_vlr_test_func_t msc_vlr_tests[] = { |
| 111 | test_hlr_timeout_lu_auth_info, |
| 112 | test_hlr_timeout_lu_upd_loc_result, |
| 113 | NULL |
| 114 | }; |