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" |
Harald Welte | 0df904d | 2018-12-03 11:00:04 +0100 | [diff] [blame] | 25 | #include "stubs.h" |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 26 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 27 | static void test_reject_2nd_conn() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 28 | { |
Neels Hofmeyr | c036b79 | 2018-11-29 22:37:51 +0100 | [diff] [blame] | 29 | struct ran_conn *conn1; |
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 | btw("Location Update Request on one connection"); |
| 33 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | d0756b1 | 2018-09-28 02:41:39 +0200 | [diff] [blame] | 34 | gsup_expect_tx("04010809710000004026f0280102"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 35 | ms_sends_msg("050802008168000130089910070000006402"); |
| 36 | OSMO_ASSERT(gsup_tx_confirmed); |
| 37 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 38 | EXPECT_CONN_COUNT(1); |
| 39 | |
| 40 | btw("Another Location Update Request from the same subscriber on another connection is rejected"); |
| 41 | conn1 = g_conn; |
| 42 | g_conn = NULL; |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 43 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 44 | ms_sends_msg("050802008168000130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 45 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 46 | VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 47 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 48 | EXPECT_CONN_COUNT(1); |
| 49 | |
| 50 | |
| 51 | BTW("The first connection can still complete its LU"); |
| 52 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
| 53 | g_conn = conn1; |
| 54 | lu_result_sent = RES_NONE; |
| 55 | gsup_rx("10010809710000004026f00804036470f1", |
| 56 | "12010809710000004026f0"); |
| 57 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 58 | |
| 59 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 60 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 61 | gsup_rx("06010809710000004026f0", NULL); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 62 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 63 | |
| 64 | btw("LU was successful, and the conn has already been closed"); |
| 65 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 66 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 67 | EXPECT_CONN_COUNT(0); |
| 68 | |
| 69 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 70 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 71 | } |
| 72 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 73 | static void _normal_lu_part1() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 74 | { |
| 75 | btw("Location Update Request"); |
| 76 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | d0756b1 | 2018-09-28 02:41:39 +0200 | [diff] [blame] | 77 | gsup_expect_tx("04010809710000004026f0280102"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 78 | ms_sends_msg("050802008168000130089910070000006402"); |
| 79 | OSMO_ASSERT(gsup_tx_confirmed); |
| 80 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 81 | EXPECT_CONN_COUNT(1); |
| 82 | } |
| 83 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 84 | static void _normal_lu_part2() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 85 | { |
| 86 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
| 87 | lu_result_sent = RES_NONE; |
| 88 | gsup_rx("10010809710000004026f00804036470f1", |
| 89 | "12010809710000004026f0"); |
| 90 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 91 | |
| 92 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 93 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 94 | gsup_rx("06010809710000004026f0", NULL); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 95 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 96 | |
| 97 | btw("LU was successful, and the conn has already been closed"); |
| 98 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 99 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 100 | EXPECT_CONN_COUNT(0); |
| 101 | } |
| 102 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 103 | static void _normal_lu() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 104 | { |
| 105 | BTW("Subscriber does a normal LU"); |
| 106 | _normal_lu_part1(); |
| 107 | _normal_lu_part2(); |
| 108 | } |
| 109 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 110 | static void _normal_cm_service_req() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 111 | { |
| 112 | BTW("Subscriber does a normal CM Service Request"); |
| 113 | cm_service_result_sent = RES_NONE; |
| 114 | ms_sends_msg("05247803305886089910070000006402"); |
| 115 | OSMO_ASSERT(g_conn); |
Neels Hofmeyr | 4d3a66b | 2018-03-31 18:45:59 +0200 | [diff] [blame] | 116 | OSMO_ASSERT(g_conn->fi); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 117 | OSMO_ASSERT(g_conn->vsub); |
| 118 | VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d"); |
| 119 | EXPECT_ACCEPTED(true); |
| 120 | } |
| 121 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 122 | static void _page() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 123 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 124 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 125 | struct vlr_subscr *vsub; |
| 126 | |
| 127 | BTW("an SMS is sent, MS is paged"); |
| 128 | paging_expect_imsi(imsi); |
| 129 | paging_sent = false; |
| 130 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi); |
| 131 | OSMO_ASSERT(vsub); |
| 132 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d"); |
| 133 | |
| 134 | send_sms(vsub, vsub, |
| 135 | "Privacy in residential applications is a desirable" |
| 136 | " marketing option."); |
| 137 | |
| 138 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d"); |
| 139 | vlr_subscr_put(vsub); |
| 140 | vsub = NULL; |
| 141 | VERBOSE_ASSERT(paging_sent, == true, "%d"); |
| 142 | VERBOSE_ASSERT(paging_stopped, == false, "%d"); |
| 143 | } |
| 144 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 145 | static void _paging_resp_part1() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 146 | { |
| 147 | btw("MS replies with Paging Response, we deliver the SMS"); |
| 148 | dtap_expect_tx("09" /* SMS messages */ |
| 149 | "01" /* CP-DATA */ |
| 150 | "58" /* length */ |
| 151 | "01" /* Network to MS */ |
| 152 | "00" /* reference */ |
| 153 | /* originator (gsm411_send_sms() hardcodes this weird nr) */ |
| 154 | "0791" "447758100650" /* 447785016005 */ |
| 155 | "00" /* dest */ |
| 156 | /* SMS TPDU */ |
| 157 | "4c" /* len */ |
| 158 | "00" /* SMS deliver */ |
| 159 | "05806470f1" /* originating address 46071 */ |
| 160 | "00" /* TP-PID */ |
| 161 | "00" /* GSM default alphabet */ |
| 162 | "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/ |
| 163 | "000000" /* H-M-S */ |
| 164 | "00" /* GMT+0 */ |
| 165 | "44" /* data length */ |
| 166 | "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e" |
| 167 | "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb" |
| 168 | "0c7ac3e9e9b7db05"); |
| 169 | ms_sends_msg("06270703305882089910070000006402"); |
| 170 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
| 171 | VERBOSE_ASSERT(paging_stopped, == true, "%d"); |
| 172 | |
| 173 | btw("conn is still open to wait for SMS ack dance"); |
| 174 | EXPECT_CONN_COUNT(1); |
| 175 | } |
| 176 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 177 | static void _paging_resp_part2(int expect_conn_count, bool expect_clear) |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 178 | { |
| 179 | btw("MS replies with CP-ACK for received SMS"); |
| 180 | ms_sends_msg("8904"); |
| 181 | EXPECT_CONN_COUNT(1); |
| 182 | |
| 183 | btw("MS also sends RP-ACK, MSC in turn sends CP-ACK for that"); |
| 184 | dtap_expect_tx("0904"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 185 | if (expect_clear) |
| 186 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 187 | ms_sends_msg("890106020041020000"); |
| 188 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 189 | if (expect_clear) { |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 190 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 191 | bss_sends_clear_complete(); |
| 192 | } |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 193 | |
| 194 | btw("SMS is done"); |
| 195 | EXPECT_CONN_COUNT(expect_conn_count); |
| 196 | } |
| 197 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 198 | static void test_reject_lu_during_lu() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 199 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 200 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 201 | |
| 202 | _normal_lu_part1(); |
| 203 | |
| 204 | BTW("Another Location Update Request from the same subscriber on the same conn is dropped silently"); |
| 205 | ms_sends_msg("050802008168000130089910070000006402"); |
| 206 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 207 | EXPECT_CONN_COUNT(1); |
| 208 | |
| 209 | BTW("The first LU can still complete"); |
| 210 | _normal_lu_part2(); |
| 211 | |
| 212 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 213 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 214 | } |
| 215 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 216 | static void test_reject_cm_during_lu() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 217 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 218 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 219 | |
| 220 | _normal_lu_part1(); |
| 221 | |
| 222 | BTW("A CM Service Request in the middle of a LU is rejected"); |
| 223 | cm_service_result_sent = RES_NONE; |
Neels Hofmeyr | 1580959 | 2018-04-06 02:57:51 +0200 | [diff] [blame] | 224 | dtap_expect_tx("052216"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 225 | ms_sends_msg("05247803305886089910070000006402"); |
| 226 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 227 | VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d"); |
Neels Hofmeyr | 9fe52e4 | 2018-04-02 22:46:55 +0200 | [diff] [blame] | 228 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 229 | EXPECT_CONN_COUNT(1); |
| 230 | |
| 231 | BTW("The first LU can still complete"); |
| 232 | _normal_lu_part2(); |
| 233 | |
| 234 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 235 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 236 | } |
| 237 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 238 | static void test_reject_paging_resp_during_lu() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 239 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 240 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 241 | |
| 242 | _normal_lu_part1(); |
| 243 | |
| 244 | BTW("An erratic Paging Response is dropped silently"); |
| 245 | ms_sends_msg("06270703305882089910070000006402"); |
| 246 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 247 | EXPECT_CONN_COUNT(1); |
| 248 | |
| 249 | BTW("The first LU can still complete"); |
| 250 | _normal_lu_part2(); |
| 251 | |
| 252 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 253 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 254 | } |
| 255 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 256 | static void test_reject_lu_during_cm() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 257 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 258 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 259 | |
| 260 | _normal_lu(); |
| 261 | _normal_cm_service_req(); |
| 262 | |
| 263 | btw("A LU request on an open conn is dropped silently"); |
| 264 | /* TODO: accept periodic LU on an already open conn? */ |
| 265 | lu_result_sent = RES_NONE; |
| 266 | ms_sends_msg("050802008168000130089910070000006402"); |
| 267 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 268 | EXPECT_CONN_COUNT(1); |
| 269 | |
| 270 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 271 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 272 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 273 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 274 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 275 | EXPECT_CONN_COUNT(0); |
| 276 | |
| 277 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 278 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 279 | } |
| 280 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 281 | static void test_reject_cm_during_cm() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 282 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 283 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 284 | |
| 285 | _normal_lu(); |
| 286 | _normal_cm_service_req(); |
| 287 | |
| 288 | btw("A second CM Service Request on the same conn is accepted without another auth dance"); |
| 289 | cm_service_result_sent = RES_NONE; |
| 290 | ms_sends_msg("05247803305886089910070000006402"); |
| 291 | VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d"); |
| 292 | EXPECT_CONN_COUNT(1); |
| 293 | |
| 294 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 295 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 296 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 297 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 298 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 299 | EXPECT_CONN_COUNT(0); |
| 300 | |
| 301 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 302 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 303 | } |
| 304 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 305 | static void test_reject_paging_resp_during_cm() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 306 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 307 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 308 | |
| 309 | _normal_lu(); |
| 310 | _normal_cm_service_req(); |
| 311 | |
| 312 | BTW("An erratic Paging Response on the same conn is dropped silently"); |
| 313 | ms_sends_msg("06270703305882089910070000006402"); |
| 314 | EXPECT_CONN_COUNT(1); |
| 315 | |
| 316 | BTW("The original CM Service Request can conclude"); |
Vadim Yanitskiy | 2760585 | 2018-06-15 23:57:30 +0700 | [diff] [blame] | 317 | |
| 318 | /* Release connection */ |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 319 | expect_bssap_clear(OSMO_RAT_GERAN_A); |
| 320 | conn_conclude_cm_service_req(g_conn, OSMO_RAT_GERAN_A); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 321 | |
| 322 | btw("all requests serviced, conn has been released"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 323 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 324 | EXPECT_CONN_COUNT(0); |
| 325 | |
| 326 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 327 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 328 | } |
| 329 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 330 | static void test_reject_paging_resp_during_paging_resp() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 331 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 332 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 333 | |
| 334 | _normal_lu(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 335 | _page(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 336 | _paging_resp_part1(); |
| 337 | |
| 338 | BTW("MS sends another erratic Paging Response which is dropped silently"); |
| 339 | ms_sends_msg("06270703305882089910070000006402"); |
| 340 | |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 341 | _paging_resp_part2(0, true); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 342 | |
| 343 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 344 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 345 | } |
| 346 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 347 | static void test_reject_lu_during_paging_resp() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 348 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 349 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 350 | |
| 351 | _normal_lu(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 352 | _page(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 353 | _paging_resp_part1(); |
| 354 | |
| 355 | BTW("MS sends erratic LU Request, which is dropped silently"); |
| 356 | lu_result_sent = RES_NONE; |
| 357 | ms_sends_msg("050802008168000130089910070000006402"); |
| 358 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 359 | EXPECT_CONN_COUNT(1); |
| 360 | |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 361 | _paging_resp_part2(0, true); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 362 | |
| 363 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 364 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 365 | } |
| 366 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 367 | static void test_accept_cm_during_paging_resp() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 368 | { |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 369 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 370 | |
| 371 | _normal_lu(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 372 | _page(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 373 | _paging_resp_part1(); |
| 374 | |
| 375 | BTW("CM Service Request during open connection is accepted"); |
| 376 | cm_service_result_sent = RES_NONE; |
| 377 | ms_sends_msg("05247803305886089910070000006402"); |
| 378 | VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d"); |
| 379 | EXPECT_CONN_COUNT(1); |
| 380 | VERBOSE_ASSERT(g_conn->received_cm_service_request, == true, "%d"); |
| 381 | |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 382 | _paging_resp_part2(1, false); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 383 | |
| 384 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 385 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 386 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 387 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 388 | bss_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 389 | EXPECT_CONN_COUNT(0); |
| 390 | |
| 391 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 392 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | msc_vlr_test_func_t msc_vlr_tests[] = { |
| 396 | test_reject_2nd_conn, |
| 397 | test_reject_lu_during_lu, |
| 398 | test_reject_cm_during_lu, |
| 399 | test_reject_paging_resp_during_lu, |
| 400 | test_reject_lu_during_cm, |
| 401 | test_reject_cm_during_cm, |
| 402 | test_reject_paging_resp_during_cm, |
| 403 | test_reject_lu_during_paging_resp, |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 404 | test_accept_cm_during_paging_resp, |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 405 | test_reject_paging_resp_during_paging_resp, |
| 406 | NULL |
| 407 | }; |