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