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