Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1 | module GBProxy_Tests { |
| 2 | |
| 3 | /* Osmocom GBProxy test suite in TTCN-3 |
Harald Welte | 207166c | 2021-01-16 12:52:30 +0100 | [diff] [blame] | 4 | * (C) 2020-2021 Harald Welte <laforge@osmocom.org> |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 5 | * (C) 2020 sysmocom - s.f.m.c. GmbH |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Author: Daniel Willmann <dwillmann@sysmocom.de> |
| 9 | |
| 10 | * Released under the terms of GNU General Public License, Version 2 or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 14 | */ |
| 15 | |
| 16 | import from General_Types all; |
| 17 | import from Osmocom_Types all; |
Harald Welte | b9f0fdc | 2020-12-09 14:44:50 +0100 | [diff] [blame] | 18 | import from Misc_Helpers all; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 19 | import from GSM_Types all; |
| 20 | import from Native_Functions all; |
| 21 | import from NS_Types all; |
| 22 | import from NS_Emulation all; |
| 23 | import from BSSGP_Types all; |
| 24 | import from BSSGP_Emulation all; |
| 25 | import from SCCPasp_Types all; |
| 26 | import from Osmocom_Gb_Types all; |
| 27 | |
| 28 | import from MobileL3_CommonIE_Types all; |
| 29 | import from MobileL3_GMM_SM_Types all; |
| 30 | import from MobileL3_Types all; |
| 31 | import from L3_Templates all; |
| 32 | import from L3_Common all; |
| 33 | |
| 34 | import from TELNETasp_PortType all; |
| 35 | import from Osmocom_VTY_Functions all; |
| 36 | |
| 37 | import from LLC_Types all; |
| 38 | import from LLC_Templates all; |
| 39 | |
| 40 | import from GSM_RR_Types all; |
| 41 | |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 42 | /* mcc_mnc is 24.008 10.5.5.15 encoded. 262 42 */ |
| 43 | const BcdMccMnc c_mcc_mnc := '262F42'H; |
| 44 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 45 | /* 48.016 section 6.1.4.2: The default maximum information field size of 1600 octets shall be supported on the Gb interface */ |
| 46 | const integer max_fr_info_size := 1600; |
| 47 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 48 | modulepar { |
Harald Welte | 77218d0 | 2021-01-15 19:59:15 +0100 | [diff] [blame] | 49 | /* NRI bit-length. 0 for no pooling */ |
| 50 | integer mp_nri_bitlength := 5; |
| 51 | roro_integer mp_sgsn_nri := { |
| 52 | { 3 }, /* list of NRIs of first SGSN */ |
| 53 | { 4 } /* list of NRIs of second SGSN */ |
| 54 | }; |
Harald Welte | f6e59b0 | 2020-12-08 08:29:09 +0100 | [diff] [blame] | 55 | boolean mp_enable_bss_load_sharing := false; |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 56 | /* SGSN NS configuration */ |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 57 | NSConfigurations mp_nsconfig_sgsn := { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 58 | { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 59 | nsei := 101, |
| 60 | role_sgsn := true, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 61 | handle_sns := false, |
| 62 | nsvc := { |
| 63 | { |
| 64 | provider := { |
| 65 | ip := { |
| 66 | address_family := AF_INET, |
| 67 | local_udp_port := 7777, |
Harald Welte | d05a4a9 | 2021-01-18 12:03:53 +0100 | [diff] [blame] | 68 | local_ip := "127.0.0.10", |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 69 | remote_udp_port := 23000, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 70 | remote_ip := "127.0.0.1", |
Harald Welte | 388057d | 2021-01-18 18:52:49 +0100 | [diff] [blame] | 71 | data_weight := 0, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 72 | signalling_weight := 1 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 73 | } |
| 74 | }, |
| 75 | nsvci := 101 |
Harald Welte | 388057d | 2021-01-18 18:52:49 +0100 | [diff] [blame] | 76 | }, { |
| 77 | provider := { |
| 78 | ip := { |
| 79 | address_family := AF_INET, |
| 80 | local_udp_port := 7770, |
| 81 | local_ip := "127.0.0.10", |
| 82 | remote_udp_port := 23000, |
| 83 | remote_ip := "127.0.0.1", |
| 84 | data_weight := 1, |
| 85 | signalling_weight := 0 |
| 86 | } |
| 87 | }, |
| 88 | nsvci := 201 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 89 | } |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 90 | |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 91 | } |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 92 | }, { |
| 93 | nsei := 102, |
| 94 | role_sgsn := true, |
| 95 | handle_sns := false, |
| 96 | nsvc := { |
| 97 | { |
| 98 | provider := { |
| 99 | ip := { |
| 100 | address_family := AF_INET, |
| 101 | local_udp_port := 8888, |
Harald Welte | d05a4a9 | 2021-01-18 12:03:53 +0100 | [diff] [blame] | 102 | local_ip := "127.0.0.11", |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 103 | remote_udp_port := 23000, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 104 | remote_ip := "127.0.0.1", |
Harald Welte | 388057d | 2021-01-18 18:52:49 +0100 | [diff] [blame] | 105 | data_weight := 0, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 106 | signalling_weight := 1 |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 107 | } |
| 108 | }, |
| 109 | nsvci := 102 |
Harald Welte | 388057d | 2021-01-18 18:52:49 +0100 | [diff] [blame] | 110 | }, { |
| 111 | provider := { |
| 112 | ip := { |
| 113 | address_family := AF_INET, |
| 114 | local_udp_port := 8880, |
| 115 | local_ip := "127.0.0.11", |
| 116 | remote_udp_port := 23000, |
| 117 | remote_ip := "127.0.0.1", |
| 118 | data_weight := 1, |
| 119 | signalling_weight := 0 |
| 120 | } |
| 121 | }, |
| 122 | nsvci := 202 |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 123 | } |
| 124 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 125 | } |
| 126 | }; |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 127 | /* BSS NSEI start at 2000 + x |
| 128 | * NSVCI start from value of NSEI + 100 |
| 129 | * UDP port is NSVCI * 10 */ |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 130 | NSConfigurations mp_nsconfig_pcu := { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 131 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 132 | nsei := 2001, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 133 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 134 | handle_sns := false, |
| 135 | nsvc := { |
| 136 | { |
| 137 | provider := { |
| 138 | ip := { |
| 139 | address_family := AF_INET, |
| 140 | local_udp_port := 21010, |
Harald Welte | d05a4a9 | 2021-01-18 12:03:53 +0100 | [diff] [blame] | 141 | local_ip := "127.0.1.1", |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 142 | remote_udp_port := 23000, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 143 | remote_ip := "127.0.0.1", |
| 144 | data_weight := 1, |
| 145 | signalling_weight := 1 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 146 | } |
| 147 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 148 | nsvci := 2101 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 149 | } |
| 150 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 151 | }, |
| 152 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 153 | nsei := 2002, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 154 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 155 | handle_sns := false, |
| 156 | nsvc := { |
| 157 | { |
| 158 | provider := { |
| 159 | ip := { |
| 160 | address_family := AF_INET, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 161 | local_udp_port := 21020, |
Harald Welte | d05a4a9 | 2021-01-18 12:03:53 +0100 | [diff] [blame] | 162 | local_ip := "127.0.2.1", |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 163 | remote_udp_port := 23000, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 164 | remote_ip := "127.0.0.1", |
| 165 | data_weight := 1, |
| 166 | signalling_weight := 1 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 167 | } |
| 168 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 169 | nsvci := 2102 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 170 | } |
| 171 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 172 | }, |
| 173 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 174 | nsei := 2003, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 175 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 176 | handle_sns := false, |
| 177 | nsvc := { |
| 178 | { |
| 179 | provider := { |
| 180 | ip := { |
| 181 | address_family := AF_INET, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 182 | local_udp_port := 21030, |
Harald Welte | d05a4a9 | 2021-01-18 12:03:53 +0100 | [diff] [blame] | 183 | local_ip := "127.0.3.1", |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 184 | remote_udp_port := 23000, |
Harald Welte | be7afce | 2021-01-17 22:04:36 +0100 | [diff] [blame] | 185 | remote_ip := "127.0.0.1", |
| 186 | data_weight := 1, |
| 187 | signalling_weight := 1 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 188 | } |
| 189 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 190 | nsvci := 2103 |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 191 | } |
| 192 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 193 | } |
| 194 | }; |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 195 | /* BVCI are NSEI*10 + x |
| 196 | * The first NSE only has one BVC, the second one 2 and so on |
| 197 | * The Cell ID is BVCI + 10000 |
| 198 | * LAC/RAC are configured in such a way that: |
| 199 | * LAC 13135 is present once in NSE(2001), twice in NSE(2002) and once in NSE(2003) |
| 200 | * LAC 13300 is present twice in NSE(2003) |
| 201 | * RAI 13135-1 is present in NSE(2002) and NSE(2003) |
| 202 | * RAI 13300-0 is present twice in NSE(2003) |
| 203 | */ |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 204 | BssgpConfigs mp_gbconfigs := { |
| 205 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 206 | nsei := 2001, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 207 | sgsn_role := false, |
| 208 | bvc := { |
| 209 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 210 | bvci := 20011, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 211 | cell_id := { |
| 212 | ra_id := { |
| 213 | lai := { |
| 214 | mcc_mnc := c_mcc_mnc, |
| 215 | lac := 13135 |
| 216 | }, |
| 217 | rac := 0 |
| 218 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 219 | cell_id := 30011 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 220 | }, |
| 221 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 222 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 223 | } |
| 224 | } |
| 225 | }, { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 226 | nsei := 2002, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 227 | sgsn_role := false, |
| 228 | bvc := { |
| 229 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 230 | bvci := 20021, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 231 | cell_id := { |
| 232 | ra_id := { |
| 233 | lai := { |
| 234 | mcc_mnc := c_mcc_mnc, |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 235 | lac := 13135 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 236 | }, |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 237 | rac := 1 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 238 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 239 | cell_id := 30021 |
| 240 | }, |
| 241 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 242 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 243 | }, |
| 244 | { |
| 245 | bvci := 20022, |
| 246 | cell_id := { |
| 247 | ra_id := { |
| 248 | lai := { |
| 249 | mcc_mnc := c_mcc_mnc, |
| 250 | lac := 13135 |
| 251 | }, |
| 252 | rac := 2 |
| 253 | }, |
| 254 | cell_id := 30022 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 255 | }, |
| 256 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 257 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 258 | } |
| 259 | } |
| 260 | }, { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 261 | nsei := 2003, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 262 | sgsn_role := false, |
| 263 | bvc := { |
| 264 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 265 | bvci := 20031, |
| 266 | cell_id := { |
| 267 | ra_id := { |
| 268 | lai := { |
| 269 | mcc_mnc := c_mcc_mnc, |
| 270 | lac := 13135 |
| 271 | }, |
| 272 | rac := 1 |
| 273 | }, |
| 274 | cell_id := 30031 |
| 275 | }, |
| 276 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 277 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 278 | }, |
| 279 | { |
| 280 | bvci := 20032, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 281 | cell_id := { |
| 282 | ra_id := { |
| 283 | lai := { |
| 284 | mcc_mnc := c_mcc_mnc, |
| 285 | lac := 13300 |
| 286 | }, |
| 287 | rac := 0 |
| 288 | }, |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 289 | cell_id := 30032 |
| 290 | }, |
| 291 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 292 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 293 | }, |
| 294 | { |
| 295 | bvci := 20033, |
| 296 | cell_id := { |
| 297 | ra_id := { |
| 298 | lai := { |
| 299 | mcc_mnc := c_mcc_mnc, |
| 300 | lac := 13300 |
| 301 | }, |
| 302 | rac := 0 |
| 303 | }, |
| 304 | cell_id := 30033 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 305 | }, |
| 306 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 307 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 312 | }; |
| 313 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 314 | type record GbInstance { |
| 315 | NS_CT vc_NS, |
| 316 | BSSGP_CT vc_BSSGP, |
Harald Welte | 67dc8c2 | 2020-11-17 18:32:29 +0100 | [diff] [blame] | 317 | BSSGP_BVC_CTs vc_BSSGP_BVC, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 318 | BssgpConfig cfg |
| 319 | }; |
Harald Welte | 67dc8c2 | 2020-11-17 18:32:29 +0100 | [diff] [blame] | 320 | type record of BSSGP_BVC_CT BSSGP_BVC_CTs |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 321 | |
| 322 | const integer NUM_PCU := 3; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 323 | type record of GbInstance GbInstances; |
| 324 | type record of BssgpConfig BssgpConfigs; |
| 325 | type record of NSConfiguration NSConfigurations; |
| 326 | type record of BssgpCellId BssgpCellIds; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 327 | |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 328 | const integer NUM_SGSN := 2; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 329 | |
| 330 | type component test_CT { |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 331 | var GbInstances g_pcu; |
| 332 | var GbInstances g_sgsn; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 333 | |
| 334 | port BSSGP_CT_PROC_PT PROC; |
| 335 | |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 336 | port BSSGP_BVC_MGMT_PT SGSN_MGMT; |
| 337 | port BSSGP_BVC_MGMT_PT PCU_MGMT; |
| 338 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 339 | port TELNETasp_PT GBPVTY; |
| 340 | |
| 341 | var boolean g_initialized := false; |
| 342 | var boolean g_use_echo := false; |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 343 | |
| 344 | var ro_integer g_roi := {}; |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 345 | var roro_integer g_roroi := {}; |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 346 | timer g_Tguard; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 347 | }; |
| 348 | |
| 349 | type component BSSGP_ConnHdlr { |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 350 | /* array of per-BVC ports on the PCU side */ |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 351 | port BSSGP_PT PCU_PTP[NUM_PCU]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 352 | port BSSGP_PT PCU_SIG[NUM_PCU]; |
| 353 | port BSSGP_PROC_PT PCU_PROC[NUM_PCU]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 354 | /* component reference to the component to which we're currently connected */ |
| 355 | var BSSGP_BVC_CT pcu_ct[NUM_PCU]; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 356 | /* BSSGP BVC configuration of the component to which we're currently connected */ |
| 357 | var BssgpBvcConfig pcu_bvc_cfg[NUM_PCU]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 358 | |
| 359 | /* array of per-BVC ports on the SGSN side */ |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 360 | port BSSGP_PT SGSN_PTP[NUM_SGSN]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 361 | port BSSGP_PT SGSN_SIG[NUM_SGSN]; |
| 362 | port BSSGP_PROC_PT SGSN_PROC[NUM_SGSN]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 363 | /* component reference to the component to which we're currently connected */ |
| 364 | var BSSGP_BVC_CT sgsn_ct[NUM_PCU]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 365 | |
| 366 | var BSSGP_ConnHdlrPars g_pars; |
| 367 | timer g_Tguard; |
| 368 | var LLC_Entities llc; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 369 | |
| 370 | var ro_integer g_roi := {}; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | type record SGSN_ConnHdlrNetworkPars { |
| 374 | boolean expect_ptmsi, |
| 375 | boolean expect_auth, |
| 376 | boolean expect_ciph |
| 377 | }; |
| 378 | |
| 379 | type record BSSGP_ConnHdlrPars { |
| 380 | /* IMEI of the simulated ME */ |
| 381 | hexstring imei, |
| 382 | /* IMSI of the simulated MS */ |
| 383 | hexstring imsi, |
| 384 | /* MSISDN of the simulated MS (probably unused) */ |
| 385 | hexstring msisdn, |
| 386 | /* P-TMSI allocated to the simulated MS */ |
| 387 | OCT4 p_tmsi optional, |
| 388 | OCT3 p_tmsi_sig optional, |
| 389 | /* TLLI of the simulated MS */ |
| 390 | OCT4 tlli, |
| 391 | OCT4 tlli_old optional, |
| 392 | RoutingAreaIdentificationV ra optional, |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 393 | GbInstances pcu, |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 394 | GbInstances sgsn, |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 395 | /* The SGSN index to be used within the test */ |
| 396 | integer sgsn_idx, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 397 | float t_guard |
| 398 | }; |
| 399 | |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 400 | private function get_bvc_idx_for_bvci(GbInstance gbi, BssgpBvci bvci) return integer |
| 401 | { |
| 402 | var integer i; |
| 403 | |
| 404 | for (i := 0; i < lengthof(gbi.cfg.bvc); i := i + 1) { |
| 405 | if (gbi.cfg.bvc[i].bvci == bvci) { |
| 406 | return i; |
| 407 | } |
| 408 | } |
| 409 | setverdict(fail, "Could not find BVC Index for BVCI ", bvci); |
| 410 | return -1; |
| 411 | } |
| 412 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 413 | private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdentificationV { |
| 414 | /* mcc_mnc is encoded as of 24.008 10.5.5.15 */ |
| 415 | var BcdMccMnc mcc_mnc := cell_id.ra_id.lai.mcc_mnc; |
| 416 | |
| 417 | var RoutingAreaIdentificationV ret := { |
| 418 | mccDigit1 := mcc_mnc[0], |
| 419 | mccDigit2 := mcc_mnc[1], |
| 420 | mccDigit3 := mcc_mnc[2], |
| 421 | mncDigit3 := mcc_mnc[3], |
| 422 | mncDigit1 := mcc_mnc[4], |
| 423 | mncDigit2 := mcc_mnc[5], |
| 424 | lac := int2oct(cell_id.ra_id.lai.lac, 16), |
| 425 | rac := int2oct(cell_id.ra_id.rac, 8) |
| 426 | } |
| 427 | return ret; |
| 428 | }; |
| 429 | |
Harald Welte | 9533943 | 2020-12-02 18:50:52 +0100 | [diff] [blame] | 430 | private function f_fix_create_cb(inout BssgpConfig cfg) |
| 431 | { |
| 432 | for (var integer i := 0; i < lengthof(cfg.bvc); i := i + 1) { |
| 433 | if (not isbound(cfg.bvc[i].create_cb)) { |
| 434 | cfg.bvc[i].create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 439 | private function f_init_gb_pcu(inout GbInstance gb, charstring id, integer offset) runs on test_CT { |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 440 | var charstring ns_id := id & "-NS(PCU[" & int2str(offset) & "])"; |
| 441 | var charstring bssgp_id := id & "-BSSGP(PCU[" & int2str(offset) & "])"; |
| 442 | gb.vc_NS := NS_CT.create(ns_id); |
| 443 | gb.vc_BSSGP := BSSGP_CT.create(bssgp_id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 444 | /* connect lower end of BSSGP emulation with NS upper port */ |
| 445 | connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP); |
| 446 | |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 447 | gb.vc_NS.start(NSStart(mp_nsconfig_pcu[offset], ns_id)); |
| 448 | gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 449 | |
| 450 | for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) { |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 451 | /* obtain the component reference of the BSSGP_BVC_CT for each PTP BVC */ |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 452 | connect(self:PROC, gb.vc_BSSGP:PROC); |
| 453 | gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC); |
| 454 | disconnect(self:PROC, gb.vc_BSSGP:PROC); |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 455 | /* connect all of the per-BVC MGMT ports to our PCU_MGMT port (1:N) */ |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 456 | connect(self:PCU_MGMT, gb.vc_BSSGP_BVC[i]:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 457 | } |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 458 | /* connect all of the BSSGP/NSE global MGMT port to our PCU_MGMT port (1:N) */ |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 459 | connect(self:PCU_MGMT, gb.vc_BSSGP:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | private function f_init_gb_sgsn(inout GbInstance gb, charstring id, integer offset) runs on test_CT { |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 463 | var charstring ns_id := id & "-NS(SGSN[" & int2str(offset) & "])"; |
| 464 | var charstring bssgp_id := id & "-BSSGP(SGSN[" & int2str(offset) & "])"; |
| 465 | gb.vc_NS := NS_CT.create(ns_id); |
| 466 | gb.vc_BSSGP := BSSGP_CT.create(bssgp_id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 467 | /* connect lower end of BSSGP emulation with NS upper port */ |
| 468 | connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP); |
| 469 | |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 470 | gb.vc_NS.start(NSStart(mp_nsconfig_sgsn[offset], ns_id)); |
| 471 | gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 472 | |
| 473 | for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) { |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 474 | /* obtain the component reference of the BSSGP_BVC_CT for each PTP BVC */ |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 475 | connect(self:PROC, gb.vc_BSSGP:PROC); |
| 476 | gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC); |
| 477 | disconnect(self:PROC, gb.vc_BSSGP:PROC); |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 478 | /* connect all of the per-BVC MGMT ports to our SGSN_MGMT port (1:N) */ |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 479 | connect(self:SGSN_MGMT, gb.vc_BSSGP_BVC[i]:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 480 | } |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 481 | /* connect all of the BSSGP/NSE global MGMT port to our SGSN_MGMT port (1:N) */ |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 482 | connect(self:SGSN_MGMT, gb.vc_BSSGP:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | |
Harald Welte | b9f0fdc | 2020-12-09 14:44:50 +0100 | [diff] [blame] | 486 | private function f_destroy_gb(inout GbInstance gb) runs on test_CT { |
| 487 | gb.vc_NS.stop; |
| 488 | gb.vc_BSSGP.stop; |
| 489 | |
| 490 | for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) { |
| 491 | gb.vc_BSSGP_BVC[i].stop; |
| 492 | } |
| 493 | } |
| 494 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 495 | private function f_init_vty() runs on test_CT { |
| 496 | map(self:GBPVTY, system:GBPVTY); |
| 497 | f_vty_set_prompts(GBPVTY); |
| 498 | f_vty_transceive(GBPVTY, "enable"); |
| 499 | } |
| 500 | |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 501 | /* count the number of unblocked BVCI for each SGSN NSE */ |
| 502 | private altstep as_count_unblocked4nse(integer sgsn_idx, inout roro_integer bvci_unblocked) |
| 503 | runs on test_CT { |
| 504 | var BssgpStatusIndication bsi; |
| 505 | [] SGSN_MGMT.receive(BssgpStatusIndication:{g_sgsn[sgsn_idx].cfg.nsei, ?, BVC_S_UNBLOCKED}) -> value bsi { |
| 506 | bvci_unblocked[sgsn_idx] := bvci_unblocked[sgsn_idx] & { bsi.bvci }; |
| 507 | /* 'repeat' until sufficient number of BVC-rest has been received on all SGSNs */ |
| 508 | for (var integer i := 0; i < lengthof(bvci_unblocked); i := i+1) { |
| 509 | if (lengthof(bvci_unblocked[i]) < lengthof(g_sgsn[i].cfg.bvc)) { |
| 510 | repeat; |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | } |
| 515 | |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 516 | function f_init(float t_guard := 30.0) runs on test_CT { |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 517 | var roro_integer bvci_unblocked; |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 518 | var BssgpStatusIndication bsi; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 519 | var integer i; |
| 520 | |
| 521 | if (g_initialized == true) { |
| 522 | return; |
| 523 | } |
| 524 | g_initialized := true; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 525 | |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 526 | g_Tguard.start(t_guard); |
| 527 | activate(as_gTguard(g_Tguard)); |
| 528 | |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 529 | var BssgpBvcConfigs bvcs := { }; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 530 | for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) { |
| 531 | g_pcu[i].cfg := mp_gbconfigs[i]; |
Harald Welte | 9533943 | 2020-12-02 18:50:52 +0100 | [diff] [blame] | 532 | /* make sure all have a proper crate_cb, which cannot be specified in config file */ |
| 533 | f_fix_create_cb(g_pcu[i].cfg); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 534 | /* concatenate all the PCU-side BVCs for the SGSN side */ |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 535 | bvcs := bvcs & g_pcu[i].cfg.bvc; |
| 536 | } |
| 537 | |
| 538 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 539 | g_sgsn[i].cfg := { |
| 540 | nsei := mp_nsconfig_sgsn[i].nsei, |
| 541 | sgsn_role := true, |
| 542 | bvc := bvcs |
| 543 | } |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 544 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 545 | |
| 546 | f_init_vty(); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 547 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
Daniel Willmann | 443fc57 | 2020-11-18 13:26:57 +0100 | [diff] [blame] | 548 | f_vty_transceive(GBPVTY, "nsvc nsei " & int2str(g_sgsn[i].cfg.nsei) & " force-unconfigured"); |
Daniel Willmann | ad93c05 | 2020-12-04 14:14:38 +0100 | [diff] [blame] | 549 | } |
| 550 | for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 551 | f_vty_transceive(GBPVTY, "nsvc nsei " & int2str(g_pcu[i].cfg.nsei) & " force-unconfigured"); |
| 552 | f_vty_transceive(GBPVTY, "delete-gbproxy-peer " & int2str(g_pcu[i].cfg.nsei) & " only-bvc"); |
| 553 | } |
| 554 | |
| 555 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
Harald Welte | ea1ba59 | 2020-11-17 18:05:13 +0100 | [diff] [blame] | 556 | f_init_gb_sgsn(g_sgsn[i], "GbProxy_Test", i); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 557 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 558 | f_sleep(4.0); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 559 | for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 560 | f_init_gb_pcu(g_pcu[i], "GbProxy_Test", i); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 561 | } |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 562 | |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 563 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 564 | bvci_unblocked[i] := {}; |
| 565 | } |
| 566 | |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 567 | /* wait until all BVC are unblocked on both sides */ |
Harald Welte | d280127 | 2020-11-17 19:22:58 +0100 | [diff] [blame] | 568 | timer T := 15.0; |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 569 | T.start; |
| 570 | alt { |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 571 | /* TODO: We need to add more lines if NUM_SGSN increases. Activating default altsteps |
| 572 | * unfortunately doesn't work as we want to access the local variable bvci_unblocked. */ |
| 573 | [] as_count_unblocked4nse(0, bvci_unblocked); |
| 574 | [lengthof(g_sgsn) > 1] as_count_unblocked4nse(1, bvci_unblocked); |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 575 | [] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) { |
| 576 | repeat; |
| 577 | } |
Harald Welte | 3c90515 | 2020-11-26 20:56:09 +0100 | [diff] [blame] | 578 | [] SGSN_MGMT.receive(BssgpResetIndication:?) { |
| 579 | repeat; |
| 580 | } |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 581 | [] SGSN_MGMT.receive { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 582 | f_shutdown(__FILE__, __LINE__, fail, "Received unexpected message on SGSN_MGMT"); |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi { |
| 586 | repeat; |
| 587 | } |
| 588 | [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) { |
| 589 | repeat; |
| 590 | } |
| 591 | [] PCU_MGMT.receive(BssgpResetIndication:{0}) { |
| 592 | repeat; |
| 593 | } |
| 594 | [] PCU_MGMT.receive { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 595 | f_shutdown(__FILE__, __LINE__, fail, "Received unexpected message on PCU_MGMT"); |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | [] T.timeout { |
Harald Welte | 6929e32 | 2020-12-12 13:10:45 +0100 | [diff] [blame] | 599 | setverdict(fail, "Timeout waiting for unblock of all BVCs on SGSN side; ", |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 600 | "unblocked so far: ", bvci_unblocked); |
Harald Welte | 6929e32 | 2020-12-12 13:10:45 +0100 | [diff] [blame] | 601 | /* don't stop here but print below analysis */ |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 602 | } |
| 603 | } |
| 604 | |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 605 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 606 | /* iterate over list and check all BVCI */ |
| 607 | for (var integer j := 0; j < lengthof(g_sgsn[i].cfg.bvc); j := j+1) { |
| 608 | var BssgpBvci bvci := g_sgsn[i].cfg.bvc[j].bvci; |
| 609 | if (not ro_integer_contains(bvci_unblocked[i], bvci)) { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 610 | f_shutdown(__FILE__, __LINE__, fail, |
| 611 | log2str("SGSN ", i, " BVCI=", bvci, " was not unblocked during start-up")); |
Harald Welte | b978ed6 | 2020-12-12 14:01:11 +0100 | [diff] [blame] | 612 | } |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 613 | } |
| 614 | } |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 615 | |
| 616 | /* re-start guard timer after all BVCs are up, so it only counts the actual test case */ |
| 617 | g_Tguard.start(t_guard); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 618 | } |
| 619 | |
| 620 | function f_cleanup() runs on test_CT { |
Harald Welte | b9f0fdc | 2020-12-09 14:44:50 +0100 | [diff] [blame] | 621 | var integer i; |
| 622 | |
Daniel Willmann | 491af2a | 2021-01-08 01:32:51 +0100 | [diff] [blame] | 623 | /* To avoid a dynamic test case error we need to prevent messages arriving on unconnected |
| 624 | * ports. Waiting here ensures that any messages "in flight" will be delivered to the port |
| 625 | * before the component is shutdown and disconnected. */ |
| 626 | f_sleep(0.2); |
| 627 | |
Harald Welte | b9f0fdc | 2020-12-09 14:44:50 +0100 | [diff] [blame] | 628 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 629 | f_destroy_gb(g_sgsn[i]); |
| 630 | } |
| 631 | for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 632 | f_destroy_gb(g_pcu[i]); |
| 633 | } |
| 634 | |
| 635 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | type function void_fn(charstring id) runs on BSSGP_ConnHdlr; |
| 639 | |
| 640 | /* helper function to create, connect and start a BSSGP_ConnHdlr component */ |
Harald Welte | 207166c | 2021-01-16 12:52:30 +0100 | [diff] [blame] | 641 | function f_start_handler(void_fn fn, charstring id, integer imsi_suffix, float t_guard := 30.0, |
| 642 | integer sgsn_idx := 0, integer nri_idx := 0, boolean have_ptmsi := true) |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 643 | runs on test_CT return BSSGP_ConnHdlr { |
| 644 | var BSSGP_ConnHdlr vc_conn; |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 645 | var integer nri := mp_sgsn_nri[sgsn_idx][nri_idx]; |
Harald Welte | 77218d0 | 2021-01-15 19:59:15 +0100 | [diff] [blame] | 646 | var OCT4 p_tmsi := f_gen_tmsi(imsi_suffix, nri_v := nri, nri_bitlen := mp_nri_bitlength); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 647 | |
| 648 | var BSSGP_ConnHdlrPars pars := { |
| 649 | imei := f_gen_imei(imsi_suffix), |
| 650 | imsi := f_gen_imsi(imsi_suffix), |
| 651 | msisdn := f_gen_msisdn(imsi_suffix), |
Harald Welte | dbd5e67 | 2021-01-14 21:03:14 +0100 | [diff] [blame] | 652 | p_tmsi := p_tmsi, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 653 | p_tmsi_sig := omit, |
Harald Welte | dbd5e67 | 2021-01-14 21:03:14 +0100 | [diff] [blame] | 654 | tlli := f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL), |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 655 | tlli_old := omit, |
| 656 | ra := omit, |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 657 | pcu := g_pcu, |
| 658 | sgsn := g_sgsn, |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 659 | sgsn_idx := sgsn_idx, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 660 | t_guard := t_guard |
| 661 | }; |
Harald Welte | 207166c | 2021-01-16 12:52:30 +0100 | [diff] [blame] | 662 | if (not have_ptmsi) { |
| 663 | pars.p_tmsi := omit; |
| 664 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 665 | |
| 666 | vc_conn := BSSGP_ConnHdlr.create(id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 667 | |
Harald Welte | 25a04b1 | 2021-01-17 11:09:49 +0100 | [diff] [blame] | 668 | log("Starting ", id, " for SGSN[", sgsn_idx, "], NRI=", nri, ", P-TMSI=", pars.p_tmsi, |
| 669 | ", TLLI=", pars.tlli, ", IMSI=", pars.imsi, " on component=", vc_conn); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 670 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 671 | return vc_conn; |
| 672 | } |
| 673 | |
Harald Welte | 207166c | 2021-01-16 12:52:30 +0100 | [diff] [blame] | 674 | function f_start_handlers(void_fn fn, charstring id, integer imsi_suffix, float t_guard := 30.0, |
| 675 | boolean have_ptmsi := true) |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 676 | runs on test_CT |
| 677 | { |
| 678 | var integer sgsn_idx, nri_idx; |
| 679 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx:=sgsn_idx+1) { |
| 680 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx:=nri_idx+1) { |
| 681 | var integer extd_imsi_suffix := 1000*sgsn_idx + 100*nri_idx; |
| 682 | var BSSGP_ConnHdlr vc_conn; |
Harald Welte | 207166c | 2021-01-16 12:52:30 +0100 | [diff] [blame] | 683 | vc_conn := f_start_handler(fn, id, extd_imsi_suffix, t_guard, sgsn_idx, nri_idx, |
| 684 | have_ptmsi); |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 685 | /* Idea: we could also run them in parallel ? */ |
| 686 | vc_conn.done; |
| 687 | } |
| 688 | } |
| 689 | } |
| 690 | |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 691 | /* Connect the PCU-side per-BVC ports (PCU/PCU_SIG/PCU_PROC) array slot 'port_idx' to specified per-BVC component */ |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 692 | private function f_connect_to_pcu_bvc(integer port_idx, integer nse_idx, integer bvc_idx) |
| 693 | runs on BSSGP_ConnHdlr { |
| 694 | var BSSGP_BVC_CT bvc_ct := g_pars.pcu[nse_idx].vc_BSSGP_BVC[bvc_idx] |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 695 | if (PCU_PTP[port_idx].checkstate("Connected")) { |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 696 | /* unregister + disconnect from old BVC */ |
| 697 | f_client_unregister(g_pars.imsi, PCU_PROC[port_idx]); |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 698 | disconnect(self:PCU_PTP[port_idx], pcu_ct[port_idx]:BSSGP_SP); |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 699 | disconnect(self:PCU_SIG[port_idx], pcu_ct[port_idx]:BSSGP_SP_SIG); |
| 700 | disconnect(self:PCU_PROC[port_idx], pcu_ct[port_idx]:BSSGP_PROC); |
| 701 | } |
| 702 | /* connect to new BVC and register us */ |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 703 | connect(self:PCU_PTP[port_idx], bvc_ct:BSSGP_SP); |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 704 | connect(self:PCU_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); |
| 705 | connect(self:PCU_PROC[port_idx], bvc_ct:BSSGP_PROC); |
| 706 | f_client_register(g_pars.imsi, g_pars.tlli, PCU_PROC[port_idx]); |
| 707 | pcu_ct[port_idx] := bvc_ct; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 708 | pcu_bvc_cfg[port_idx] := g_pars.pcu[nse_idx].cfg.bvc[bvc_idx]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 709 | } |
| 710 | |
| 711 | /* Connect the SGSN-side per-BVC ports (SGSN/SGSN_SIG/SGSN_PROC) array slot 'port_idx' to specified per-BVC component */ |
| 712 | private function f_connect_to_sgsn_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) runs on BSSGP_ConnHdlr { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 713 | if (SGSN_PTP[port_idx].checkstate("Connected")) { |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 714 | /* unregister + disconnect from old BVC */ |
| 715 | f_client_unregister(g_pars.imsi, SGSN_PROC[port_idx]); |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 716 | disconnect(self:SGSN_PTP[port_idx], sgsn_ct[port_idx]:BSSGP_SP); |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 717 | disconnect(self:SGSN_SIG[port_idx], sgsn_ct[port_idx]:BSSGP_SP_SIG); |
| 718 | disconnect(self:SGSN_PROC[port_idx], sgsn_ct[port_idx]:BSSGP_PROC); |
| 719 | } |
| 720 | /* connect to new BVC and register us */ |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 721 | connect(self:SGSN_PTP[port_idx], bvc_ct:BSSGP_SP); |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 722 | connect(self:SGSN_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); |
| 723 | connect(self:SGSN_PROC[port_idx], bvc_ct:BSSGP_PROC); |
| 724 | f_client_register(g_pars.imsi, g_pars.tlli, SGSN_PROC[port_idx]); |
| 725 | sgsn_ct[port_idx] := bvc_ct; |
| 726 | } |
| 727 | |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 728 | private altstep as_gTguard(timer Tguard) { |
| 729 | [] Tguard.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 730 | f_shutdown(__FILE__, __LINE__, fail, "Tguard timeout"); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 731 | } |
| 732 | } |
| 733 | |
| 734 | /* first function called in every ConnHdlr */ |
| 735 | private function f_handler_init(void_fn fn, charstring id, BSSGP_ConnHdlrPars pars) |
| 736 | runs on BSSGP_ConnHdlr { |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 737 | var integer i; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 738 | /* do some common stuff like setting up g_pars */ |
| 739 | g_pars := pars; |
| 740 | |
| 741 | llc := f_llc_create(false); |
| 742 | |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 743 | /* default connections on PCU side: First BVC of each NSE/PCU */ |
| 744 | for (i := 0; i < lengthof(g_pars.pcu); i := i+1) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 745 | f_connect_to_pcu_bvc(port_idx := i, nse_idx := i, bvc_idx := 0); |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 746 | } |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 747 | |
| 748 | /* default connections on SGSN side: First BVC of each NSE/SGSN */ |
| 749 | for (i := 0; i < lengthof(g_pars.sgsn); i := i+1) { |
| 750 | f_connect_to_sgsn_bvc(i, g_pars.sgsn[i].vc_BSSGP_BVC[0]); |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 751 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 752 | |
| 753 | g_Tguard.start(pars.t_guard); |
Harald Welte | 425d376 | 2020-12-09 14:33:18 +0100 | [diff] [blame] | 754 | activate(as_gTguard(g_Tguard)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 755 | |
| 756 | /* call the user-supplied test case function */ |
| 757 | fn.apply(id); |
Harald Welte | b33fb59 | 2021-01-16 12:50:56 +0100 | [diff] [blame] | 758 | |
| 759 | for (i := 0; i < NUM_SGSN; i := i+1) { |
| 760 | if (SGSN_PROC[i].checkstate("Connected")) { |
| 761 | f_client_unregister(g_pars.imsi, SGSN_PROC[i]) |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | for (i := 0; i < NUM_PCU; i := i+1) { |
| 766 | if (PCU_PROC[i].checkstate("Connected")) { |
| 767 | f_client_unregister(g_pars.imsi, PCU_PROC[i]) |
| 768 | } |
| 769 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 770 | } |
| 771 | |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 772 | private function f_client_register(hexstring imsi, OCT4 tlli, BSSGP_PROC_PT PT) |
| 773 | runs on BSSGP_ConnHdlr { |
| 774 | PT.call(BSSGP_register_client:{imsi, tlli}) { |
| 775 | [] PT.getreply(BSSGP_register_client:{imsi, tlli}) {}; |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | private function f_client_unregister(hexstring imsi, BSSGP_PROC_PT PT) |
| 780 | runs on BSSGP_ConnHdlr { |
| 781 | PT.call(BSSGP_unregister_client:{imsi}) { |
| 782 | [] PT.getreply(BSSGP_unregister_client:{imsi}) {}; |
| 783 | } |
| 784 | } |
| 785 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 786 | /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */ |
| 787 | friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 788 | integer pcu_idx := 0, boolean use_sig := false) runs on BSSGP_ConnHdlr { |
| 789 | var integer sgsn_idx := g_pars.sgsn_idx; |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 790 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 791 | timer T := 2.0; |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 792 | |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 793 | if (use_sig) { |
| 794 | PCU_SIG[pcu_idx].send(tx); |
| 795 | } else { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 796 | PCU_PTP[pcu_idx].send(tx); |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 797 | } |
| 798 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 799 | T.start; |
| 800 | alt { |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 801 | [use_sig] SGSN_SIG[sgsn_idx].receive(exp_rx) { |
| 802 | setverdict(pass); |
| 803 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 804 | [not use_sig] SGSN_PTP[sgsn_idx].receive(exp_rx) { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 805 | setverdict(pass); |
| 806 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 807 | [] SGSN_PTP[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 808 | f_shutdown(__FILE__, __LINE__, fail, |
| 809 | log2str("Unexpected BSSGP on SGSN[", sgsn_idx, "] side: ", rx)); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 810 | } |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 811 | [] SGSN_SIG[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 812 | f_shutdown(__FILE__, __LINE__, fail, |
| 813 | log2str("Unexpected SIG BSSGP on SGSN[", sgsn_idx, "] side: ", rx)); |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 814 | } |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 815 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 816 | f_shutdown(__FILE__, __LINE__, fail, |
| 817 | log2str("Timeout waiting for BSSGP on SGSN[", sgsn_idx, "] side: ", exp_rx)); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 818 | } |
| 819 | } |
| 820 | } |
| 821 | |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 822 | /* Send 'tx' from PCU; expect 'exp_rx' on _any_ SGSN */ |
| 823 | friend function f_pcu2any_sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 824 | integer pcu_idx := 0, boolean use_sig := false) |
| 825 | runs on BSSGP_ConnHdlr return integer { |
| 826 | var integer rx_idx := -1; |
| 827 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 828 | timer T := 2.0; |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 829 | |
| 830 | if (use_sig) { |
| 831 | PCU_SIG[pcu_idx].send(tx); |
| 832 | } else { |
| 833 | PCU_PTP[pcu_idx].send(tx); |
| 834 | } |
| 835 | |
| 836 | T.start; |
| 837 | alt { |
| 838 | [use_sig] any from SGSN_SIG.receive(exp_rx) -> @index value rx_idx { |
| 839 | setverdict(pass); |
| 840 | } |
| 841 | [not use_sig] any from SGSN_PTP.receive(exp_rx) -> @index value rx_idx { |
| 842 | setverdict(pass); |
| 843 | } |
| 844 | [] any from SGSN_PTP.receive(PDU_BSSGP:?) -> value rx @index value rx_idx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 845 | f_shutdown(__FILE__, __LINE__, fail, |
| 846 | log2str("Unexpected BSSGP on SGSN[", rx_idx, "] side: ", rx)); |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 847 | } |
| 848 | [] any from SGSN_SIG.receive(PDU_BSSGP:?) -> value rx @index value rx_idx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 849 | f_shutdown(__FILE__, __LINE__, fail, |
| 850 | log2str("Unexpected SIG BSSGP on SGSN[", rx_idx, "] side: ", rx)); |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 851 | } |
| 852 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 853 | f_shutdown(__FILE__, __LINE__, fail, |
| 854 | log2str("Timeout waiting for BSSGP on SGSN side: ", exp_rx)); |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 855 | } |
| 856 | } |
| 857 | return rx_idx; |
| 858 | } |
| 859 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 860 | /* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ |
| 861 | friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
Harald Welte | c5f486b | 2021-01-16 11:07:01 +0100 | [diff] [blame] | 862 | integer pcu_idx := 0, boolean use_sig := false) runs on BSSGP_ConnHdlr { |
| 863 | var integer sgsn_idx := g_pars.sgsn_idx; |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 864 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 865 | timer T := 2.0; |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 866 | |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 867 | if (use_sig) { |
| 868 | SGSN_SIG[sgsn_idx].send(tx); |
| 869 | } else { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 870 | SGSN_PTP[sgsn_idx].send(tx); |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 871 | } |
| 872 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 873 | T.start; |
| 874 | alt { |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 875 | [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 876 | setverdict(pass); |
| 877 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 878 | [not use_sig] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 879 | setverdict(pass); |
| 880 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 881 | [] PCU_PTP[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 882 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on PCU side: ", rx)); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 883 | } |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 884 | [] PCU_SIG[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 885 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected SIG BSSGP on PCU side: ", rx)); |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 886 | } |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 887 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 888 | f_shutdown(__FILE__, __LINE__, fail, |
| 889 | log2str("Timeout waiting for BSSGP on PCU side: ", exp_rx)); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 890 | } |
| 891 | } |
| 892 | } |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 893 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 894 | /*********************************************************************** |
| 895 | * GlobaLTest_CT: Using the per-NSE GLOBAL ports on PCU + SGSN side |
| 896 | ***********************************************************************/ |
| 897 | |
| 898 | type component GlobalTest_CT extends test_CT { |
| 899 | port BSSGP_PT G_PCU[NUM_PCU]; |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 900 | var integer g_pcu_idx[NUM_PCU]; /* BVC index currently connected to G_PCU */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 901 | port BSSGP_PT G_SGSN[NUM_SGSN]; |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 902 | var integer g_sgsn_idx[NUM_SGSN]; /* BVC index currently connected to G_SGSN */ |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 903 | port BSSGP_PT RIM_PCU[NUM_PCU]; |
| 904 | port BSSGP_PT RIM_SGSN[NUM_SGSN]; |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 905 | }; |
| 906 | |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 907 | /* connect the signaling BVC of each NSE to the G_PCU / G_SGSN ports */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 908 | private function f_global_init() runs on GlobalTest_CT { |
| 909 | var integer i; |
| 910 | for (i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 911 | connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP:GLOBAL); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 912 | connect(self:RIM_SGSN[i], g_sgsn[i].vc_BSSGP:RIM); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 913 | } |
| 914 | for (i := 0; i < lengthof(g_pcu); i := i+1) { |
| 915 | connect(self:G_PCU[i], g_pcu[i].vc_BSSGP:GLOBAL); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 916 | connect(self:RIM_PCU[i], g_pcu[i].vc_BSSGP:RIM); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 917 | } |
| 918 | } |
| 919 | |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 920 | /* connect the first PTP BVC of each NSE to the G_PCU / G_SGSN ports */ |
| 921 | private function f_global_init_ptp() runs on GlobalTest_CT { |
| 922 | var integer i; |
| 923 | for (i := 0; i < lengthof(g_sgsn); i := i+1) { |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 924 | log("Connecting G_SGSN[", i, "] to BVCI=", g_sgsn[i].cfg.bvc[0].bvci); |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 925 | connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP_BVC[0]:GLOBAL); |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 926 | g_sgsn_idx[i] := 0; |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 927 | } |
| 928 | for (i := 0; i < lengthof(g_pcu); i := i+1) { |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 929 | log("Connecting G_PCU[", i, "] to BVCI=", g_pcu[i].cfg.bvc[0].bvci); |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 930 | connect(self:G_PCU[i], g_pcu[i].vc_BSSGP_BVC[0]:GLOBAL); |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 931 | g_pcu_idx[i] := 0; |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 932 | } |
| 933 | } |
| 934 | |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 935 | /* (re)connect G_SGSN[sgsn_idx] to a specific PTP BVCI */ |
| 936 | private function f_global_ptp_connect_sgsn_bvci(integer sgsn_idx, BssgpBvci bvci) runs on GlobalTest_CT |
| 937 | { |
| 938 | var integer sgsn_bvc_idx := get_bvc_idx_for_bvci(g_sgsn[sgsn_idx], bvci); |
| 939 | var integer old_sgsn_bvc_idx := g_sgsn_idx[sgsn_idx]; |
| 940 | disconnect(self:G_SGSN[sgsn_idx], g_sgsn[sgsn_idx].vc_BSSGP_BVC[old_sgsn_bvc_idx]:GLOBAL); |
| 941 | connect(self:G_SGSN[sgsn_idx], g_sgsn[sgsn_idx].vc_BSSGP_BVC[sgsn_bvc_idx]:GLOBAL); |
| 942 | g_sgsn_idx[sgsn_idx] := sgsn_bvc_idx; |
| 943 | } |
| 944 | |
| 945 | /* (re)connect G_PCU[pcu_idx] to a specific PTP BVCI */ |
| 946 | private function f_global_ptp_connect_pcu_bvci(integer pcu_idx, BssgpBvci bvci) runs on GlobalTest_CT |
| 947 | { |
| 948 | var integer pcu_bvc_idx := get_bvc_idx_for_bvci(g_pcu[pcu_idx], bvci); |
| 949 | var integer old_pcu_bvc_idx := g_pcu_idx[pcu_idx]; |
| 950 | disconnect(self:G_PCU[pcu_idx], g_pcu[pcu_idx].vc_BSSGP_BVC[old_pcu_bvc_idx]:GLOBAL); |
| 951 | connect(self:G_PCU[pcu_idx], g_pcu[pcu_idx].vc_BSSGP_BVC[pcu_bvc_idx]:GLOBAL); |
| 952 | g_pcu_idx[pcu_idx] := pcu_bvc_idx; |
| 953 | } |
| 954 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 955 | /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */ |
| 956 | friend function f_global_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 957 | integer pcu_idx := 0, integer sgsn_idx := 0) runs on GlobalTest_CT { |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 958 | var integer rx_idx; |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 959 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 960 | timer T := 2.0; |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 961 | |
| 962 | G_PCU[pcu_idx].send(tx); |
| 963 | T.start; |
| 964 | alt { |
| 965 | [] G_SGSN[sgsn_idx].receive(exp_rx) { |
| 966 | setverdict(pass); |
| 967 | } |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 968 | [] any from G_SGSN.receive(exp_rx) -> @index value rx_idx { |
| 969 | setverdict(fail, "BSSGP arrived on wrong SGSN[", rx_idx, "] instead of SGSN[", sgsn_idx, "]"); |
| 970 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 971 | [] G_SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 972 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on SGSN side: ", rx)); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 973 | } |
| 974 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 975 | f_shutdown(__FILE__, __LINE__, fail, log2str("Timeout waiting for BSSGP on SGSN side: ", exp_rx)); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 976 | } |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | /* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ |
| 981 | friend function f_global_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 982 | integer sgsn_idx := 0, integer pcu_idx := 0) runs on GlobalTest_CT { |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 983 | var integer rx_idx; |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 984 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 985 | timer T := 2.0; |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 986 | |
| 987 | G_SGSN[sgsn_idx].send(tx); |
| 988 | T.start; |
| 989 | alt { |
| 990 | [] G_PCU[pcu_idx].receive(exp_rx) { |
| 991 | setverdict(pass); |
| 992 | } |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 993 | [] any from G_PCU.receive(exp_rx) -> @index value rx_idx { |
| 994 | setverdict(fail, "BSSGP arrived on wrong PCU[", rx_idx, "] instead of PCU[", pcu_idx, "]"); |
| 995 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 996 | [] G_PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 997 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on PCU side: ", rx)); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 998 | } |
| 999 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1000 | f_shutdown(__FILE__, __LINE__, fail, log2str("Timeout waiting for BSSGP on PCU side: ", exp_rx)); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1006 | /* TODO: |
| 1007 | * Detach without Attach |
| 1008 | * SM procedures without attach / RAU |
| 1009 | * ATTACH / RAU |
| 1010 | ** with / without authentication |
| 1011 | ** with / without P-TMSI allocation |
| 1012 | * re-transmissions of LLC frames |
| 1013 | * PDP Context activation |
| 1014 | ** with different GGSN config in SGSN VTY |
| 1015 | ** with different PDP context type (v4/v6/v46) |
| 1016 | ** timeout from GGSN |
| 1017 | ** multiple / secondary PDP context |
| 1018 | */ |
| 1019 | |
| 1020 | private function f_TC_BVC_bringup(charstring id) runs on BSSGP_ConnHdlr { |
| 1021 | f_sleep(5.0); |
| 1022 | setverdict(pass); |
| 1023 | } |
| 1024 | |
| 1025 | testcase TC_BVC_bringup() runs on test_CT { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1026 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1027 | f_start_handlers(refers(f_TC_BVC_bringup), testcasename(), 51); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1028 | f_cleanup(); |
| 1029 | } |
| 1030 | |
| 1031 | friend function f_bssgp_suspend(integer ran_idx := 0) runs on BSSGP_ConnHdlr return OCT1 { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1032 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1033 | timer T := 5.0; |
| 1034 | var PDU_BSSGP rx_pdu; |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1035 | PCU_SIG[ran_idx].send(ts_BSSGP_SUSPEND(g_pars.tlli, bvcc.cell_id.ra_id)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1036 | T.start; |
| 1037 | alt { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1038 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_SUSPEND_ACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) -> value rx_pdu { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1039 | return rx_pdu.pDU_BSSGP_SUSPEND_ACK.suspend_Reference_Number.suspend_Reference_Number_value; |
| 1040 | } |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1041 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_SUSPEND_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) -> value rx_pdu { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1042 | f_shutdown(__FILE__, __LINE__, fail, |
| 1043 | log2str("SUSPEND-NACK in response to SUSPEND for TLLI ", g_pars.tlli)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1044 | } |
| 1045 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1046 | f_shutdown(__FILE__, __LINE__, fail, |
| 1047 | log2str("No SUSPEND-ACK in response to SUSPEND for TLLI ", g_pars.tlli)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1048 | } |
| 1049 | } |
| 1050 | return '00'O; |
| 1051 | } |
| 1052 | |
| 1053 | friend function f_bssgp_resume(OCT1 susp_ref, integer ran_idx := 0) runs on BSSGP_ConnHdlr { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1054 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1055 | timer T := 5.0; |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1056 | PCU_SIG[ran_idx].send(ts_BSSGP_RESUME(g_pars.tlli, bvcc.cell_id.ra_id, susp_ref)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1057 | T.start; |
| 1058 | alt { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1059 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_ACK(g_pars.tlli, bvcc.cell_id.ra_id)); |
| 1060 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1061 | f_shutdown(__FILE__, __LINE__, fail, |
| 1062 | log2str("RESUME-NACK in response to RESUME for TLLI ", g_pars.tlli)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1063 | } |
| 1064 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1065 | f_shutdown(__FILE__, __LINE__, fail, |
| 1066 | log2str("No RESUME-ACK in response to SUSPEND for TLLI ", g_pars.tlli)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 1067 | } |
| 1068 | } |
| 1069 | } |
| 1070 | |
| 1071 | |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1072 | /* send uplink-unitdata of a variety of different sizes; expect it to show up on SGSN */ |
| 1073 | private function f_TC_ul_unitdata(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1074 | var integer ran_idx := 0; |
| 1075 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1076 | var integer i; |
| 1077 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 1078 | for (i := 0; i < max_fr_info_size-4; i := i+4) { |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1079 | var octetstring payload := f_rnd_octstring(i); |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1080 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1081 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 1082 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1083 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 1084 | log("UL-UNITDATA(payload_size=", i); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 1085 | f_pcu2sgsn(pdu_tx, pdu_rx); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1086 | } |
| 1087 | setverdict(pass); |
| 1088 | } |
| 1089 | |
| 1090 | testcase TC_ul_unitdata() runs on test_CT |
| 1091 | { |
Daniel Willmann | c879f34 | 2021-02-11 14:28:01 +0100 | [diff] [blame] | 1092 | f_init(60.0); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1093 | f_start_handlers(refers(f_TC_ul_unitdata), testcasename(), 1); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1094 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1095 | f_cleanup(); |
| 1096 | } |
| 1097 | |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1098 | /* send downlink-unitdata of a variety of different sizes; expect it to show up on PCU */ |
| 1099 | private function f_TC_dl_unitdata(charstring id) runs on BSSGP_ConnHdlr { |
| 1100 | var integer i; |
| 1101 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 1102 | for (i := 0; i < max_fr_info_size-4; i := i+4) { |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1103 | var octetstring payload := f_rnd_octstring(i); |
| 1104 | var template (value) PDU_BSSGP pdu_tx := |
| 1105 | ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi)); |
| 1106 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1107 | var template (present) PDU_BSSGP pdu_rx := |
Daniel Willmann | 325458d | 2021-02-11 14:22:42 +0100 | [diff] [blame] | 1108 | tr_BSSGP_DL_UD(g_pars.tlli, payload, tr_BSSGP_IMSI(g_pars.imsi)); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1109 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 1110 | log("DL-UNITDATA(payload_size=", i); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 1111 | f_sgsn2pcu(pdu_tx, pdu_rx); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1112 | } |
| 1113 | setverdict(pass); |
| 1114 | } |
| 1115 | |
| 1116 | testcase TC_dl_unitdata() runs on test_CT |
| 1117 | { |
Daniel Willmann | c879f34 | 2021-02-11 14:28:01 +0100 | [diff] [blame] | 1118 | f_init(60.0); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1119 | f_start_handlers(refers(f_TC_dl_unitdata), testcasename(), 2); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1120 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 1121 | f_cleanup(); |
| 1122 | } |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 1123 | |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1124 | private function f_TC_ra_capability(charstring id) runs on BSSGP_ConnHdlr { |
| 1125 | var integer i; |
| 1126 | |
| 1127 | for (i := 0; i < 10; i := i+1) { |
| 1128 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP(g_pars.tlli, { ts_RaCapRec_BSSGP }); |
| 1129 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1130 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP(g_pars.tlli, { tr_RaCapRec_BSSGP }) |
| 1131 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 1132 | f_sgsn2pcu(pdu_tx, pdu_rx); |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1133 | } |
| 1134 | setverdict(pass); |
| 1135 | } |
| 1136 | testcase TC_ra_capability() runs on test_CT |
| 1137 | { |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1138 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1139 | f_start_handlers(refers(f_TC_ra_capability), testcasename(), 3); |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1140 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1141 | f_cleanup(); |
| 1142 | } |
| 1143 | |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 1144 | private function f_TC_ra_capability_upd(charstring id) runs on BSSGP_ConnHdlr { |
| 1145 | var integer i; |
| 1146 | var OCT1 tag; |
| 1147 | for (i := 0; i < 10; i := i+1) { |
| 1148 | tag := int2oct(23 + i, 1); |
| 1149 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP_UPD(g_pars.tlli, tag); |
| 1150 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1151 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP_UPD(g_pars.tlli, tag) |
| 1152 | |
| 1153 | f_pcu2sgsn(pdu_tx, pdu_rx); |
| 1154 | |
| 1155 | pdu_tx := ts_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O); |
| 1156 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1157 | pdu_rx := tr_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O) |
| 1158 | |
| 1159 | f_sgsn2pcu(pdu_tx, pdu_rx); |
| 1160 | } |
| 1161 | setverdict(pass); |
| 1162 | } |
| 1163 | testcase TC_ra_capability_upd() runs on test_CT |
| 1164 | { |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 1165 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1166 | f_start_handlers(refers(f_TC_ra_capability_upd), testcasename(), 4); |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 1167 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 1168 | f_cleanup(); |
| 1169 | } |
| 1170 | |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 1171 | private function f_TC_radio_status(charstring id) runs on BSSGP_ConnHdlr { |
| 1172 | var integer i; |
| 1173 | var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST; |
| 1174 | for (i := 0; i < 10; i := i+1) { |
| 1175 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(g_pars.tlli, cause); |
| 1176 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1177 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(g_pars.tlli, cause) |
| 1178 | |
| 1179 | f_pcu2sgsn(pdu_tx, pdu_rx); |
| 1180 | } |
| 1181 | setverdict(pass); |
| 1182 | } |
| 1183 | testcase TC_radio_status() runs on test_CT |
| 1184 | { |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 1185 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1186 | f_start_handlers(refers(f_TC_radio_status), testcasename(), 5); |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 1187 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 1188 | f_cleanup(); |
| 1189 | } |
| 1190 | |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 1191 | private function f_TC_radio_status_tmsi(charstring id) runs on BSSGP_ConnHdlr { |
| 1192 | var integer i; |
| 1193 | var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST; |
| 1194 | for (i := 0; i < 10; i := i+1) { |
| 1195 | var integer tmsi_int := oct2int(g_pars.p_tmsi); |
| 1196 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(omit, cause, tmsi_int); |
| 1197 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1198 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(omit, cause, tmsi_int); |
| 1199 | f_pcu2sgsn(pdu_tx, pdu_rx); |
| 1200 | } |
| 1201 | setverdict(pass); |
| 1202 | } |
| 1203 | testcase TC_radio_status_tmsi() runs on test_CT |
| 1204 | { |
| 1205 | f_init(); |
| 1206 | f_start_handlers(refers(f_TC_radio_status_tmsi), testcasename(), 5); |
| 1207 | f_cleanup(); |
| 1208 | } |
| 1209 | |
| 1210 | private function f_TC_radio_status_imsi(charstring id) runs on BSSGP_ConnHdlr { |
| 1211 | var integer i; |
| 1212 | var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST; |
| 1213 | for (i := 0; i < 10; i := i+1) { |
| 1214 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(omit, cause, imsi := g_pars.imsi); |
| 1215 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1216 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(omit, cause, imsi := g_pars.imsi); |
| 1217 | f_pcu2any_sgsn(pdu_tx, pdu_rx); |
| 1218 | } |
| 1219 | setverdict(pass); |
| 1220 | } |
| 1221 | testcase TC_radio_status_imsi() runs on test_CT |
| 1222 | { |
| 1223 | f_init(); |
| 1224 | f_start_handlers(refers(f_TC_radio_status_imsi), testcasename(), 5); |
| 1225 | f_cleanup(); |
| 1226 | } |
| 1227 | |
| 1228 | |
| 1229 | |
Harald Welte | 99ed507 | 2021-01-15 20:38:58 +0100 | [diff] [blame] | 1230 | private function f_suspend_one(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx, |
| 1231 | integer suffix) |
Harald Welte | 0096375 | 2021-01-15 20:33:11 +0100 | [diff] [blame] | 1232 | runs on GlobalTest_CT |
| 1233 | { |
| 1234 | var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id; |
Harald Welte | 99ed507 | 2021-01-15 20:38:58 +0100 | [diff] [blame] | 1235 | var OCT4 p_tmsi := f_gen_tmsi(suffix, nri_v := mp_sgsn_nri[sgsn_idx][nri_idx], |
| 1236 | nri_bitlen := mp_nri_bitlength); |
| 1237 | var OCT4 tlli := f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL); |
Harald Welte | 0096375 | 2021-01-15 20:33:11 +0100 | [diff] [blame] | 1238 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id); |
| 1239 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1240 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id); |
| 1241 | f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx); |
| 1242 | |
| 1243 | pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1)); |
| 1244 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1245 | pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1)); |
| 1246 | f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx); |
| 1247 | |
| 1248 | pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id); |
| 1249 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1250 | pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id); |
| 1251 | f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx); |
| 1252 | |
| 1253 | /* These messages are simple passed through so just also test sending NACK */ |
| 1254 | pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
| 1255 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1256 | pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
| 1257 | f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx); |
| 1258 | } |
| 1259 | |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1260 | private function f_TC_suspend(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx) |
| 1261 | runs on GlobalTest_CT { |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1262 | var integer i; |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 1263 | |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1264 | for (i := 0; i < 10; i := i+1) { |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1265 | f_suspend_one(sgsn_idx, nri_idx, pcu_idx, bvc_idx, suffix := i); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1266 | } |
| 1267 | setverdict(pass); |
| 1268 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 1269 | testcase TC_suspend() runs on GlobalTest_CT |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1270 | { |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1271 | var integer sgsn_idx, nri_idx; |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1272 | f_init(); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 1273 | f_global_init(); |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1274 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx+1) { |
| 1275 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx+1) { |
| 1276 | f_TC_suspend(sgsn_idx, nri_idx, pcu_idx:=0, bvc_idx:=0); |
| 1277 | } |
| 1278 | } |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 1279 | f_cleanup(); |
| 1280 | } |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1281 | |
Harald Welte | 99ed507 | 2021-01-15 20:38:58 +0100 | [diff] [blame] | 1282 | private function f_resume_one(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx, |
| 1283 | integer suffix) |
Harald Welte | 0096375 | 2021-01-15 20:33:11 +0100 | [diff] [blame] | 1284 | runs on GlobalTest_CT |
| 1285 | { |
| 1286 | var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id; |
Harald Welte | 99ed507 | 2021-01-15 20:38:58 +0100 | [diff] [blame] | 1287 | var OCT4 p_tmsi := f_gen_tmsi(suffix, nri_v := mp_sgsn_nri[sgsn_idx][nri_idx], |
| 1288 | nri_bitlen := mp_nri_bitlength); |
| 1289 | var OCT4 tlli := f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL); |
Harald Welte | 0096375 | 2021-01-15 20:33:11 +0100 | [diff] [blame] | 1290 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1)); |
| 1291 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1292 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1)); |
| 1293 | f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx); |
| 1294 | |
| 1295 | pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id); |
| 1296 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1297 | pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id); |
| 1298 | f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx); |
| 1299 | |
| 1300 | pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1)); |
| 1301 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1302 | pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1)); |
| 1303 | f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx); |
| 1304 | |
| 1305 | /* These messages are simple passed through so just also test sending NACK */ |
| 1306 | pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
| 1307 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1308 | pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
| 1309 | f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx); |
| 1310 | } |
| 1311 | |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1312 | private function f_TC_resume(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx) |
| 1313 | runs on GlobalTest_CT { |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1314 | var integer i; |
| 1315 | |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1316 | for (i := 0; i < 10; i := i+1) { |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1317 | f_resume_one(sgsn_idx, nri_idx, pcu_idx, bvc_idx, suffix := i); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1318 | } |
| 1319 | setverdict(pass); |
| 1320 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 1321 | testcase TC_resume() runs on GlobalTest_CT |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1322 | { |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1323 | var integer sgsn_idx, nri_idx; |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1324 | f_init(); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 1325 | f_global_init(); |
Harald Welte | c5c3373 | 2021-01-15 21:04:35 +0100 | [diff] [blame] | 1326 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx+1) { |
| 1327 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx+1) { |
| 1328 | f_TC_resume(sgsn_idx, nri_idx, pcu_idx:=0, bvc_idx:=0); |
| 1329 | } |
| 1330 | } |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 1331 | f_cleanup(); |
| 1332 | } |
| 1333 | |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1334 | /* test the load-sharing between multiple NS-VC on the BSS side */ |
| 1335 | private function f_TC_dl_ud_unidir(charstring id) runs on BSSGP_ConnHdlr { |
| 1336 | var integer i; |
| 1337 | |
| 1338 | for (i := 0; i < 10; i := i+1) { |
| 1339 | var octetstring payload := f_rnd_octstring(i); |
| 1340 | var template (value) PDU_BSSGP pdu_tx := |
| 1341 | ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi)); |
Harald Welte | 09a1ce4 | 2021-01-16 11:18:38 +0100 | [diff] [blame] | 1342 | SGSN_PTP[g_pars.sgsn_idx].send(pdu_tx); |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1343 | } |
| 1344 | setverdict(pass); |
| 1345 | } |
Harald Welte | 09a1ce4 | 2021-01-16 11:18:38 +0100 | [diff] [blame] | 1346 | |
| 1347 | private function f_TC_load_sharing_dl(integer sgsn_idx) runs on test_CT_NS |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1348 | { |
| 1349 | const integer num_ue := 10; |
| 1350 | var BSSGP_ConnHdlr vc_conn[num_ue]; |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1351 | /* all BVC are now fully brought up. We disconnect BSSGP from NS on the BSS |
| 1352 | * side so we get the raw NsUnitdataIndication and hence observe different |
| 1353 | * NSVCI */ |
| 1354 | disconnect(g_pcu[0].vc_NS:NS_SP, g_pcu[0].vc_BSSGP:BSCP); |
| 1355 | connect(g_pcu[0].vc_NS:NS_SP, self:NS); |
| 1356 | |
| 1357 | /* there may still be some NS-VCs coming up? After all, the BVC-RESET succeeds after the first |
| 1358 | * of the NS-VC is ALIVE/UNBLOCKED */ |
| 1359 | f_sleep(3.0); |
| 1360 | |
| 1361 | /* start parallel components generating DL-UNITDATA from the SGSN side */ |
| 1362 | for (var integer i:= 0; i < num_ue; i := i+1) { |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1363 | vc_conn[i] := f_start_handler(refers(f_TC_dl_ud_unidir), testcasename(), |
Harald Welte | 09a1ce4 | 2021-01-16 11:18:38 +0100 | [diff] [blame] | 1364 | 5+i, 30.0, sgsn_idx); |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1365 | } |
| 1366 | |
| 1367 | /* now start counting all the messages that were queued before */ |
| 1368 | /* TODO: We have a hard-coded assumption of 4 NS-VC in one NSE/NS-VCG here! */ |
| 1369 | var ro_integer rx_count := { 0, 0, 0, 0 }; |
| 1370 | timer T := 2.0; |
| 1371 | T.start; |
| 1372 | alt { |
| 1373 | [] as_NsUdiCount(0, rx_count); |
| 1374 | [] as_NsUdiCount(1, rx_count); |
| 1375 | [] as_NsUdiCount(2, rx_count); |
| 1376 | [] as_NsUdiCount(3, rx_count); |
| 1377 | [] NS.receive(NsUnitdataIndication:{0,?,?,*,*}) { repeat; } /* signaling BVC */ |
| 1378 | [] NS.receive(NsStatusIndication:?) { repeat; } |
| 1379 | [] NS.receive { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 1380 | f_shutdown(__FILE__, __LINE__, fail, "Rx unexpected NS"); |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1381 | } |
| 1382 | [] T.timeout { |
| 1383 | } |
| 1384 | } |
| 1385 | for (var integer i := 0; i < lengthof(rx_count); i := i+1) { |
| 1386 | log("Rx on NSVCI ", mp_nsconfig_pcu[0].nsvc[i].nsvci, ": ", rx_count[i]); |
| 1387 | if (rx_count[i] == 0) { |
| 1388 | setverdict(fail, "Data not shared over all NSVC"); |
| 1389 | } |
| 1390 | } |
Harald Welte | 09a1ce4 | 2021-01-16 11:18:38 +0100 | [diff] [blame] | 1391 | } |
| 1392 | |
| 1393 | testcase TC_load_sharing_dl() runs on test_CT_NS |
| 1394 | { |
| 1395 | var integer sgsn_idx, nri_idx; |
| 1396 | f_init(); |
| 1397 | for (sgsn_idx:=0; sgsn_idx < NUM_SGSN; sgsn_idx:=sgsn_idx+1) { |
| 1398 | f_TC_load_sharing_dl(sgsn_idx); |
| 1399 | } |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 1400 | setverdict(pass); |
| 1401 | } |
| 1402 | private altstep as_NsUdiCount(integer nsvc_idx, inout ro_integer roi) runs on test_CT_NS { |
| 1403 | var NsUnitdataIndication udi; |
| 1404 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[0]; |
| 1405 | [] NS.receive(NsUnitdataIndication:{bvcc.bvci, g_pcu[0].cfg.nsei, mp_nsconfig_pcu[0].nsvc[nsvc_idx].nsvci, *, *}) -> value udi { |
| 1406 | roi[nsvc_idx] := roi[nsvc_idx] + 1; |
| 1407 | repeat; |
| 1408 | } |
| 1409 | } |
| 1410 | type component test_CT_NS extends test_CT { |
| 1411 | port NS_PT NS; |
| 1412 | }; |
| 1413 | |
| 1414 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1415 | /*********************************************************************** |
| 1416 | * PAGING PS procedure |
| 1417 | ***********************************************************************/ |
| 1418 | |
| 1419 | private function f_send_paging_ps(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1420 | boolean use_sig := false) |
| 1421 | runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP { |
| 1422 | var template (value) PDU_BSSGP pdu_tx; |
| 1423 | var template (present) PDU_BSSGP pdu_rx; |
| 1424 | /* we always specify '0' as BVCI in the templates below, as we override it with |
| 1425 | * 'p4' later anyway */ |
| 1426 | pdu_rx := tr_BSSGP_PS_PAGING(0); |
| 1427 | pdu_rx.pDU_BSSGP_PAGING_PS.iMSI := tr_BSSGP_IMSI(g_pars.imsi); |
| 1428 | if (ispresent(g_pars.p_tmsi)) { |
| 1429 | pdu_tx := ts_BSSGP_PS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi)); |
| 1430 | pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi)); |
| 1431 | } else { |
| 1432 | pdu_tx := ts_BSSGP_PS_PAGING_IMSI(0, g_pars.imsi); |
| 1433 | pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := omit; |
| 1434 | } |
| 1435 | pdu_tx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4; |
| 1436 | pdu_rx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4; |
| 1437 | if (use_sig == false) { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1438 | SGSN_PTP[sgsn_idx].send(pdu_tx); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1439 | } else { |
| 1440 | SGSN_SIG[sgsn_idx].send(pdu_tx); |
| 1441 | } |
| 1442 | return pdu_rx; |
| 1443 | } |
| 1444 | |
| 1445 | /* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on |
| 1446 | * specified PCU index */ |
| 1447 | private function f_send_paging_ps_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1448 | boolean use_sig := false,integer pcu_idx := 0) |
| 1449 | runs on BSSGP_ConnHdlr { |
| 1450 | var template (present) PDU_BSSGP exp_rx; |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1451 | var boolean test_done := false; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1452 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1453 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1454 | exp_rx := f_send_paging_ps(p4, sgsn_idx, use_sig); |
| 1455 | /* Expect paging to propagate to the one BSS addressed by the BVCI only */ |
| 1456 | timer T := 2.0; |
| 1457 | T.start; |
| 1458 | alt { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1459 | [not use_sig and not test_done] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1460 | setverdict(pass); |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1461 | test_done := true; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1462 | repeat; |
| 1463 | } |
| 1464 | [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1465 | setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC"); |
| 1466 | } |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1467 | [use_sig and not test_done] PCU_SIG[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1468 | setverdict(pass); |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1469 | test_done := true; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1470 | repeat; |
| 1471 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1472 | [use_sig] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1473 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1474 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1475 | [] any from PCU_PTP.receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1476 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1477 | } |
| 1478 | [] any from PCU_SIG.receive(exp_rx) { |
| 1479 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1480 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1481 | [] any from PCU_PTP.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1482 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1483 | } |
| 1484 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1485 | setverdict(fail, "Different Paging than expected on SIGNALING BVC"); |
| 1486 | } |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1487 | [not test_done] T.timeout { |
| 1488 | setverdict(fail, "Timeout waiting for paging"); |
| 1489 | } |
| 1490 | [test_done] T.timeout; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1491 | } |
| 1492 | } |
| 1493 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1494 | /* send a PS-PAGING but don't expect it to show up on any PTP or SIG BVC */ |
| 1495 | private function f_send_paging_ps_exp_no_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1496 | boolean use_sig := false) |
| 1497 | runs on BSSGP_ConnHdlr { |
| 1498 | var template (present) PDU_BSSGP exp_rx; |
| 1499 | exp_rx := f_send_paging_ps(p4, sgsn_idx, use_sig); |
| 1500 | /* Expect paging to propagate to no BSS */ |
| 1501 | timer T := 2.0; |
| 1502 | T.start; |
| 1503 | alt { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1504 | [] any from PCU_PTP.receive(exp_rx) { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1505 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1506 | } |
| 1507 | [] any from PCU_SIG.receive(exp_rx) { |
| 1508 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1509 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1510 | [] any from PCU_PTP.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1511 | setverdict(fail, "Different Paging received on PTP BVC"); |
| 1512 | } |
| 1513 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1514 | setverdict(fail, "Different Paging received on SIGNALING BVC"); |
| 1515 | } |
| 1516 | [] T.timeout { |
| 1517 | setverdict(pass); |
| 1518 | } |
| 1519 | } |
| 1520 | } |
| 1521 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1522 | private function f_TC_paging_ps_ptp_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1523 | { |
| 1524 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1525 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1526 | f_send_paging_ps_exp_one_bss(ts_BssgpP4BssArea, g_pars.sgsn_idx, false, 0); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1527 | } |
| 1528 | testcase TC_paging_ps_ptp_bss() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1529 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1530 | f_start_handlers(refers(f_TC_paging_ps_ptp_bss), testcasename(), 9); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1531 | f_cleanup(); |
| 1532 | } |
| 1533 | |
| 1534 | /* PS-PAGING on PTP-BVC for Location Area */ |
| 1535 | private function f_TC_paging_ps_ptp_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1536 | { |
| 1537 | var template (present) PDU_BSSGP exp_rx; |
| 1538 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1539 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1540 | f_send_paging_ps_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), g_pars.sgsn_idx, false, 0); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1541 | } |
| 1542 | testcase TC_paging_ps_ptp_lac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1543 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1544 | f_start_handlers(refers(f_TC_paging_ps_ptp_lac), testcasename(), 10); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1545 | f_cleanup(); |
| 1546 | } |
| 1547 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1548 | /* PS-PAGING on PTP-BVC for unknown Location Area */ |
| 1549 | private function f_TC_paging_ps_ptp_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1550 | { |
| 1551 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1552 | mcc_mnc := '567F99'H, |
| 1553 | lac := 33333 |
| 1554 | }; |
| 1555 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown LAC */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1556 | f_send_paging_ps_exp_one_bss(ts_BssgpP4LAC(unknown_la), g_pars.sgsn_idx, false, 0); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1557 | } |
| 1558 | testcase TC_paging_ps_ptp_lac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1559 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1560 | f_start_handlers(refers(f_TC_paging_ps_ptp_lac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1561 | f_cleanup(); |
| 1562 | } |
| 1563 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1564 | /* PS-PAGING on PTP-BVC for Routeing Area */ |
| 1565 | private function f_TC_paging_ps_ptp_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1566 | { |
| 1567 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1568 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1569 | f_send_paging_ps_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), g_pars.sgsn_idx, false, 0); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1570 | } |
| 1571 | testcase TC_paging_ps_ptp_rac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1572 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1573 | f_start_handlers(refers(f_TC_paging_ps_ptp_rac), testcasename(), 11); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1574 | f_cleanup(); |
| 1575 | } |
| 1576 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1577 | /* PS-PAGING on PTP-BVC for unknown Routeing Area */ |
| 1578 | private function f_TC_paging_ps_ptp_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1579 | { |
| 1580 | var RoutingAreaIdentification unknown_ra := { |
| 1581 | lai := { |
| 1582 | mcc_mnc := '567F99'H, |
| 1583 | lac := 33333 |
| 1584 | }, |
| 1585 | rac := 254 |
| 1586 | }; |
| 1587 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown RAC */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1588 | f_send_paging_ps_exp_one_bss(ts_BssgpP4RAC(unknown_ra), g_pars.sgsn_idx, false, 0); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1589 | } |
| 1590 | testcase TC_paging_ps_ptp_rac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1591 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1592 | f_start_handlers(refers(f_TC_paging_ps_ptp_rac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1593 | f_cleanup(); |
| 1594 | } |
| 1595 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1596 | /* PS-PAGING on PTP-BVC for BVCI (one cell) */ |
| 1597 | private function f_TC_paging_ps_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1598 | { |
| 1599 | /* this should be the normal case for MS in READY MM state after a lower layer failure */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1600 | f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), g_pars.sgsn_idx, false, 0); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1601 | } |
| 1602 | testcase TC_paging_ps_ptp_bvci() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1603 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1604 | f_start_handlers(refers(f_TC_paging_ps_ptp_bvci), testcasename(), 12); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1605 | f_cleanup(); |
| 1606 | } |
| 1607 | |
Harald Welte | b5a04aa | 2021-01-16 13:04:40 +0100 | [diff] [blame] | 1608 | |
| 1609 | /* PS-PAGING on PTP-BVC for BVCI (one cell) using IMSI only (no P-TMSI allocated) */ |
| 1610 | testcase TC_paging_ps_ptp_bvci_imsi() runs on test_CT { |
| 1611 | f_init(); |
| 1612 | f_start_handlers(refers(f_TC_paging_ps_ptp_bvci), testcasename(), 12, have_ptmsi:=false); |
| 1613 | f_cleanup(); |
| 1614 | } |
| 1615 | |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 1616 | /* Rejected PS-PAGING on PTP-BVC for BVCI (one cell) */ |
| 1617 | testcase TC_paging_ps_reject_ptp_bvci() runs on test_CT { |
| 1618 | f_init(); |
| 1619 | f_start_handlers(refers(f_TC_paging_ps_reject_ptp_bvci), testcasename(), 16); |
| 1620 | f_cleanup(); |
| 1621 | } |
| 1622 | |
| 1623 | /* Rejected PS-PAGING on PTP-BVC for BVCI (one cell) using IMSI only (no P-TMSI allocated) */ |
| 1624 | private function f_TC_paging_ps_reject_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1625 | { |
| 1626 | /* first send the PS-PAGING from SGSN -> PCU */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1627 | f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), g_pars.sgsn_idx, false, 0); |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 1628 | /* then simulate the PS-PAGING-REJECT from the PCU */ |
| 1629 | f_send_paging_ps_rej(use_sig:=false); |
| 1630 | } |
| 1631 | testcase TC_paging_ps_reject_ptp_bvci_imsi() runs on test_CT { |
| 1632 | f_init(); |
| 1633 | f_start_handlers(refers(f_TC_paging_ps_reject_ptp_bvci), testcasename(), 16, have_ptmsi:=false); |
| 1634 | f_cleanup(); |
| 1635 | } |
Harald Welte | b5a04aa | 2021-01-16 13:04:40 +0100 | [diff] [blame] | 1636 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1637 | /* PS-PAGING on PTP-BVC for unknown BVCI */ |
| 1638 | private function f_TC_paging_ps_ptp_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1639 | { |
| 1640 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown BVCI */ |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1641 | f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(33333), g_pars.sgsn_idx, false, 0); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1642 | } |
| 1643 | testcase TC_paging_ps_ptp_bvci_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1644 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1645 | f_start_handlers(refers(f_TC_paging_ps_ptp_bvci_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1646 | f_cleanup(); |
| 1647 | } |
| 1648 | |
Harald Welte | 7595d56 | 2021-01-16 19:09:20 +0100 | [diff] [blame] | 1649 | /* DUMMY PAGING PS on PTP BVC */ |
| 1650 | private function f_TC_dummy_paging_ps_ptp(charstring id) runs on BSSGP_ConnHdlr |
| 1651 | { |
| 1652 | f_sgsn2pcu(ts_BSSGP_DUMMY_PAGING_PS(g_pars.imsi, omit), |
| 1653 | tr_BSSGP_DUMMY_PAGING_PS(g_pars.imsi, omit), use_sig := false); |
| 1654 | f_pcu2sgsn(ts_BSSGP_DUMMY_PAGING_PS_RESP(g_pars.imsi, 1, 5), |
| 1655 | tr_BSSGP_DUMMY_PAGING_PS_RESP(g_pars.imsi, 1, 5), use_sig := false) |
| 1656 | } |
| 1657 | testcase TC_dummy_paging_ps_ptp() runs on test_CT { |
| 1658 | f_init(); |
| 1659 | f_start_handlers(refers(f_TC_dummy_paging_ps_ptp), testcasename(), 11); |
| 1660 | f_cleanup(); |
| 1661 | } |
| 1662 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1663 | /* altstep for expecting BSSGP PDU on signaling BVC of given pcu_idx + storing in 'roi' */ |
| 1664 | private altstep as_paging_sig_pcu(integer pcu_idx, template (present) PDU_BSSGP exp_rx, inout ro_integer roi) |
| 1665 | runs on BSSGP_ConnHdlr { |
| 1666 | [] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1667 | if (ro_integer_contains(roi, pcu_idx)) { |
| 1668 | setverdict(fail, "Received multiple paging on same SIG BVC"); |
| 1669 | } |
| 1670 | roi := roi & { pcu_idx }; |
| 1671 | repeat; |
| 1672 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1673 | [] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1674 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1675 | } |
| 1676 | [] PCU_SIG[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1677 | setverdict(fail, "Different Paging than expected received SIGNALING BVC"); |
| 1678 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1679 | [] PCU_PTP[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1680 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1681 | } |
| 1682 | } |
| 1683 | |
| 1684 | type record of default ro_default; |
| 1685 | |
| 1686 | /* send PS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */ |
| 1687 | private function f_send_paging_ps_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1688 | ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr |
| 1689 | { |
| 1690 | var template (present) PDU_BSSGP exp_rx; |
Daniel Willmann | 193e1a0 | 2021-01-17 12:55:53 +0100 | [diff] [blame] | 1691 | exp_rx := f_send_paging_ps(p4, sgsn_idx, true); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1692 | |
| 1693 | /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */ |
| 1694 | var ro_default defaults := {}; |
| 1695 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1696 | var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi)); |
| 1697 | defaults := defaults & { d }; |
| 1698 | } |
| 1699 | f_sleep(2.0); |
| 1700 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 1701 | deactivate(defaults[i]); |
| 1702 | } |
| 1703 | log("Paging received on PCU ", g_roi); |
| 1704 | |
| 1705 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1706 | var boolean rx_on_i := ro_integer_contains(g_roi, i); |
| 1707 | var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i); |
| 1708 | if (exp_on_i and not rx_on_i) { |
| 1709 | setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei); |
| 1710 | } |
| 1711 | if (not exp_on_i and rx_on_i) { |
| 1712 | setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei); |
| 1713 | } |
| 1714 | } |
| 1715 | setverdict(pass); |
| 1716 | } |
| 1717 | |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 1718 | /* Send PAGING-PS-REJECT on SIG BVC, expect it to arrive on the "right" SGSN */ |
| 1719 | private function f_send_paging_ps_rej(boolean use_sig := true, integer pcu_idx := 0) runs on BSSGP_ConnHdlr |
| 1720 | { |
| 1721 | var template (value) PDU_BSSGP pdu_tx; |
| 1722 | var template (present) PDU_BSSGP exp_rx; |
| 1723 | var PDU_BSSGP pdu_rx; |
| 1724 | timer T := 5.0; |
| 1725 | var template (omit) GsmTmsi tmsi_int := omit; |
| 1726 | |
| 1727 | if (ispresent(g_pars.p_tmsi)) { |
| 1728 | tmsi_int := oct2int(g_pars.p_tmsi); |
| 1729 | } |
| 1730 | |
| 1731 | pdu_tx := ts_BSSGP_PAGING_PS_REJ(g_pars.imsi, 23, 42, tmsi_int); |
| 1732 | exp_rx := tr_BSSGP_PAGING_PS_REJ(g_pars.imsi, 23, 42, tmsi_int); |
| 1733 | |
| 1734 | if (use_sig) { |
| 1735 | PCU_SIG[pcu_idx].send(pdu_tx); |
| 1736 | } else { |
| 1737 | PCU_PTP[pcu_idx].send(pdu_tx); |
| 1738 | } |
| 1739 | T.start; |
| 1740 | alt { |
| 1741 | [use_sig] SGSN_SIG[g_pars.sgsn_idx].receive(exp_rx) -> value pdu_rx { |
| 1742 | setverdict(pass); |
| 1743 | } |
| 1744 | [use_sig] SGSN_SIG[g_pars.sgsn_idx].receive { |
| 1745 | setverdict(fail, "Unexpected PDU on SGSN"); |
| 1746 | } |
| 1747 | [use_sig] any from SGSN_SIG.receive(exp_rx) -> value pdu_rx { |
| 1748 | setverdict(fail, "PAGING-PS-REJECT arrived on wrong SGSN"); |
| 1749 | } |
| 1750 | [not use_sig] SGSN_PTP[g_pars.sgsn_idx].receive(exp_rx) -> value pdu_rx { |
| 1751 | setverdict(pass); |
| 1752 | } |
| 1753 | [not use_sig] SGSN_PTP[g_pars.sgsn_idx].receive { |
| 1754 | setverdict(fail, "Unexpected PDU on SGSN"); |
| 1755 | } |
| 1756 | [not use_sig] any from SGSN_PTP.receive(exp_rx) -> value pdu_rx { |
| 1757 | setverdict(fail, "PAGING-PS-REJECT arrived on wrong SGSN"); |
| 1758 | } |
| 1759 | [] T.timeout { |
| 1760 | setverdict(fail, "Timeout waiting for PAGING-PS-REJECT"); |
| 1761 | } |
| 1762 | } |
| 1763 | } |
| 1764 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1765 | /* PS-PAGING on SIG-BVC for BSS Area */ |
| 1766 | private function f_TC_paging_ps_sig_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1767 | { |
| 1768 | /* we expect the paging to arrive on all three NSE */ |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1769 | f_send_paging_ps_exp_multi(ts_BssgpP4BssArea, g_pars.sgsn_idx, {0, 1, 2}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1770 | } |
| 1771 | testcase TC_paging_ps_sig_bss() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1772 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1773 | f_start_handlers(refers(f_TC_paging_ps_sig_bss), testcasename(), 13); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1774 | f_cleanup(); |
| 1775 | } |
| 1776 | |
| 1777 | /* PS-PAGING on SIG-BVC for Location Area */ |
| 1778 | private function f_TC_paging_ps_sig_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1779 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 1780 | /* The first LAC (13135) is shared by all three NSEs */ |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1781 | f_send_paging_ps_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), g_pars.sgsn_idx, {0, 1, 2}); |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 1782 | /* Reset state */ |
| 1783 | g_roi := {}; |
| 1784 | /* Make LAC (13300) available on pcu index 2 */ |
| 1785 | f_connect_to_pcu_bvc(port_idx := 2, nse_idx := 2, bvc_idx := 1); |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1786 | f_send_paging_ps_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[2].cell_id.ra_id.lai), g_pars.sgsn_idx, {2}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1787 | } |
| 1788 | testcase TC_paging_ps_sig_lac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1789 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1790 | f_start_handlers(refers(f_TC_paging_ps_sig_lac), testcasename(), 14); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1791 | f_cleanup(); |
| 1792 | } |
| 1793 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1794 | /* PS-PAGING on SIG-BVC for unknown Location Area */ |
| 1795 | private function f_TC_paging_ps_sig_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1796 | { |
| 1797 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1798 | mcc_mnc := '567F99'H, |
| 1799 | lac := 33333 |
| 1800 | }; |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1801 | f_send_paging_ps_exp_no_bss(ts_BssgpP4LAC(unknown_la), g_pars.sgsn_idx, true); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1802 | } |
| 1803 | testcase TC_paging_ps_sig_lac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1804 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1805 | f_start_handlers(refers(f_TC_paging_ps_sig_lac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1806 | f_cleanup(); |
| 1807 | } |
| 1808 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1809 | /* PS-PAGING on SIG-BVC for Routeing Area */ |
| 1810 | private function f_TC_paging_ps_sig_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1811 | { |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 1812 | /* Only PCU index 0 has a matching BVC with the RA ID */ |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1813 | f_send_paging_ps_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), g_pars.sgsn_idx, {0}); |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 1814 | g_roi := {}; |
| 1815 | /* PCU index 1 and 2 have a matching BVC with the RA ID */ |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1816 | f_send_paging_ps_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[2].cell_id.ra_id), g_pars.sgsn_idx, {1, 2}); |
Daniel Willmann | 2c9300f | 2020-12-01 10:54:08 +0100 | [diff] [blame] | 1817 | g_roi := {}; |
| 1818 | /* PCU index 2 has two matching BVCs with the RA ID */ |
| 1819 | f_connect_to_pcu_bvc(port_idx := 2, nse_idx := 2, bvc_idx := 1); |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1820 | f_send_paging_ps_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[2].cell_id.ra_id), g_pars.sgsn_idx, {2}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1821 | } |
| 1822 | testcase TC_paging_ps_sig_rac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1823 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1824 | f_start_handlers(refers(f_TC_paging_ps_sig_rac), testcasename(), 15); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1825 | f_cleanup(); |
| 1826 | } |
| 1827 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1828 | /* PS-PAGING on SIG-BVC for unknown Routeing Area */ |
| 1829 | private function f_TC_paging_ps_sig_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1830 | { |
| 1831 | var RoutingAreaIdentification unknown_ra := { |
| 1832 | lai := { |
| 1833 | mcc_mnc := '567F99'H, |
| 1834 | lac := 33333 |
| 1835 | }, |
| 1836 | rac := 254 |
| 1837 | }; |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1838 | f_send_paging_ps_exp_no_bss(ts_BssgpP4RAC(unknown_ra), g_pars.sgsn_idx, true); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1839 | } |
| 1840 | testcase TC_paging_ps_sig_rac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1841 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1842 | f_start_handlers(refers(f_TC_paging_ps_sig_rac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1843 | f_cleanup(); |
| 1844 | } |
| 1845 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1846 | /* PS-PAGING on SIG-BVC for BVCI (one cell) */ |
| 1847 | private function f_TC_paging_ps_sig_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1848 | { |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1849 | f_send_paging_ps_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), g_pars.sgsn_idx, {0}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1850 | } |
| 1851 | testcase TC_paging_ps_sig_bvci() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1852 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1853 | f_start_handlers(refers(f_TC_paging_ps_sig_bvci), testcasename(), 16); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1854 | f_cleanup(); |
| 1855 | } |
| 1856 | |
Harald Welte | b5a04aa | 2021-01-16 13:04:40 +0100 | [diff] [blame] | 1857 | /* PS-PAGING on SIG-BVC for BVCI (one cell) using IMSI only (no P-TMSI allocated) */ |
| 1858 | testcase TC_paging_ps_sig_bvci_imsi() runs on test_CT { |
| 1859 | f_init(); |
| 1860 | f_start_handlers(refers(f_TC_paging_ps_sig_bvci), testcasename(), 16, have_ptmsi:=false); |
| 1861 | f_cleanup(); |
| 1862 | } |
| 1863 | |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 1864 | /* Rejected PS-PAGING on SIG-BVC for BVCI (one cell) */ |
| 1865 | private function f_TC_paging_ps_reject_sig_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1866 | { |
| 1867 | /* first send the PS-PAGING from SGSN -> PCU */ |
Daniel Willmann | 4332044 | 2021-01-17 14:07:05 +0100 | [diff] [blame] | 1868 | f_send_paging_ps_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), g_pars.sgsn_idx, {0}); |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 1869 | /* then simulate the PS-PAGING-REJECT from the PCU */ |
| 1870 | f_send_paging_ps_rej(use_sig:=true); |
| 1871 | |
| 1872 | } |
| 1873 | testcase TC_paging_ps_reject_sig_bvci() runs on test_CT { |
| 1874 | f_init(); |
| 1875 | f_start_handlers(refers(f_TC_paging_ps_reject_sig_bvci), testcasename(), 16); |
| 1876 | f_cleanup(); |
| 1877 | } |
| 1878 | |
| 1879 | /* Rejected PS-PAGING on SIG-BVC for BVCI (one cell) using IMSI only (no P-TMSI allocated) */ |
| 1880 | testcase TC_paging_ps_reject_sig_bvci_imsi() runs on test_CT { |
| 1881 | f_init(); |
| 1882 | f_start_handlers(refers(f_TC_paging_ps_reject_sig_bvci), testcasename(), 16, have_ptmsi:=false); |
| 1883 | f_cleanup(); |
| 1884 | } |
| 1885 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1886 | /* PS-PAGING on SIG-BVC for unknown BVCI */ |
| 1887 | private function f_TC_paging_ps_sig_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1888 | { |
Daniel Willmann | 2a33067 | 2021-01-18 18:50:02 +0100 | [diff] [blame] | 1889 | f_send_paging_ps_exp_no_bss(ts_BssgpP4Bvci(33333), g_pars.sgsn_idx, true); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1890 | } |
| 1891 | testcase TC_paging_ps_sig_bvci_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1892 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 1893 | f_start_handlers(refers(f_TC_paging_ps_sig_bvci_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1894 | f_cleanup(); |
| 1895 | } |
| 1896 | |
Harald Welte | 7595d56 | 2021-01-16 19:09:20 +0100 | [diff] [blame] | 1897 | /* DUMMY PAGING PS on SIG BVC */ |
| 1898 | private function f_TC_dummy_paging_ps_sig(charstring id) runs on BSSGP_ConnHdlr |
| 1899 | { |
| 1900 | f_sgsn2pcu(ts_BSSGP_DUMMY_PAGING_PS(g_pars.imsi, omit), |
| 1901 | tr_BSSGP_DUMMY_PAGING_PS(g_pars.imsi, omit), use_sig := true); |
| 1902 | f_pcu2sgsn(ts_BSSGP_DUMMY_PAGING_PS_RESP(g_pars.imsi, 1, 5), |
| 1903 | tr_BSSGP_DUMMY_PAGING_PS_RESP(g_pars.imsi, 1, 5), use_sig := true) |
| 1904 | } |
| 1905 | testcase TC_dummy_paging_ps_sig() runs on test_CT { |
| 1906 | f_init(); |
| 1907 | f_start_handlers(refers(f_TC_dummy_paging_ps_sig), testcasename(), 11); |
| 1908 | f_cleanup(); |
| 1909 | } |
| 1910 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1911 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1912 | |
| 1913 | /*********************************************************************** |
| 1914 | * PAGING CS procedure |
| 1915 | ***********************************************************************/ |
| 1916 | |
| 1917 | private function f_send_paging_cs(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1918 | boolean use_sig := false) |
| 1919 | runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP { |
| 1920 | var template (value) PDU_BSSGP pdu_tx; |
| 1921 | var template (present) PDU_BSSGP pdu_rx; |
| 1922 | /* we always specify '0' as BVCI in the templates below, as we override it with |
| 1923 | * 'p4' later anyway */ |
| 1924 | pdu_rx := tr_BSSGP_CS_PAGING(0); |
| 1925 | pdu_rx.pDU_BSSGP_PAGING_CS.iMSI := tr_BSSGP_IMSI(g_pars.imsi); |
| 1926 | if (ispresent(g_pars.p_tmsi)) { |
| 1927 | pdu_tx := ts_BSSGP_CS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi)); |
| 1928 | pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi)); |
| 1929 | } else { |
| 1930 | pdu_tx := ts_BSSGP_CS_PAGING_IMSI(0, g_pars.imsi); |
| 1931 | pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := omit; |
| 1932 | } |
| 1933 | pdu_tx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4; |
| 1934 | pdu_rx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4; |
| 1935 | if (use_sig == false) { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1936 | SGSN_PTP[sgsn_idx].send(pdu_tx); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1937 | } else { |
| 1938 | SGSN_SIG[sgsn_idx].send(pdu_tx); |
| 1939 | } |
| 1940 | return pdu_rx; |
| 1941 | } |
| 1942 | |
| 1943 | /* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on |
| 1944 | * specified PCU index */ |
| 1945 | private function f_send_paging_cs_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1946 | boolean use_sig := false,integer pcu_idx := 0) |
| 1947 | runs on BSSGP_ConnHdlr { |
| 1948 | var template (present) PDU_BSSGP exp_rx; |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1949 | var boolean test_done := false; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1950 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1951 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1952 | exp_rx := f_send_paging_cs(p4, sgsn_idx, use_sig); |
| 1953 | /* Expect paging to propagate to the one BSS addressed by the BVCI only */ |
| 1954 | timer T := 2.0; |
| 1955 | T.start; |
| 1956 | alt { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1957 | [not use_sig and not test_done] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1958 | setverdict(pass); |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1959 | test_done := true; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1960 | repeat; |
| 1961 | } |
| 1962 | [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1963 | setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC"); |
| 1964 | } |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1965 | [use_sig and not test_done] PCU_SIG[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1966 | setverdict(pass); |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1967 | test_done := true; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1968 | repeat; |
| 1969 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1970 | [use_sig] PCU_PTP[pcu_idx].receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1971 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1972 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1973 | [] any from PCU_PTP.receive(exp_rx) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1974 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1975 | } |
| 1976 | [] any from PCU_SIG.receive(exp_rx) { |
| 1977 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1978 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 1979 | [] any from PCU_PTP.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1980 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1981 | } |
| 1982 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 1983 | setverdict(fail, "Different Paging than expected on SIGNALING BVC"); |
| 1984 | } |
Daniel Willmann | 1a85971 | 2020-12-04 00:59:45 +0100 | [diff] [blame] | 1985 | [not test_done] T.timeout { |
| 1986 | setverdict(fail, "Timeout while waiting for paging") |
| 1987 | } |
| 1988 | [test_done] T.timeout; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1989 | } |
| 1990 | } |
| 1991 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1992 | /* send a CS-PAGING but don't expect it to show up on any PTP or SIG BVC */ |
| 1993 | private function f_send_paging_cs_exp_no_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1994 | boolean use_sig := false) |
| 1995 | runs on BSSGP_ConnHdlr { |
| 1996 | var template (present) PDU_BSSGP exp_rx; |
| 1997 | exp_rx := f_send_paging_cs(p4, sgsn_idx, use_sig); |
| 1998 | /* Expect paging to propagate to no BSS */ |
| 1999 | timer T := 2.0; |
| 2000 | T.start; |
| 2001 | alt { |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 2002 | [] any from PCU_PTP.receive(exp_rx) { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2003 | setverdict(fail, "Paging received on unexpected BVC"); |
| 2004 | } |
| 2005 | [] any from PCU_SIG.receive(exp_rx) { |
| 2006 | setverdict(fail, "Paging received on unexpected BVC"); |
| 2007 | } |
Harald Welte | 158becf | 2020-12-09 12:32:32 +0100 | [diff] [blame] | 2008 | [] any from PCU_PTP.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2009 | setverdict(fail, "Different Paging received on PTP BVC"); |
| 2010 | } |
| 2011 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 2012 | setverdict(fail, "Different Paging received on SIGNALING BVC"); |
| 2013 | } |
| 2014 | [] T.timeout { |
| 2015 | setverdict(pass); |
| 2016 | } |
| 2017 | } |
| 2018 | } |
| 2019 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2020 | private function f_TC_paging_cs_ptp_bss(charstring id) runs on BSSGP_ConnHdlr |
| 2021 | { |
| 2022 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 2023 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 2024 | f_send_paging_cs_exp_one_bss(ts_BssgpP4BssArea, 0, false, 0); |
| 2025 | } |
| 2026 | testcase TC_paging_cs_ptp_bss() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2027 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2028 | f_start_handlers(refers(f_TC_paging_cs_ptp_bss), testcasename(), 17); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2029 | f_cleanup(); |
| 2030 | } |
| 2031 | |
| 2032 | /* CS-PAGING on PTP-BVC for Location Area */ |
| 2033 | private function f_TC_paging_cs_ptp_lac(charstring id) runs on BSSGP_ConnHdlr |
| 2034 | { |
| 2035 | var template (present) PDU_BSSGP exp_rx; |
| 2036 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 2037 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 2038 | f_send_paging_cs_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, false, 0); |
| 2039 | } |
| 2040 | testcase TC_paging_cs_ptp_lac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2041 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2042 | f_start_handlers(refers(f_TC_paging_cs_ptp_lac), testcasename(), 18); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2043 | f_cleanup(); |
| 2044 | } |
| 2045 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2046 | /* CS-PAGING on PTP-BVC for unknown Location Area */ |
| 2047 | private function f_TC_paging_cs_ptp_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2048 | { |
| 2049 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 2050 | mcc_mnc := '567F99'H, |
| 2051 | lac := 33333 |
| 2052 | }; |
| 2053 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown LAC */ |
| 2054 | f_send_paging_cs_exp_one_bss(ts_BssgpP4LAC(unknown_la), 0, false, 0); |
| 2055 | } |
| 2056 | testcase TC_paging_cs_ptp_lac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2057 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2058 | f_start_handlers(refers(f_TC_paging_cs_ptp_lac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2059 | f_cleanup(); |
| 2060 | } |
| 2061 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2062 | /* CS-PAGING on PTP-BVC for Routeing Area */ |
| 2063 | private function f_TC_paging_cs_ptp_rac(charstring id) runs on BSSGP_ConnHdlr |
| 2064 | { |
| 2065 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 2066 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 2067 | f_send_paging_cs_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, false, 0); |
| 2068 | } |
| 2069 | testcase TC_paging_cs_ptp_rac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2070 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2071 | f_start_handlers(refers(f_TC_paging_cs_ptp_rac), testcasename(), 19); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2072 | f_cleanup(); |
| 2073 | } |
| 2074 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2075 | /* CS-PAGING on PTP-BVC for unknown Routeing Area */ |
| 2076 | private function f_TC_paging_cs_ptp_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2077 | { |
| 2078 | var RoutingAreaIdentification unknown_ra := { |
| 2079 | lai := { |
| 2080 | mcc_mnc := '567F99'H, |
| 2081 | lac := 33333 |
| 2082 | }, |
| 2083 | rac := 254 |
| 2084 | }; |
| 2085 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown RAC */ |
| 2086 | f_send_paging_cs_exp_one_bss(ts_BssgpP4RAC(unknown_ra), 0, false, 0); |
| 2087 | } |
| 2088 | testcase TC_paging_cs_ptp_rac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2089 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2090 | f_start_handlers(refers(f_TC_paging_cs_ptp_rac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2091 | f_cleanup(); |
| 2092 | } |
| 2093 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2094 | /* CS-PAGING on PTP-BVC for BVCI (one cell) */ |
| 2095 | private function f_TC_paging_cs_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 2096 | { |
| 2097 | /* this should be the normal case for MS in READY MM state after a lower layer failure */ |
| 2098 | f_send_paging_cs_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, false, 0); |
| 2099 | } |
| 2100 | testcase TC_paging_cs_ptp_bvci() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2101 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2102 | f_start_handlers(refers(f_TC_paging_cs_ptp_bvci), testcasename(), 20); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2103 | f_cleanup(); |
| 2104 | } |
| 2105 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2106 | /* CS-PAGING on PTP-BVC for unknown BVCI */ |
| 2107 | private function f_TC_paging_cs_ptp_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2108 | { |
| 2109 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown BVCI */ |
| 2110 | f_send_paging_cs_exp_one_bss(ts_BssgpP4Bvci(33333), 0, false, 0); |
| 2111 | } |
| 2112 | testcase TC_paging_cs_ptp_bvci_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2113 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2114 | f_start_handlers(refers(f_TC_paging_cs_ptp_bvci_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2115 | f_cleanup(); |
| 2116 | } |
| 2117 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2118 | /* send CS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */ |
| 2119 | private function f_send_paging_cs_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 2120 | ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr |
| 2121 | { |
| 2122 | var template (present) PDU_BSSGP exp_rx; |
| 2123 | exp_rx := f_send_paging_cs(p4, 0, true); |
| 2124 | |
| 2125 | /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */ |
| 2126 | var ro_default defaults := {}; |
| 2127 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 2128 | var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi)); |
| 2129 | defaults := defaults & { d }; |
| 2130 | } |
| 2131 | f_sleep(2.0); |
| 2132 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2133 | deactivate(defaults[i]); |
| 2134 | } |
| 2135 | log("Paging received on PCU ", g_roi); |
| 2136 | |
| 2137 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 2138 | var boolean rx_on_i := ro_integer_contains(g_roi, i); |
| 2139 | var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i); |
| 2140 | if (exp_on_i and not rx_on_i) { |
| 2141 | setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei); |
| 2142 | } |
| 2143 | if (not exp_on_i and rx_on_i) { |
| 2144 | setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei); |
| 2145 | } |
| 2146 | } |
| 2147 | setverdict(pass); |
| 2148 | } |
| 2149 | |
| 2150 | /* CS-PAGING on SIG-BVC for BSS Area */ |
| 2151 | private function f_TC_paging_cs_sig_bss(charstring id) runs on BSSGP_ConnHdlr |
| 2152 | { |
| 2153 | /* we expect the paging to arrive on all three NSE */ |
| 2154 | f_send_paging_cs_exp_multi(ts_BssgpP4BssArea, 0, {0, 1, 2}); |
| 2155 | } |
| 2156 | testcase TC_paging_cs_sig_bss() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2157 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2158 | f_start_handlers(refers(f_TC_paging_cs_sig_bss), testcasename(), 13); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2159 | f_cleanup(); |
| 2160 | } |
| 2161 | |
| 2162 | /* CS-PAGING on SIG-BVC for Location Area */ |
| 2163 | private function f_TC_paging_cs_sig_lac(charstring id) runs on BSSGP_ConnHdlr |
| 2164 | { |
Daniel Willmann | d4fb73c | 2020-12-07 13:57:17 +0100 | [diff] [blame] | 2165 | /* The first LAC (13135) is shared by all three NSEs */ |
| 2166 | f_send_paging_cs_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, {0, 1, 2}); |
| 2167 | /* Reset state */ |
| 2168 | g_roi := {}; |
| 2169 | /* Make LAC (13300) available on pcu index 2 */ |
| 2170 | f_connect_to_pcu_bvc(port_idx := 2, nse_idx := 2, bvc_idx := 1); |
| 2171 | f_send_paging_cs_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[2].cell_id.ra_id.lai), 0, {2}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2172 | } |
| 2173 | testcase TC_paging_cs_sig_lac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2174 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2175 | f_start_handlers(refers(f_TC_paging_cs_sig_lac), testcasename(), 14); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2176 | f_cleanup(); |
| 2177 | } |
| 2178 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2179 | /* CS-PAGING on SIG-BVC for unknown Location Area */ |
| 2180 | private function f_TC_paging_cs_sig_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2181 | { |
| 2182 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 2183 | mcc_mnc := '567F99'H, |
| 2184 | lac := 33333 |
| 2185 | }; |
| 2186 | f_send_paging_cs_exp_no_bss(ts_BssgpP4LAC(unknown_la), 0, true); |
| 2187 | } |
| 2188 | testcase TC_paging_cs_sig_lac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2189 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2190 | f_start_handlers(refers(f_TC_paging_cs_sig_lac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2191 | f_cleanup(); |
| 2192 | } |
| 2193 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2194 | /* CS-PAGING on SIG-BVC for Routeing Area */ |
| 2195 | private function f_TC_paging_cs_sig_rac(charstring id) runs on BSSGP_ConnHdlr |
| 2196 | { |
Daniel Willmann | d4fb73c | 2020-12-07 13:57:17 +0100 | [diff] [blame] | 2197 | /* Only PCU index 0 has a matching BVC with the RA ID */ |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2198 | f_send_paging_cs_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, {0}); |
Daniel Willmann | d4fb73c | 2020-12-07 13:57:17 +0100 | [diff] [blame] | 2199 | g_roi := {}; |
| 2200 | /* PCU index 1 and 2 have a matching BVC with the RA ID */ |
| 2201 | f_send_paging_cs_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[2].cell_id.ra_id), 0, {1, 2}); |
| 2202 | g_roi := {}; |
| 2203 | /* PCU index 2 has two matching BVCs with the RA ID */ |
| 2204 | f_connect_to_pcu_bvc(port_idx := 2, nse_idx := 2, bvc_idx := 1); |
| 2205 | f_send_paging_cs_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[2].cell_id.ra_id), 0, {2}); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2206 | } |
| 2207 | testcase TC_paging_cs_sig_rac() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2208 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2209 | f_start_handlers(refers(f_TC_paging_cs_sig_rac), testcasename(), 15); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2210 | f_cleanup(); |
| 2211 | } |
| 2212 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2213 | /* CS-PAGING on SIG-BVC for unknown Routeing Area */ |
| 2214 | private function f_TC_paging_cs_sig_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2215 | { |
| 2216 | var RoutingAreaIdentification unknown_ra := { |
| 2217 | lai := { |
| 2218 | mcc_mnc := '567F99'H, |
| 2219 | lac := 33333 |
| 2220 | }, |
| 2221 | rac := 254 |
| 2222 | }; |
| 2223 | f_send_paging_cs_exp_no_bss(ts_BssgpP4RAC(unknown_ra), 0, true); |
| 2224 | } |
| 2225 | testcase TC_paging_cs_sig_rac_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2226 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2227 | f_start_handlers(refers(f_TC_paging_cs_sig_rac_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2228 | f_cleanup(); |
| 2229 | } |
| 2230 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2231 | /* CS-PAGING on SIG-BVC for BVCI (one cell) */ |
| 2232 | private function f_TC_paging_cs_sig_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 2233 | { |
| 2234 | f_send_paging_cs_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, {0}); |
| 2235 | } |
| 2236 | testcase TC_paging_cs_sig_bvci() runs on test_CT { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2237 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2238 | f_start_handlers(refers(f_TC_paging_cs_sig_bvci), testcasename(), 16); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2239 | f_cleanup(); |
| 2240 | } |
| 2241 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2242 | /* CS-PAGING on SIG-BVC for unknown BVCI */ |
| 2243 | private function f_TC_paging_cs_sig_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 2244 | { |
| 2245 | f_send_paging_cs_exp_no_bss(ts_BssgpP4Bvci(33333), 0, true); |
| 2246 | } |
| 2247 | testcase TC_paging_cs_sig_bvci_unknown() runs on test_CT { |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2248 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2249 | f_start_handlers(refers(f_TC_paging_cs_sig_bvci_unknown), testcasename(), 11); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2250 | f_cleanup(); |
| 2251 | } |
| 2252 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2253 | /*********************************************************************** |
| 2254 | * FLUSH-LL procedure |
| 2255 | ***********************************************************************/ |
| 2256 | |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 2257 | private function f_TC_flush_ll(charstring id) runs on BSSGP_ConnHdlr { |
| 2258 | var BssgpBvci bvci := g_pars.pcu[0].cfg.bvc[0].bvci; |
| 2259 | var integer i; |
| 2260 | for (i := 0; i < 10; i := i+1) { |
| 2261 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_FLUSH_LL(g_pars.tlli, bvci, bvci_new := bvci); |
| 2262 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 2263 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_FLUSH_LL(g_pars.tlli, bvci, bvci_new := bvci); |
| 2264 | |
| 2265 | f_sgsn2pcu(pdu_tx, pdu_rx, use_sig := true); |
| 2266 | |
| 2267 | pdu_tx := ts_BSSGP_FLUSH_LL_ACK(g_pars.tlli, int2oct(0, 1), 23, bvci_new := bvci); |
| 2268 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 2269 | pdu_rx := tr_BSSGP_FLUSH_LL_ACK(g_pars.tlli, int2oct(0, 1), 23, bvci_new := bvci); |
| 2270 | |
| 2271 | f_pcu2sgsn(pdu_tx, pdu_rx, use_sig := true); |
| 2272 | } |
| 2273 | setverdict(pass); |
| 2274 | } |
| 2275 | testcase TC_flush_ll() runs on test_CT |
| 2276 | { |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 2277 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2278 | f_start_handlers(refers(f_TC_flush_ll), testcasename(), 6); |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 2279 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 2280 | f_cleanup(); |
| 2281 | } |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 2282 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2283 | /*********************************************************************** |
| 2284 | * SGSN-INVOKE-TRACE procedure |
| 2285 | ***********************************************************************/ |
| 2286 | |
Harald Welte | f8e5c5d | 2020-11-27 22:37:23 +0100 | [diff] [blame] | 2287 | private altstep as_bssgp_g_pcu_count(integer pcu_idx, template (present) PDU_BSSGP exp_rx, inout ro_integer roi) |
| 2288 | runs on GlobalTest_CT { |
| 2289 | [] G_PCU[pcu_idx].receive(exp_rx) from g_pcu[pcu_idx].vc_BSSGP { |
| 2290 | if (ro_integer_contains(roi, pcu_idx)) { |
| 2291 | setverdict(fail, "Received multiple on same SIG BVC"); |
| 2292 | } |
| 2293 | roi := roi & { pcu_idx }; |
| 2294 | repeat; |
| 2295 | } |
| 2296 | } |
| 2297 | /* send a INVOKE-TRACE from SGSN and expect to receive a copy on each NSE */ |
| 2298 | testcase TC_trace() runs on GlobalTest_CT |
| 2299 | { |
| 2300 | var BSSGP_ConnHdlr vc_conn; |
| 2301 | f_init(); |
| 2302 | f_global_init(); |
| 2303 | |
| 2304 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_INVOKE_TRACE('23'O, '4321'O); |
| 2305 | var template (present) PDU_BSSGP exp_rx := ts_BSSGP_INVOKE_TRACE('23'O, '4321'O); |
| 2306 | |
| 2307 | var ro_default defaults := {}; |
| 2308 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2309 | activate(as_bssgp_g_pcu_count(i, exp_rx, g_roi)); |
| 2310 | } |
| 2311 | G_SGSN[0].send(pdu_tx); |
| 2312 | f_sleep(2.0); |
| 2313 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2314 | deactivate(defaults[i]); |
| 2315 | } |
| 2316 | |
| 2317 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2318 | if (not ro_integer_contains(g_roi, i)) { |
| 2319 | setverdict(fail, "Failed to receive TRACE on PCU index ", i); |
| 2320 | } |
| 2321 | } |
| 2322 | setverdict(pass); |
| 2323 | |
| 2324 | f_cleanup(); |
| 2325 | } |
| 2326 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2327 | /*********************************************************************** |
| 2328 | * LLC-DISCARDED procedure |
| 2329 | ***********************************************************************/ |
| 2330 | |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 2331 | private function f_TC_llc_discarded(charstring id) runs on BSSGP_ConnHdlr { |
| 2332 | var BssgpBvci bvci := g_pars.pcu[0].cfg.bvc[0].bvci; |
| 2333 | |
| 2334 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_LLC_DISCARDED(g_pars.tlli, 23, bvci, 2342); |
| 2335 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 2336 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_LLC_DISCARDED(g_pars.tlli, 23, bvci, 2342); |
| 2337 | |
| 2338 | f_pcu2sgsn(pdu_tx, pdu_rx, use_sig := true); |
| 2339 | |
| 2340 | setverdict(pass); |
| 2341 | } |
| 2342 | /* Send a LLC-DISCARDED from BSS side and expect it to show up on SGSN (SIG BVC) */ |
| 2343 | testcase TC_llc_discarded() runs on test_CT |
| 2344 | { |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 2345 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2346 | f_start_handlers(refers(f_TC_llc_discarded), testcasename(), 6); |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 2347 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 2348 | f_cleanup(); |
| 2349 | } |
| 2350 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2351 | /*********************************************************************** |
| 2352 | * OVERLOAD procedure |
| 2353 | ***********************************************************************/ |
| 2354 | |
Harald Welte | f20af41 | 2020-11-28 16:11:11 +0100 | [diff] [blame] | 2355 | /* Send an OVERLOAD from SGSN side and expect it to show up on each PCU (SIG BVC) */ |
| 2356 | testcase TC_overload() runs on GlobalTest_CT |
| 2357 | { |
| 2358 | f_init(); |
| 2359 | f_global_init(); |
| 2360 | |
| 2361 | var template (value) PDU_BSSGP pdu_tx := ts_OVERLOAD('1'B); |
| 2362 | var template (present) PDU_BSSGP exp_rx := tr_OVERLOAD('1'B); |
| 2363 | |
| 2364 | var ro_default defaults := {}; |
| 2365 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2366 | activate(as_bssgp_g_pcu_count(i, exp_rx, g_roi)); |
| 2367 | } |
| 2368 | G_SGSN[0].send(pdu_tx); |
| 2369 | f_sleep(2.0); |
| 2370 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2371 | deactivate(defaults[i]); |
| 2372 | } |
| 2373 | |
| 2374 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2375 | if (not ro_integer_contains(g_roi, i)) { |
| 2376 | setverdict(fail, "Failed to receive OVERLOAD on PCU index ", i); |
| 2377 | } |
| 2378 | } |
| 2379 | setverdict(pass); |
| 2380 | |
| 2381 | f_cleanup(); |
| 2382 | } |
| 2383 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2384 | /*********************************************************************** |
| 2385 | * BVC-BLOCK / BVC-UNBLOCK procedure |
| 2386 | ***********************************************************************/ |
| 2387 | |
Harald Welte | 239aa50 | 2020-11-24 23:14:20 +0100 | [diff] [blame] | 2388 | private function f_block_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2389 | { |
| 2390 | var BSSGP_BVC_CT bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2391 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2392 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 2393 | |
| 2394 | SGSN_MGMT.clear; |
| 2395 | PCU_MGMT.clear; |
| 2396 | |
| 2397 | /* block the PTP BVC from the PCU side */ |
| 2398 | PCU_MGMT.send(BssgpBlockRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to bvc_ct; |
| 2399 | /* expect state on both PCU and SGSN side to change */ |
| 2400 | interleave { |
| 2401 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) from bvc_ct; |
| 2402 | [] SGSN_MGMT.receive(tr_BssgpStsInd(*, bvc_cfg.bvci, BVC_S_BLOCKED)); |
| 2403 | } |
| 2404 | setverdict(pass); |
| 2405 | } |
| 2406 | testcase TC_bvc_block_ptp() runs on test_CT |
| 2407 | { |
| 2408 | f_init(); |
| 2409 | f_sleep(1.0); |
| 2410 | f_block_ptp_bvc_from_pcu(0, 0); |
| 2411 | f_cleanup(); |
| 2412 | } |
| 2413 | |
| 2414 | private function f_unblock_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2415 | { |
| 2416 | var BSSGP_BVC_CT bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2417 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2418 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 2419 | |
| 2420 | SGSN_MGMT.clear; |
| 2421 | PCU_MGMT.clear; |
| 2422 | |
| 2423 | /* block the PTP BVC from the PCU side */ |
| 2424 | PCU_MGMT.send(BssgpUnblockRequest:{}) to bvc_ct; |
| 2425 | /* expect state on both PCU and SGSN side to change */ |
| 2426 | interleave { |
| 2427 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_UNBLOCKED)) from bvc_ct; |
| 2428 | [] SGSN_MGMT.receive(tr_BssgpStsInd(*, bvc_cfg.bvci, BVC_S_UNBLOCKED)); |
| 2429 | } |
| 2430 | setverdict(pass); |
| 2431 | } |
| 2432 | testcase TC_bvc_unblock_ptp() runs on test_CT |
| 2433 | { |
| 2434 | f_init(); |
| 2435 | f_sleep(1.0); |
| 2436 | f_block_ptp_bvc_from_pcu(0, 0); |
| 2437 | f_sleep(1.0); |
| 2438 | f_unblock_ptp_bvc_from_pcu(0, 0); |
| 2439 | f_cleanup(); |
| 2440 | } |
| 2441 | |
Harald Welte | 4f91c3b | 2020-12-09 12:25:51 +0100 | [diff] [blame] | 2442 | /*********************************************************************** |
| 2443 | * BVC-RESET procedure |
| 2444 | ***********************************************************************/ |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2445 | private altstep as_count_bvc_reset(integer sgsn_idx, BssgpBvci bvci, inout roro_integer roroi) |
| 2446 | runs on test_CT { |
| 2447 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(sgsn_idx, bvci); |
| 2448 | [] SGSN_MGMT.receive(BssgpResetIndication:{bvci}) from sgsn_bvc_ct { |
| 2449 | roroi[sgsn_idx] := roroi[sgsn_idx] & { bvci }; |
| 2450 | repeat; |
| 2451 | } |
| 2452 | } |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2453 | private altstep as_ignore_status(BSSGP_BVC_MGMT_PT pt) { |
| 2454 | [] pt.receive(BssgpStatusIndication:?) { repeat; } |
| 2455 | } |
| 2456 | private function f_get_sgsn_bvc_ct(integer sgsn_idx, BssgpBvci bvci) runs on test_CT return BSSGP_BVC_CT { |
| 2457 | for (var integer i := 0; i < lengthof(g_sgsn[sgsn_idx].cfg.bvc); i := i+1) { |
| 2458 | if (g_sgsn[sgsn_idx].cfg.bvc[i].bvci == bvci) { |
| 2459 | return g_sgsn[sgsn_idx].vc_BSSGP_BVC[i]; |
| 2460 | } |
| 2461 | } |
| 2462 | return null; |
| 2463 | } |
| 2464 | private function f_reset_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2465 | { |
| 2466 | var BSSGP_BVC_CT pcu_bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2467 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2468 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2469 | var ro_default defaults; |
| 2470 | var integer i; |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2471 | |
| 2472 | SGSN_MGMT.clear; |
| 2473 | PCU_MGMT.clear; |
| 2474 | |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2475 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 2476 | g_roroi[i] := {}; |
| 2477 | } |
| 2478 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2479 | /* block the PTP BVC from the PCU side */ |
| 2480 | PCU_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to pcu_bvc_ct; |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2481 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2482 | /* expect state on both PCU and SGSN side to change */ |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2483 | defaults := { activate(as_ignore_status(SGSN_MGMT)) }; |
| 2484 | |
| 2485 | /* Activate altsteps: One for each SGSN */ |
| 2486 | for (i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 2487 | var default d := activate(as_count_bvc_reset(i, bvc_cfg.bvci, g_roroi)); |
| 2488 | defaults := defaults & { d }; |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2489 | } |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2490 | |
| 2491 | timer T := 3.0; |
| 2492 | T.start; |
| 2493 | alt { |
| 2494 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) from pcu_bvc_ct { |
| 2495 | g_roi := g_roi & { bvc_cfg.bvci }; |
| 2496 | repeat; |
| 2497 | } |
| 2498 | [] T.timeout; |
| 2499 | } |
| 2500 | |
| 2501 | for (i := 0; i < lengthof(defaults); i := i+1) { |
| 2502 | deactivate(defaults[i]); |
| 2503 | } |
| 2504 | |
| 2505 | /* Check if BVC-RESET was received at all SGSNs */ |
| 2506 | for (i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 2507 | if (not ro_integer_contains(g_roroi[i], bvc_cfg.bvci)) { |
| 2508 | setverdict(fail, "Missing SGSN[", i, "] BVC-BLOCK of BVCI=", bvc_cfg.bvci); |
| 2509 | } |
| 2510 | } |
| 2511 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2512 | setverdict(pass); |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2513 | f_cleanup(); |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2514 | } |
| 2515 | /* Send a BVC-RESET for a PTP BVC from the BSS side: expect it to propagate */ |
| 2516 | testcase TC_bvc_reset_ptp_from_bss() runs on test_CT |
| 2517 | { |
| 2518 | f_init(); |
| 2519 | f_sleep(3.0); |
| 2520 | f_reset_ptp_bvc_from_pcu(0, 0); |
| 2521 | f_cleanup(); |
| 2522 | } |
| 2523 | |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2524 | private altstep as_count_bvc_block(integer sgsn_idx, BssgpBvci bvci, inout roro_integer roroi) |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2525 | runs on test_CT { |
| 2526 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(sgsn_idx, bvci); |
| 2527 | [] SGSN_MGMT.receive(tr_BssgpStsInd(?, bvci, BVC_S_BLOCKED)) from sgsn_bvc_ct { |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2528 | roroi[sgsn_idx] := roroi[sgsn_idx] & { bvci }; |
Harald Welte | b2647f7 | 2020-12-07 14:36:35 +0100 | [diff] [blame] | 2529 | repeat; |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2530 | } |
| 2531 | } |
| 2532 | /* reset the signaling BVC from one BSS; expect no signaling BVC reset on SGSN; but BVC-BLOCK for PTP */ |
| 2533 | testcase TC_bvc_reset_sig_from_bss() runs on test_CT { |
| 2534 | |
| 2535 | f_init(); |
| 2536 | f_sleep(3.0); |
| 2537 | |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2538 | for (var integer i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
| 2539 | g_roroi[i] := {}; |
| 2540 | } |
| 2541 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2542 | /* Start BVC-RESET procedure for BVCI=0 */ |
| 2543 | PCU_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to g_pcu[0].vc_BSSGP; |
| 2544 | |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2545 | /* Activate altsteps: One for each PTP BVC and SGSN within that PCUs NSE */ |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2546 | var ro_default defaults := {}; |
| 2547 | for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { |
| 2548 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[i]; |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2549 | for (var integer j := 0; j < lengthof(g_sgsn); j := j+1) { |
| 2550 | var default d := activate(as_count_bvc_block(j, bvcc.bvci, g_roroi)); |
| 2551 | defaults := defaults & { d }; |
| 2552 | } |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2553 | } |
| 2554 | |
| 2555 | timer T := 3.0; |
| 2556 | T.start; |
| 2557 | alt { |
| 2558 | [] SGSN_MGMT.receive(BssgpResetIndication:{0}) { |
| 2559 | setverdict(fail, "BSS-side Reset of BVCI=0 should not propagate"); |
| 2560 | } |
| 2561 | [] T.timeout; |
| 2562 | } |
| 2563 | |
| 2564 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2565 | deactivate(defaults[i]); |
| 2566 | } |
| 2567 | |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2568 | /* check if BVC-block was received on all expected BVC/SGSN */ |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2569 | for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { |
| 2570 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[i]; |
Daniel Willmann | c38c85d | 2021-01-21 18:11:12 +0100 | [diff] [blame] | 2571 | for (var integer j := 0; j < lengthof(g_sgsn); j := j+1) { |
| 2572 | if (not ro_integer_contains(g_roroi[j], bvcc.bvci)) { |
| 2573 | setverdict(fail, "Missing SGSN[", j, "] BVC-BLOCK of BVCI=", bvcc.bvci); |
| 2574 | } |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2575 | } |
| 2576 | } |
| 2577 | |
| 2578 | /* check if BVC-block was not received on any unexpected BVC is not required as |
| 2579 | * such a message would basically run into 'no matching clause' */ |
Daniel Willmann | f259021 | 2020-12-04 14:20:50 +0100 | [diff] [blame] | 2580 | setverdict(pass); |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2581 | f_cleanup(); |
| 2582 | } |
| 2583 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2584 | private function f_reset_ptp_bvc_from_sgsn(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2585 | { |
| 2586 | var BSSGP_BVC_CT pcu_bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2587 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2588 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 2589 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(0, bvc_cfg.bvci); |
| 2590 | var default d; |
| 2591 | |
| 2592 | SGSN_MGMT.clear; |
| 2593 | PCU_MGMT.clear; |
| 2594 | |
| 2595 | /* block the PTP BVC from the PCU side */ |
| 2596 | SGSN_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to sgsn_bvc_ct; |
| 2597 | /* expect state on both PCU and SGSN side to change */ |
| 2598 | d := activate(as_ignore_status(PCU_MGMT)); |
| 2599 | interleave { |
| 2600 | [] SGSN_MGMT.receive(tr_BssgpStsInd(?, bvc_cfg.bvci, BVC_S_BLOCKED)) from sgsn_bvc_ct; |
| 2601 | [] PCU_MGMT.receive(BssgpResetIndication:{bvc_cfg.bvci}) from pcu_bvc_ct; |
| 2602 | } |
| 2603 | deactivate(d); |
| 2604 | setverdict(pass); |
| 2605 | } |
| 2606 | /* Send a BVC-RESET for a PTP BVC from the SGSN side: expect it to propagate */ |
| 2607 | testcase TC_bvc_reset_ptp_from_sgsn() runs on test_CT |
| 2608 | { |
| 2609 | f_init(); |
| 2610 | f_sleep(3.0); |
| 2611 | f_reset_ptp_bvc_from_sgsn(0, 0); |
| 2612 | f_cleanup(); |
| 2613 | } |
| 2614 | |
Daniel Willmann | ef7015f | 2021-01-08 00:43:56 +0100 | [diff] [blame] | 2615 | private altstep as_ignore_mgmt(BSSGP_BVC_MGMT_PT pt) { |
| 2616 | [] pt.receive {repeat; } |
| 2617 | } |
| 2618 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2619 | private altstep as_count_bvc0_block(integer pcu_idx, Nsei nsei, inout ro_integer roi) |
| 2620 | runs on test_CT { |
| 2621 | var BSSGP_CT pcu_ct := g_pcu[pcu_idx].vc_BSSGP; |
| 2622 | [] PCU_MGMT.receive(BssgpResetIndication:{0}) from pcu_ct { |
| 2623 | roi := roi & { nsei }; |
Daniel Willmann | ef7015f | 2021-01-08 00:43:56 +0100 | [diff] [blame] | 2624 | repeat; |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2625 | } |
| 2626 | } |
Daniel Willmann | ef7015f | 2021-01-08 00:43:56 +0100 | [diff] [blame] | 2627 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2628 | /* reset the signaling BVC from the SGSN; expect all signaling BVC on all BSS to be reset */ |
| 2629 | testcase TC_bvc_reset_sig_from_sgsn() runs on test_CT { |
| 2630 | |
| 2631 | f_init(); |
| 2632 | f_sleep(3.0); |
| 2633 | |
Daniel Willmann | ef7015f | 2021-01-08 00:43:56 +0100 | [diff] [blame] | 2634 | SGSN_MGMT.clear; |
| 2635 | PCU_MGMT.clear; |
| 2636 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2637 | /* Start BVC-RESET procedure for BVCI=0 */ |
| 2638 | SGSN_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to g_sgsn[0].vc_BSSGP; |
| 2639 | |
Daniel Willmann | ef7015f | 2021-01-08 00:43:56 +0100 | [diff] [blame] | 2640 | /* Defaults match in reverse activation order, this one is a catch-all for Status indications |
| 2641 | * and reset indications sent from other components (like the ptp_bvcs). If we don't drain |
| 2642 | * the port and a different message sits at the front we wait forever and fail the test. |
| 2643 | */ |
| 2644 | var ro_default defaults := { activate(as_ignore_mgmt(PCU_MGMT)) }; |
| 2645 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2646 | /* Activate altsteps: One for each PCU NSE */ |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2647 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2648 | var NSConfiguration nscfg := mp_nsconfig_pcu[i]; |
| 2649 | var default d := activate(as_count_bvc0_block(i, nscfg.nsei, g_roi)); |
| 2650 | defaults := defaults & { d }; |
| 2651 | } |
| 2652 | |
| 2653 | f_sleep(3.0); |
| 2654 | |
| 2655 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2656 | deactivate(defaults[i]); |
| 2657 | } |
| 2658 | |
| 2659 | /* check if BVC-block was received on all expected BVC */ |
| 2660 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2661 | var NSConfiguration nscfg := mp_nsconfig_pcu[i]; |
| 2662 | if (not ro_integer_contains(g_roi, nscfg.nsei)) { |
| 2663 | setverdict(fail, "Missing PCU-side BVC-RESET of BVCI=0 on PCU index ", i); |
| 2664 | } |
| 2665 | } |
| 2666 | |
| 2667 | /* check if BVC-block was not received on any unexpected BVC is not required as |
| 2668 | * such a message would basically run into 'no matching clause' */ |
| 2669 | |
| 2670 | f_cleanup(); |
| 2671 | } |
| 2672 | |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 2673 | /*********************************************************************** |
| 2674 | * FLOW-CONTROL-BVC procedure |
| 2675 | ***********************************************************************/ |
| 2676 | |
| 2677 | private altstep as_g_count_sgsn(integer sgsn_idx, inout ro_integer roi, |
| 2678 | template PDU_BSSGP exp_rx, template (omit) PDU_BSSGP tx_reply) |
| 2679 | runs on GlobalTest_CT { |
| 2680 | [] G_SGSN[sgsn_idx].receive(exp_rx) { |
| 2681 | roi := roi & { sgsn_idx }; |
| 2682 | if (ispresent(tx_reply)) { |
| 2683 | G_SGSN[sgsn_idx].send(tx_reply); |
| 2684 | } |
Harald Welte | 5fb0174 | 2021-01-15 21:07:52 +0100 | [diff] [blame] | 2685 | repeat; |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 2686 | } |
| 2687 | } |
| 2688 | /* Send FC-BVC from simulated PCU; expect each SGSN to receive it; expect PCU to receive ACK */ |
| 2689 | testcase TC_fc_bvc() runs on GlobalTest_CT |
| 2690 | { |
| 2691 | f_init(); |
| 2692 | f_global_init_ptp(); |
| 2693 | |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 2694 | var template (value) PDU_BSSGP pdu_tx := ts_BVC_FC_BVC(10240, 2000, 1024, 1000, '01'O); |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 2695 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 2696 | var template (present) PDU_BSSGP pdu_rx := tr_BVC_FC_BVC(10240, 2000, 1024, 1000, '01'O); |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 2697 | var template (value) PDU_BSSGP ack_tx := |
| 2698 | ts_BVC_FC_BVC_ACK(pdu_tx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value); |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 2699 | |
| 2700 | /* Send a FC-BVC from BSS to gbproxy, expect an ACK in response */ |
| 2701 | G_PCU[0].send(pdu_tx); |
| 2702 | |
| 2703 | /* Activate altsteps: One for each SGSN-side PTP BVC port */ |
| 2704 | var ro_default defaults := {}; |
| 2705 | for (var integer i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 2706 | var default d := activate(as_g_count_sgsn(i, g_roi, pdu_rx, ack_tx)); |
| 2707 | defaults := defaults & { d }; |
| 2708 | } |
| 2709 | |
| 2710 | f_sleep(3.0); |
| 2711 | |
| 2712 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2713 | deactivate(defaults[i]); |
| 2714 | } |
| 2715 | |
| 2716 | /* check if BVC-block was received on all expected BVC */ |
| 2717 | for (var integer i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 2718 | if (not ro_integer_contains(g_roi, i)) { |
| 2719 | setverdict(fail, "Missing BVC-FLOW-CONTROL on SGSN index ", i); |
| 2720 | } |
| 2721 | } |
| 2722 | |
| 2723 | /* Expect ACK on PCU side */ |
| 2724 | G_PCU[0].receive(ack_tx); |
| 2725 | |
| 2726 | setverdict(pass); |
| 2727 | |
| 2728 | f_cleanup(); |
| 2729 | } |
| 2730 | |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 2731 | /*********************************************************************** |
| 2732 | * FLOW-CONTROL-MS procedure |
| 2733 | ***********************************************************************/ |
| 2734 | |
| 2735 | private function f_TC_fc_ms(charstring id) runs on BSSGP_ConnHdlr { |
| 2736 | var BssgpBvci bvci := g_pars.pcu[0].cfg.bvc[0].bvci; |
| 2737 | |
| 2738 | var template (value) PDU_BSSGP fc_tx := ts_BVC_FC_MS(g_pars.tlli, 100, 200, '12'O); |
| 2739 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 2740 | var template (present) PDU_BSSGP fc_rx := tr_BVC_FC_MS(g_pars.tlli, 100, 200, '12'O); |
| 2741 | var template (value) PDU_BSSGP ack_tx := ts_BVC_FC_MS_ACK(g_pars.tlli, '12'O); |
| 2742 | |
| 2743 | f_pcu2sgsn(fc_tx, fc_rx, use_sig := false); |
| 2744 | f_sgsn2pcu(ack_tx, ack_tx, use_sig := false); |
| 2745 | |
| 2746 | setverdict(pass); |
| 2747 | } |
| 2748 | /* Send a FLOW-CONTROL-MS from BSS side and expect it to show up on SGSN (PTP BVC) */ |
| 2749 | testcase TC_fc_ms() runs on test_CT |
| 2750 | { |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 2751 | f_init(); |
Harald Welte | 2ecbca8 | 2021-01-16 11:23:09 +0100 | [diff] [blame] | 2752 | f_start_handlers(refers(f_TC_fc_ms), testcasename(), 21); |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 2753 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 2754 | f_cleanup(); |
| 2755 | } |
| 2756 | |
Harald Welte | d6f8981 | 2021-01-16 18:57:49 +0100 | [diff] [blame] | 2757 | /*********************************************************************** |
| 2758 | * MS-REGISTRATION ENQUIRY procedure |
| 2759 | ***********************************************************************/ |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 2760 | |
Harald Welte | d6f8981 | 2021-01-16 18:57:49 +0100 | [diff] [blame] | 2761 | private function f_TC_ms_reg_enq(charstring id) runs on BSSGP_ConnHdlr |
| 2762 | { |
| 2763 | f_pcu2sgsn(ts_BSSGP_MS_REG_ENQ(g_pars.imsi), tr_BSSGP_MS_REG_ENQ(g_pars.imsi), use_sig := true); |
| 2764 | f_sgsn2pcu(ts_BSSGP_MS_REW_ENQ_RESP(g_pars.imsi, omit), tr_BSSGP_MS_REW_ENQ_RESP(g_pars.imsi, omit), use_sig := true); |
| 2765 | } |
| 2766 | testcase TC_ms_reg_enq() runs on test_CT |
| 2767 | { |
| 2768 | f_init(); |
| 2769 | f_start_handlers(refers(f_TC_ms_reg_enq), testcasename(), 22); |
| 2770 | f_cleanup(); |
| 2771 | } |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 2772 | |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2773 | /*********************************************************************** |
| 2774 | * RIM (RAN Information Management) |
| 2775 | ***********************************************************************/ |
| 2776 | |
| 2777 | /* Our tests here are rather synthetic, as they don't reflect normal message flows |
| 2778 | as they would be observed in a live network. However, for testing gbproxy, this shouldn't |
| 2779 | matter as gbproxy is not concerned with anything but the source / destination routing |
| 2780 | information */ |
| 2781 | |
| 2782 | /* gbproxy must route all unknown RIM Routing Info (Cell Id) to the SGSN. We just define |
| 2783 | one here of which we know it is not used among the [simulated] PCUs */ |
| 2784 | const BssgpCellId cell_id_sgsn := { |
| 2785 | ra_id := { |
| 2786 | lai := { |
| 2787 | mcc_mnc := c_mcc_mnc, |
| 2788 | lac := 65534 |
| 2789 | }, |
| 2790 | rac := 0 |
| 2791 | }, |
| 2792 | cell_id := 65533 |
| 2793 | }; |
| 2794 | |
| 2795 | /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on any of our SGSN (RIM can be routed anywhere) */ |
| 2796 | friend function f_rim_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 2797 | integer pcu_idx := 0) runs on GlobalTest_CT { |
| 2798 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 2799 | timer T := 2.0; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2800 | |
| 2801 | RIM_PCU[pcu_idx].send(tx); |
| 2802 | T.start; |
| 2803 | alt { |
| 2804 | [] any from RIM_SGSN.receive(exp_rx) { |
| 2805 | setverdict(pass); |
| 2806 | } |
| 2807 | [] any from RIM_SGSN.receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2808 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on SGSN side: ", rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2809 | } |
| 2810 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2811 | f_shutdown(__FILE__, __LINE__, fail, |
| 2812 | log2str("Timeout waiting for BSSGP on SGSN side: ", exp_rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2813 | } |
| 2814 | } |
| 2815 | } |
| 2816 | |
| 2817 | /* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ |
| 2818 | friend function f_rim_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 2819 | integer sgsn_idx := 0, integer pcu_idx := 0) runs on GlobalTest_CT { |
| 2820 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 2821 | timer T := 2.0; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2822 | |
| 2823 | RIM_SGSN[sgsn_idx].send(tx); |
| 2824 | T.start; |
| 2825 | alt { |
| 2826 | [] RIM_PCU[pcu_idx].receive(exp_rx) { |
| 2827 | setverdict(pass); |
| 2828 | } |
| 2829 | [] RIM_PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2830 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on PCU side: ", rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2831 | } |
| 2832 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2833 | f_shutdown(__FILE__, __LINE__, fail, |
| 2834 | log2str("Timeout waiting for BSSGP on PCU side: ", exp_rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2835 | } |
| 2836 | } |
| 2837 | } |
| 2838 | |
| 2839 | /* Send 'tx' on PTP-BVCI from SRC-PCU; expect 'rx' on DST-PCU */ |
| 2840 | friend function f_rim_pcu2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 2841 | integer src_pcu_idx, integer dst_pcu_idx) runs on GlobalTest_CT { |
| 2842 | var integer rx_idx; |
| 2843 | var PDU_BSSGP rx; |
Harald Welte | 14d23ef | 2021-01-26 15:43:41 +0100 | [diff] [blame] | 2844 | timer T := 2.0; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2845 | |
| 2846 | RIM_PCU[src_pcu_idx].send(tx); |
| 2847 | T.start; |
| 2848 | alt { |
| 2849 | [] RIM_PCU[dst_pcu_idx].receive(exp_rx) -> value rx{ |
| 2850 | setverdict(pass); |
| 2851 | } |
| 2852 | [] any from RIM_PCU.receive(exp_rx) -> @index value rx_idx { |
| 2853 | setverdict(fail, "Received RIM on wrong PCU[", rx_idx ,"], expected on PCU[", dst_pcu_idx, "]"); |
| 2854 | } |
| 2855 | [] any from RIM_SGSN.receive(exp_rx) { |
| 2856 | setverdict(fail, "Received RIM on SGSN but expected it on other PCU"); |
| 2857 | } |
| 2858 | [] any from RIM_SGSN.receive(PDU_BSSGP:?) -> value rx { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2859 | f_shutdown(__FILE__, __LINE__, fail, log2str("Unexpected BSSGP on SGSN side: ", rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2860 | } |
| 2861 | [] T.timeout { |
Harald Welte | d5b7e74 | 2021-01-27 10:50:24 +0100 | [diff] [blame] | 2862 | f_shutdown(__FILE__, __LINE__, fail, |
| 2863 | log2str("Timeout waiting for BSSGP on SGSN side: ", exp_rx)); |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2864 | } |
| 2865 | } |
| 2866 | } |
| 2867 | |
| 2868 | |
| 2869 | type function rim_fn(integer sgsn_idx, integer pcu_idx, integer bvc_idx) runs on GlobalTest_CT; |
| 2870 | |
| 2871 | /* helper function for the RIM test cases: Execute 'fn' for each BVC on each PCU for |
| 2872 | each SGSN */ |
| 2873 | private function f_rim_iterator(rim_fn fn) runs on GlobalTest_CT |
| 2874 | { |
| 2875 | var integer sgsn_idx, pcu_idx, bvc_idx; |
| 2876 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx+1) { |
| 2877 | for (pcu_idx := 0; pcu_idx < lengthof(g_pcu); pcu_idx := pcu_idx+1) { |
| 2878 | for (bvc_idx := 0; bvc_idx < lengthof(g_pcu[pcu_idx].cfg.bvc); bvc_idx := bvc_idx+1) { |
| 2879 | log("Testing RIM SGSN[", sgsn_idx, "] <-> PCU[", pcu_idx, "][", bvc_idx, "]"); |
| 2880 | fn.apply(sgsn_idx, pcu_idx, bvc_idx); |
| 2881 | } |
| 2882 | } |
| 2883 | } |
| 2884 | } |
| 2885 | |
| 2886 | /* RAN-INFORMATION-REQUEST */ |
| 2887 | private function f_TC_rim_info_req(integer sgsn_idx, integer pcu_idx, integer bvc_idx := 0) |
| 2888 | runs on GlobalTest_CT |
| 2889 | { |
| 2890 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2891 | var template (value) RAN_Information_Request_RIM_Container cont_tx; |
| 2892 | var template RAN_Information_Request_RIM_Container cont_rx; |
| 2893 | var template RIM_Routing_Address ra_pcu; |
| 2894 | var template RIM_Routing_Address ra_sgsn; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2895 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2896 | ra_pcu := t_RIM_Routing_Address_cid(cell_id); |
| 2897 | ra_sgsn := t_RIM_Routing_Address_cid(cell_id_sgsn); |
| 2898 | |
| 2899 | cont_tx := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2900 | ts_RIM_Sequence_Number(0), |
| 2901 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 2902 | cont_rx := tr_RAN_Information_Request_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2903 | tr_RIM_Sequence_Number(0), |
| 2904 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 2905 | |
| 2906 | f_rim_pcu2sgsn(ts_RAN_INFORMATION_REQUEST(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2907 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2908 | cont := cont_tx), |
| 2909 | tr_RAN_INFORMATION_REQUEST(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2910 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2911 | cont := cont_rx), |
| 2912 | pcu_idx); |
| 2913 | |
| 2914 | f_rim_sgsn2pcu(ts_RAN_INFORMATION_REQUEST(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2915 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2916 | cont := cont_tx), |
| 2917 | tr_RAN_INFORMATION_REQUEST(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2918 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2919 | cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2920 | sgsn_idx, pcu_idx); |
| 2921 | } |
| 2922 | testcase TC_rim_info_req() runs on GlobalTest_CT |
| 2923 | { |
| 2924 | f_init(); |
| 2925 | f_global_init(); |
| 2926 | f_rim_iterator(refers(f_TC_rim_info_req)); |
| 2927 | f_cleanup(); |
| 2928 | } |
| 2929 | |
| 2930 | /* RAN-INFORMATION */ |
| 2931 | private function f_TC_rim_info(integer sgsn_idx, integer pcu_idx, integer bvc_idx := 0) |
| 2932 | runs on GlobalTest_CT |
| 2933 | { |
| 2934 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2935 | var template (value) RAN_Information_RIM_Container cont_tx; |
| 2936 | var template RAN_Information_RIM_Container cont_rx; |
| 2937 | var template RIM_Routing_Address ra_pcu; |
| 2938 | var template RIM_Routing_Address ra_sgsn; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2939 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2940 | ra_pcu := t_RIM_Routing_Address_cid(cell_id); |
| 2941 | ra_sgsn := t_RIM_Routing_Address_cid(cell_id_sgsn); |
| 2942 | |
| 2943 | cont_tx := ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2944 | ts_RIM_Sequence_Number(0), |
| 2945 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 2946 | |
| 2947 | cont_rx := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2948 | tr_RIM_Sequence_Number(0), |
| 2949 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 2950 | |
| 2951 | f_rim_pcu2sgsn(ts_PDU_BSSGP_RAN_INFORMATION(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2952 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2953 | cont := cont_tx), |
| 2954 | tr_PDU_BSSGP_RAN_INFORMATION(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2955 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2956 | cont := cont_rx), |
| 2957 | pcu_idx); |
| 2958 | |
| 2959 | f_rim_sgsn2pcu(ts_PDU_BSSGP_RAN_INFORMATION(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2960 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2961 | cont := cont_tx), |
| 2962 | tr_PDU_BSSGP_RAN_INFORMATION(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2963 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2964 | cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2965 | sgsn_idx, pcu_idx); |
| 2966 | } |
| 2967 | testcase TC_rim_info() runs on GlobalTest_CT |
| 2968 | { |
| 2969 | f_init(); |
| 2970 | f_global_init(); |
| 2971 | f_rim_iterator(refers(f_TC_rim_info)); |
| 2972 | f_cleanup(); |
| 2973 | } |
| 2974 | |
| 2975 | /* RAN-INFORMATION-ACK */ |
| 2976 | private function f_TC_rim_info_ack(integer sgsn_idx, integer pcu_idx, integer bvc_idx := 0) |
| 2977 | runs on GlobalTest_CT |
| 2978 | { |
| 2979 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2980 | var template (value) RAN_Information_Ack_RIM_Container cont_tx; |
| 2981 | var template RAN_Information_Ack_RIM_Container cont_rx; |
| 2982 | var template RIM_Routing_Address ra_pcu; |
| 2983 | var template RIM_Routing_Address ra_sgsn; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 2984 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 2985 | ra_pcu := t_RIM_Routing_Address_cid(cell_id); |
| 2986 | ra_sgsn := t_RIM_Routing_Address_cid(cell_id_sgsn); |
| 2987 | |
| 2988 | cont_tx := ts_RAN_Information_Ack_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2989 | ts_RIM_Sequence_Number(0)); |
| 2990 | |
| 2991 | cont_rx := tr_RAN_Information_Ack_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 2992 | tr_RIM_Sequence_Number(0)); |
| 2993 | |
| 2994 | f_rim_pcu2sgsn(ts_PDU_BSSGP_RAN_INFORMATION_ACK(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2995 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2996 | cont := cont_tx), |
| 2997 | tr_PDU_BSSGP_RAN_INFORMATION_ACK(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 2998 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 2999 | cont := cont_rx), |
| 3000 | pcu_idx); |
| 3001 | |
| 3002 | f_rim_sgsn2pcu(ts_PDU_BSSGP_RAN_INFORMATION_ACK(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3003 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3004 | cont := cont_tx), |
| 3005 | tr_PDU_BSSGP_RAN_INFORMATION_ACK(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3006 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3007 | cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3008 | sgsn_idx, pcu_idx); |
| 3009 | } |
| 3010 | testcase TC_rim_info_ack() runs on GlobalTest_CT |
| 3011 | { |
| 3012 | f_init(); |
| 3013 | f_global_init(); |
| 3014 | f_rim_iterator(refers(f_TC_rim_info_ack)); |
| 3015 | f_cleanup(); |
| 3016 | } |
| 3017 | |
| 3018 | /* RAN-INFORMATION-ERROR */ |
| 3019 | private function f_TC_rim_info_error(integer sgsn_idx, integer pcu_idx, integer bvc_idx := 0) |
| 3020 | runs on GlobalTest_CT |
| 3021 | { |
| 3022 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3023 | var template (value) RAN_Information_Error_RIM_Container cont_tx; |
| 3024 | var template RAN_Information_Error_RIM_Container cont_rx; |
| 3025 | var template RIM_Routing_Address ra_pcu; |
| 3026 | var template RIM_Routing_Address ra_sgsn; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3027 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3028 | ra_pcu := t_RIM_Routing_Address_cid(cell_id); |
| 3029 | ra_sgsn := t_RIM_Routing_Address_cid(cell_id_sgsn); |
| 3030 | |
| 3031 | cont_tx := ts_RAN_Information_Error_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3032 | ts_BSSGP_CAUSE(BSSGP_CAUSE_EQUIMENT_FAILURE), |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 3033 | omit, valueof(ts_BVC_UNBLOCK(23))); |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3034 | |
| 3035 | cont_rx := tr_RAN_Information_Error_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 3036 | ts_BSSGP_CAUSE(BSSGP_CAUSE_EQUIMENT_FAILURE), |
| 3037 | omit, enc_PDU_BSSGP(valueof(tr_BVC_UNBLOCK(23)))); |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3038 | |
| 3039 | f_rim_pcu2sgsn(ts_PDU_BSSGP_RAN_INFORMATION_ERROR(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3040 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3041 | cont := cont_tx), |
| 3042 | tr_PDU_BSSGP_RAN_INFORMATION_ERROR(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3043 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3044 | cont := cont_rx), |
| 3045 | pcu_idx); |
| 3046 | |
| 3047 | f_rim_sgsn2pcu(ts_PDU_BSSGP_RAN_INFORMATION_ERROR(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3048 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3049 | cont := cont_tx), |
| 3050 | tr_PDU_BSSGP_RAN_INFORMATION_ERROR(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3051 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3052 | cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3053 | sgsn_idx, pcu_idx); |
| 3054 | } |
| 3055 | testcase TC_rim_info_error() runs on GlobalTest_CT |
| 3056 | { |
| 3057 | f_init(); |
| 3058 | f_global_init(); |
| 3059 | f_rim_iterator(refers(f_TC_rim_info_error)); |
| 3060 | f_cleanup(); |
| 3061 | } |
| 3062 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3063 | ////////////////// |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3064 | /* RAN-INFORMATION-APPLICATION-ERROR */ |
| 3065 | private function f_TC_rim_info_app_error(integer sgsn_idx, integer pcu_idx, integer bvc_idx := 0) |
| 3066 | runs on GlobalTest_CT |
| 3067 | { |
| 3068 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3069 | var template (value) Application_Error_Container app_cont_tx; |
| 3070 | var template Application_Error_Container app_cont_rx; |
| 3071 | var template (value) RAN_Information_Application_Error_RIM_Container cont_tx; |
| 3072 | var template RAN_Information_Application_Error_RIM_Container cont_rx; |
| 3073 | var template RIM_Routing_Address ra_pcu; |
| 3074 | var template RIM_Routing_Address ra_sgsn; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3075 | |
Philipp Maier | 14d3a8e | 2021-01-28 21:43:16 +0100 | [diff] [blame] | 3076 | ra_pcu := t_RIM_Routing_Address_cid(cell_id); |
| 3077 | ra_sgsn := t_RIM_Routing_Address_cid(cell_id_sgsn); |
| 3078 | |
| 3079 | app_cont_tx := tsu_Application_Error_Container_NACC(cell_id, 23, |
| 3080 | tsu_Application_Container_IE_NACC_req(cell_id)); |
| 3081 | |
| 3082 | app_cont_rx := rsu_Application_Error_Container_NACC(cell_id, 23, |
| 3083 | rsu_Application_Container_IE_NACC_req(cell_id)); |
| 3084 | |
| 3085 | cont_tx := ts_RAN_Information_Application_Error_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3086 | ts_RIM_Sequence_Number(0), |
| 3087 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP), |
| 3088 | omit, app_cont_tx); |
| 3089 | cont_rx := tr_RAN_Information_Application_Error_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3090 | tr_RIM_Sequence_Number(0), |
| 3091 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP), |
| 3092 | omit, app_cont_rx); |
| 3093 | |
| 3094 | f_rim_pcu2sgsn(ts_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3095 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3096 | cont := cont_tx), |
| 3097 | tr_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3098 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3099 | cont := cont_rx), |
| 3100 | pcu_idx); |
| 3101 | |
| 3102 | f_rim_sgsn2pcu(ts_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(dst := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3103 | src := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3104 | cont := cont_tx), |
| 3105 | tr_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(dst := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_pcu), |
| 3106 | src := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, ra_sgsn), |
| 3107 | cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3108 | sgsn_idx, pcu_idx); |
| 3109 | } |
| 3110 | testcase TC_rim_info_app_error() runs on GlobalTest_CT |
| 3111 | { |
| 3112 | f_init(); |
| 3113 | f_global_init(); |
| 3114 | f_rim_iterator(refers(f_TC_rim_info_app_error)); |
| 3115 | f_cleanup(); |
| 3116 | } |
| 3117 | |
| 3118 | /* RAN-INFORMATION routing directly between PCUs, without SGSN involvement */ |
| 3119 | private function f_TC_rim_info_pcu2pcu(integer src_pcu_idx, integer src_bvc_idx, |
| 3120 | integer dst_pcu_idx, integer dst_bvc_idx) |
| 3121 | runs on GlobalTest_CT |
| 3122 | { |
| 3123 | var BssgpCellId cell_id_src := g_pcu[src_pcu_idx].cfg.bvc[src_bvc_idx].cell_id; |
| 3124 | var BssgpCellId cell_id_dst := g_pcu[dst_pcu_idx].cfg.bvc[dst_bvc_idx].cell_id; |
Philipp Maier | 1bd60ce | 2021-02-10 18:25:50 +0100 | [diff] [blame] | 3125 | var template (value) RIM_Routing_Information ri_pcu_src_tx; |
| 3126 | var template (value) RIM_Routing_Information ri_pcu_dst_tx; |
| 3127 | var template RIM_Routing_Information ri_pcu_src_rx; |
| 3128 | var template RIM_Routing_Information ri_pcu_dst_rx; |
| 3129 | var template (value) RAN_Information_RIM_Container cont_tx; |
| 3130 | var template RAN_Information_RIM_Container cont_rx; |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3131 | |
| 3132 | log("Testing RIM PCU2PCU from PCU[", src_pcu_idx, "][", src_bvc_idx, "] to PCU[", |
| 3133 | dst_pcu_idx, "][", dst_bvc_idx, "]"); |
| 3134 | |
Philipp Maier | 1bd60ce | 2021-02-10 18:25:50 +0100 | [diff] [blame] | 3135 | ri_pcu_src_tx := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3136 | t_RIM_Routing_Address_cid(cell_id_src)); |
Philipp Maier | 1bd60ce | 2021-02-10 18:25:50 +0100 | [diff] [blame] | 3137 | ri_pcu_dst_tx := ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3138 | t_RIM_Routing_Address_cid(cell_id_dst)); |
Philipp Maier | 1bd60ce | 2021-02-10 18:25:50 +0100 | [diff] [blame] | 3139 | ri_pcu_src_rx := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, |
| 3140 | t_RIM_Routing_Address_cid(cell_id_src)); |
| 3141 | ri_pcu_dst_rx := tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, |
| 3142 | t_RIM_Routing_Address_cid(cell_id_dst)); |
| 3143 | |
| 3144 | cont_tx := ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3145 | ts_RIM_Sequence_Number(0), |
| 3146 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 3147 | cont_rx := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3148 | tr_RIM_Sequence_Number(0), |
| 3149 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_STOP)); |
| 3150 | |
| 3151 | f_rim_pcu2pcu(ts_PDU_BSSGP_RAN_INFORMATION(dst := ri_pcu_dst_tx, src := ri_pcu_src_tx, cont := cont_tx), |
| 3152 | tr_PDU_BSSGP_RAN_INFORMATION(dst := ri_pcu_dst_rx, src := ri_pcu_src_rx, cont := cont_rx), |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3153 | src_pcu_idx, dst_pcu_idx); |
| 3154 | } |
| 3155 | testcase TC_rim_info_pcu2pcu() runs on GlobalTest_CT |
| 3156 | { |
| 3157 | var integer src_pcu_idx, dst_pcu_idx; |
| 3158 | var integer src_bvc_idx, dst_bvc_idx; |
| 3159 | f_init(); |
| 3160 | f_global_init(); |
| 3161 | |
| 3162 | for (src_pcu_idx := 0; src_pcu_idx < lengthof(g_pcu); src_pcu_idx := src_pcu_idx + 1) { |
| 3163 | for (src_bvc_idx := 0; src_bvc_idx < lengthof(g_pcu[src_pcu_idx].cfg.bvc); src_bvc_idx := src_bvc_idx + 1) { |
| 3164 | for (dst_pcu_idx := 0; dst_pcu_idx < lengthof(g_pcu); dst_pcu_idx := dst_pcu_idx + 1) { |
| 3165 | if (dst_pcu_idx == src_pcu_idx) { |
| 3166 | continue; |
| 3167 | } |
| 3168 | |
| 3169 | for (dst_bvc_idx := 0; dst_bvc_idx < lengthof(g_pcu[dst_pcu_idx].cfg.bvc); |
| 3170 | dst_bvc_idx := dst_bvc_idx + 1) { |
| 3171 | f_TC_rim_info_pcu2pcu(src_pcu_idx, src_bvc_idx, dst_pcu_idx, dst_bvc_idx); |
| 3172 | } |
| 3173 | } |
| 3174 | } |
| 3175 | } |
| 3176 | |
| 3177 | f_cleanup(); |
| 3178 | } |
| 3179 | |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 3180 | /*********************************************************************** |
| 3181 | * STATUS handling |
| 3182 | ***********************************************************************/ |
| 3183 | |
| 3184 | /* BSSGP STATUS PDU must be routed based on inner "PDU In Error" message */ |
| 3185 | |
| 3186 | /* generate a TMSI with NRI matching sgsn_idx + nri_idx */ |
| 3187 | private function f_gen_tmsi_for_sgsn_nri(integer sgsn_idx, integer nri_idx) runs on test_CT return OCT4 |
| 3188 | { |
| 3189 | var integer nri := mp_sgsn_nri[sgsn_idx][nri_idx]; |
| 3190 | return f_gen_tmsi(0, nri_v := nri, nri_bitlen := mp_nri_bitlength); |
| 3191 | } |
| 3192 | |
| 3193 | /* generate a TLLI with NRI matching sgsn_idx + nri_idx */ |
| 3194 | private function f_gen_tlli_for_sgsn_nri(integer sgsn_idx, integer nri_idx) runs on test_CT return OCT4 |
| 3195 | { |
| 3196 | var OCT4 p_tmsi := f_gen_tmsi_for_sgsn_nri(sgsn_idx, nri_idx); |
| 3197 | return f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL); |
| 3198 | } |
| 3199 | |
| 3200 | /* STATUS in uplink direction; expect routing by its NRI */ |
| 3201 | private function f_TC_status_ul(integer pcu_idx, integer sgsn_idx, PDU_BSSGP inner) |
| 3202 | runs on GlobalTest_CT |
| 3203 | { |
| 3204 | var template (value) PDU_BSSGP tx := ts_BSSGP_STATUS(omit, BSSGP_CAUSE_EQUIMENT_FAILURE, inner); |
| 3205 | var template (present) PDU_BSSGP exp_rx := |
| 3206 | tr_BSSGP_STATUS(omit, BSSGP_CAUSE_EQUIMENT_FAILURE, |
| 3207 | tx.pDU_BSSGP_STATUS.pDU_in_Error.erroneous_BSSGP_PDU); |
| 3208 | |
| 3209 | f_global_pcu2sgsn(tx, exp_rx, pcu_idx, sgsn_idx); |
| 3210 | } |
| 3211 | |
| 3212 | /* STATUS in uplink direction; expect routing by its NRI */ |
| 3213 | private function f_TC_status_dl(integer sgsn_idx, integer pcu_idx, PDU_BSSGP inner) |
| 3214 | runs on GlobalTest_CT |
| 3215 | { |
| 3216 | var template (value) PDU_BSSGP tx := ts_BSSGP_STATUS(omit, BSSGP_CAUSE_EQUIMENT_FAILURE, inner); |
| 3217 | var template (present) PDU_BSSGP exp_rx := |
| 3218 | tr_BSSGP_STATUS(omit, BSSGP_CAUSE_EQUIMENT_FAILURE, |
| 3219 | tx.pDU_BSSGP_STATUS.pDU_in_Error.erroneous_BSSGP_PDU); |
| 3220 | |
| 3221 | f_global_sgsn2pcu(tx, exp_rx, sgsn_idx, pcu_idx); |
| 3222 | } |
| 3223 | |
| 3224 | /* STATUS in uplink direction on SIG-BVC containing a TLLI; expect routing by its NRI */ |
| 3225 | testcase TC_status_sig_ul_tlli() runs on GlobalTest_CT |
| 3226 | { |
| 3227 | var integer sgsn_idx, nri_idx; |
| 3228 | |
| 3229 | f_init(); |
| 3230 | f_global_init(); |
| 3231 | |
| 3232 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3233 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx + 1) { |
| 3234 | /* some downlink PDU occurring on SIG-BVC with a TLLI */ |
| 3235 | var OCT4 tlli := f_gen_tlli_for_sgsn_nri(sgsn_idx, nri_idx); |
| 3236 | var PDU_BSSGP inner := valueof(ts_BSSGP_FLUSH_LL(tlli, 2342)); |
| 3237 | |
| 3238 | f_TC_status_ul(0, sgsn_idx, inner); |
| 3239 | } |
| 3240 | } |
| 3241 | |
| 3242 | f_cleanup(); |
| 3243 | } |
| 3244 | |
| 3245 | /* STATUS in uplink direction on SIG-BVC containing a TMSI; expect routing by its NRI */ |
| 3246 | testcase TC_status_sig_ul_tmsi() runs on GlobalTest_CT |
| 3247 | { |
| 3248 | var integer sgsn_idx, nri_idx; |
| 3249 | |
| 3250 | f_init(); |
| 3251 | f_global_init(); |
| 3252 | |
| 3253 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3254 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx + 1) { |
| 3255 | /* some downlink PDU occurring on SIG-BVC with a TMSI */ |
| 3256 | const hexstring imsi := '001010123456789'H |
| 3257 | var OCT4 tmsi := f_gen_tmsi_for_sgsn_nri(sgsn_idx, nri_idx); |
| 3258 | var BssgpBvci bvci := g_pcu[0].cfg.bvc[0].bvci; |
| 3259 | var PDU_BSSGP inner := valueof(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3260 | f_TC_status_ul(0, sgsn_idx, inner); |
| 3261 | } |
| 3262 | } |
| 3263 | |
| 3264 | f_cleanup(); |
| 3265 | } |
| 3266 | |
| 3267 | |
| 3268 | /* STATUS in uplink direction on PTP-BVC containing a TLLI; expect routing by its NRI */ |
| 3269 | testcase TC_status_ptp_ul_tlli() runs on GlobalTest_CT |
| 3270 | { |
| 3271 | var integer sgsn_idx, nri_idx; |
| 3272 | |
| 3273 | f_init(); |
| 3274 | f_global_init_ptp(); |
| 3275 | |
| 3276 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3277 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx + 1) { |
| 3278 | /* some downlink PDU occurring on PTP-BVC with a TLLI */ |
| 3279 | var OCT4 tlli := f_gen_tlli_for_sgsn_nri(sgsn_idx, nri_idx); |
| 3280 | var PDU_BSSGP inner := valueof(ts_BSSGP_DL_UD(tlli, '2342'O)); |
| 3281 | |
| 3282 | f_TC_status_ul(0, sgsn_idx, inner); |
| 3283 | } |
| 3284 | } |
| 3285 | |
| 3286 | f_cleanup(); |
| 3287 | } |
| 3288 | |
| 3289 | /* STATUS in uplink direction on PTP-BVC containing a TMSI; expect routing by its NRI */ |
| 3290 | testcase TC_status_ptp_ul_tmsi() runs on GlobalTest_CT |
| 3291 | { |
| 3292 | var integer sgsn_idx, nri_idx; |
| 3293 | |
| 3294 | f_init(); |
| 3295 | f_global_init_ptp(); |
| 3296 | |
| 3297 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3298 | for (nri_idx := 0; nri_idx < lengthof(mp_sgsn_nri[sgsn_idx]); nri_idx := nri_idx + 1) { |
| 3299 | /* some downlink PDU occurring on PTP-BVC with a TMSI */ |
| 3300 | const hexstring imsi := '001010123456789'H |
| 3301 | var OCT4 tmsi := f_gen_tmsi_for_sgsn_nri(sgsn_idx, nri_idx); |
| 3302 | var BssgpBvci bvci := g_pcu[0].cfg.bvc[0].bvci; |
| 3303 | var PDU_BSSGP inner := valueof(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3304 | f_TC_status_ul(0, sgsn_idx, inner); |
| 3305 | } |
| 3306 | } |
| 3307 | |
| 3308 | f_cleanup(); |
| 3309 | } |
| 3310 | |
| 3311 | /* STATUS in downlink direction in SIG-BVC containing a BVCI; expect routing by it */ |
| 3312 | testcase TC_status_sig_dl_bvci() runs on GlobalTest_CT |
| 3313 | { |
| 3314 | var integer sgsn_idx, pcu_idx, bvc_idx; |
| 3315 | |
| 3316 | f_init(); |
| 3317 | f_global_init(); |
| 3318 | |
| 3319 | /* test each BVC in each PCU from each SGSN */ |
| 3320 | for (pcu_idx := 0; pcu_idx < lengthof(g_pcu); pcu_idx := pcu_idx + 1) { |
| 3321 | for (bvc_idx := 0; bvc_idx < lengthof(g_pcu[pcu_idx].cfg.bvc); bvc_idx := bvc_idx + 1) { |
| 3322 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3323 | /* some uplink PDU occurring on SIG-BVC containing a BVCI */ |
| 3324 | var BssgpBvci bvci := g_pcu[pcu_idx].cfg.bvc[bvc_idx].bvci; |
| 3325 | var PDU_BSSGP inner := valueof(ts_BSSGP_LLC_DISCARDED('12345678'O, 1, bvci, 23)); |
| 3326 | f_TC_status_dl(sgsn_idx, pcu_idx, inner); |
| 3327 | } |
| 3328 | } |
| 3329 | } |
| 3330 | |
| 3331 | f_cleanup(); |
| 3332 | } |
| 3333 | |
| 3334 | /* STATUS in downlink direction in PTP-BVC; expect routing by BVCI */ |
| 3335 | testcase TC_status_ptp_dl_bvci() runs on GlobalTest_CT |
| 3336 | { |
| 3337 | var integer sgsn_idx, pcu_idx, bvc_idx; |
| 3338 | |
| 3339 | f_init(); |
| 3340 | f_global_init_ptp(); |
| 3341 | |
| 3342 | /* test each BVC in each PCU from each SGSN */ |
| 3343 | for (pcu_idx := 0; pcu_idx < lengthof(g_pcu); pcu_idx := pcu_idx + 1) { |
| 3344 | for (bvc_idx := 0; bvc_idx < lengthof(g_pcu[pcu_idx].cfg.bvc); bvc_idx := bvc_idx + 1) { |
| 3345 | var BssgpBvci bvci := g_pcu[pcu_idx].cfg.bvc[bvc_idx].bvci; |
| 3346 | f_global_ptp_connect_pcu_bvci(pcu_idx, bvci); |
| 3347 | for (sgsn_idx := 0; sgsn_idx < NUM_SGSN; sgsn_idx := sgsn_idx + 1) { |
| 3348 | f_global_ptp_connect_sgsn_bvci(sgsn_idx, bvci); |
| 3349 | |
| 3350 | /* some uplink PDU occurring on PTP-BVC */ |
| 3351 | var BssgpCellId cell_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id; |
| 3352 | var PDU_BSSGP inner := valueof(ts_BSSGP_UL_UD('12345678'O, cell_id, '4223'O)); |
| 3353 | f_TC_status_dl(sgsn_idx, pcu_idx, inner); |
| 3354 | } |
| 3355 | } |
| 3356 | } |
| 3357 | |
| 3358 | f_cleanup(); |
| 3359 | } |
| 3360 | |
| 3361 | /* TODO: test case for DL-STATUS(SUSPEND/RESUME) containing RA-ID; expect routing by RA-ID */ |
| 3362 | /* TODO: test case for UL-STATUS(PAGING-by-IMSI) after sending an actual PAGIN-by-IMSI in DL first */ |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3363 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 3364 | control { |
| 3365 | execute( TC_BVC_bringup() ); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 3366 | execute( TC_ul_unitdata() ); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 3367 | execute( TC_dl_unitdata() ); |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 3368 | execute( TC_ra_capability() ); |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 3369 | execute( TC_ra_capability_upd() ); |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 3370 | execute( TC_radio_status() ); |
Harald Welte | 3148a96 | 2021-01-17 11:15:28 +0100 | [diff] [blame] | 3371 | execute( TC_radio_status_tmsi() ); |
| 3372 | execute( TC_radio_status_imsi() ); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 3373 | execute( TC_suspend() ); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 3374 | execute( TC_resume() ); |
Harald Welte | f8e5c5d | 2020-11-27 22:37:23 +0100 | [diff] [blame] | 3375 | execute( TC_trace() ); |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 3376 | execute( TC_llc_discarded() ); |
Harald Welte | f20af41 | 2020-11-28 16:11:11 +0100 | [diff] [blame] | 3377 | execute( TC_overload() ); |
Harald Welte | 239aa50 | 2020-11-24 23:14:20 +0100 | [diff] [blame] | 3378 | execute( TC_bvc_block_ptp() ); |
| 3379 | execute( TC_bvc_unblock_ptp() ); |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 3380 | execute( TC_bvc_reset_ptp_from_bss() ); |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 3381 | execute( TC_bvc_reset_sig_from_bss() ); |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 3382 | execute( TC_bvc_reset_ptp_from_sgsn() ); |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 3383 | execute( TC_bvc_reset_sig_from_sgsn() ); |
Harald Welte | f6e59b0 | 2020-12-08 08:29:09 +0100 | [diff] [blame] | 3384 | if (mp_enable_bss_load_sharing) { |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 3385 | /* don't enable this by default, as we don't yet have any automatic test setup for FR with 4 NS-VC */ |
| 3386 | execute( TC_load_sharing_dl() ); |
| 3387 | } |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3388 | |
| 3389 | /* PAGING-PS over PTP BVC */ |
| 3390 | execute( TC_paging_ps_ptp_bss() ); |
| 3391 | execute( TC_paging_ps_ptp_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3392 | execute( TC_paging_ps_ptp_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3393 | execute( TC_paging_ps_ptp_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3394 | execute( TC_paging_ps_ptp_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3395 | execute( TC_paging_ps_ptp_bvci() ); |
Harald Welte | b5a04aa | 2021-01-16 13:04:40 +0100 | [diff] [blame] | 3396 | execute( TC_paging_ps_ptp_bvci_imsi() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3397 | execute( TC_paging_ps_ptp_bvci_unknown() ); |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 3398 | execute( TC_paging_ps_reject_ptp_bvci() ); |
| 3399 | execute( TC_paging_ps_reject_ptp_bvci_imsi() ); |
Harald Welte | 7595d56 | 2021-01-16 19:09:20 +0100 | [diff] [blame] | 3400 | execute( TC_dummy_paging_ps_ptp() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3401 | |
| 3402 | /* PAGING-PS over SIG BVC */ |
| 3403 | execute( TC_paging_ps_sig_bss() ); |
| 3404 | execute( TC_paging_ps_sig_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3405 | execute( TC_paging_ps_sig_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3406 | execute( TC_paging_ps_sig_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3407 | execute( TC_paging_ps_sig_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3408 | execute( TC_paging_ps_sig_bvci() ); |
Harald Welte | b5a04aa | 2021-01-16 13:04:40 +0100 | [diff] [blame] | 3409 | execute( TC_paging_ps_sig_bvci_imsi() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3410 | execute( TC_paging_ps_sig_bvci_unknown() ); |
Harald Welte | cf20007 | 2021-01-16 15:20:46 +0100 | [diff] [blame] | 3411 | execute( TC_paging_ps_reject_sig_bvci() ); |
| 3412 | execute( TC_paging_ps_reject_sig_bvci_imsi() ); |
Harald Welte | 7595d56 | 2021-01-16 19:09:20 +0100 | [diff] [blame] | 3413 | execute( TC_dummy_paging_ps_sig() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3414 | |
| 3415 | /* PAGING-CS over PTP BVC */ |
| 3416 | execute( TC_paging_cs_ptp_bss() ); |
| 3417 | execute( TC_paging_cs_ptp_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3418 | execute( TC_paging_cs_ptp_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3419 | execute( TC_paging_cs_ptp_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3420 | execute( TC_paging_cs_ptp_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3421 | execute( TC_paging_cs_ptp_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3422 | execute( TC_paging_cs_ptp_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3423 | |
| 3424 | /* PAGING-CS over SIG BVC */ |
| 3425 | execute( TC_paging_cs_sig_bss() ); |
| 3426 | execute( TC_paging_cs_sig_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3427 | execute( TC_paging_cs_sig_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3428 | execute( TC_paging_cs_sig_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3429 | execute( TC_paging_cs_sig_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3430 | execute( TC_paging_cs_sig_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 3431 | execute( TC_paging_cs_sig_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3432 | |
Harald Welte | f86f185 | 2021-01-16 21:56:17 +0100 | [diff] [blame] | 3433 | /* RAN Information Management */ |
| 3434 | execute( TC_rim_info_req() ); |
| 3435 | execute( TC_rim_info() ); |
| 3436 | execute( TC_rim_info_ack() ); |
| 3437 | execute( TC_rim_info_error() ); |
| 3438 | execute( TC_rim_info_app_error() ); |
| 3439 | execute( TC_rim_info_pcu2pcu() ); |
| 3440 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 3441 | |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 3442 | execute( TC_flush_ll() ); |
Harald Welte | 299aa48 | 2020-12-09 15:10:55 +0100 | [diff] [blame] | 3443 | execute( TC_fc_bvc() ); |
Harald Welte | cc3894b | 2020-12-09 16:50:12 +0100 | [diff] [blame] | 3444 | execute( TC_fc_ms() ); |
Harald Welte | d6f8981 | 2021-01-16 18:57:49 +0100 | [diff] [blame] | 3445 | execute( TC_ms_reg_enq() ); |
Harald Welte | 0435865 | 2021-01-17 13:48:13 +0100 | [diff] [blame] | 3446 | |
| 3447 | /* Uplink STATUS */ |
| 3448 | execute( TC_status_sig_ul_tlli() ); |
| 3449 | execute( TC_status_sig_ul_tmsi() ); |
| 3450 | execute( TC_status_ptp_ul_tlli() ); |
| 3451 | execute( TC_status_ptp_ul_tmsi() ); |
| 3452 | |
| 3453 | /* Downlink STATUS */ |
| 3454 | execute( TC_status_sig_dl_bvci() ); |
| 3455 | execute( TC_status_ptp_dl_bvci() ); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 3456 | } |
| 3457 | |
| 3458 | |
| 3459 | } |