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 |
| 4 | * (C) 2020 sysmocom - s.f.m.c. GmbH |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Author: Daniel Willmann <dwillmann@sysmocom.de> |
| 8 | |
| 9 | * Released under the terms of GNU General Public License, Version 2 or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 13 | */ |
| 14 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | import from GSM_Types all; |
| 18 | import from Native_Functions all; |
| 19 | import from NS_Types all; |
| 20 | import from NS_Emulation all; |
| 21 | import from BSSGP_Types all; |
| 22 | import from BSSGP_Emulation all; |
| 23 | import from SCCPasp_Types all; |
| 24 | import from Osmocom_Gb_Types all; |
| 25 | |
| 26 | import from MobileL3_CommonIE_Types all; |
| 27 | import from MobileL3_GMM_SM_Types all; |
| 28 | import from MobileL3_Types all; |
| 29 | import from L3_Templates all; |
| 30 | import from L3_Common all; |
| 31 | |
| 32 | import from TELNETasp_PortType all; |
| 33 | import from Osmocom_VTY_Functions all; |
| 34 | |
| 35 | import from LLC_Types all; |
| 36 | import from LLC_Templates all; |
| 37 | |
| 38 | import from GSM_RR_Types all; |
| 39 | |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 40 | /* mcc_mnc is 24.008 10.5.5.15 encoded. 262 42 */ |
| 41 | const BcdMccMnc c_mcc_mnc := '262F42'H; |
| 42 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 43 | /* 48.016 section 6.1.4.2: The default maximum information field size of 1600 octets shall be supported on the Gb interface */ |
| 44 | const integer max_fr_info_size := 1600; |
| 45 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 46 | modulepar { |
| 47 | /* IP/port on which we run our internal GSUP/HLR emulation */ |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 48 | NSConfigurations mp_nsconfig_sgsn := { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 49 | { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 50 | nsei := 101, |
| 51 | role_sgsn := true, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 52 | handle_sns := false, |
| 53 | nsvc := { |
| 54 | { |
| 55 | provider := { |
| 56 | ip := { |
| 57 | address_family := AF_INET, |
| 58 | local_udp_port := 7777, |
| 59 | local_ip := "127.0.0.1", |
| 60 | remote_udp_port := 23000, |
| 61 | remote_ip := "127.0.0.1" |
| 62 | } |
| 63 | }, |
| 64 | nsvci := 101 |
| 65 | } |
| 66 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 67 | } |
| 68 | }; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 69 | NSConfigurations mp_nsconfig_pcu := { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 70 | { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 71 | nsei := 96, |
| 72 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 73 | handle_sns := false, |
| 74 | nsvc := { |
| 75 | { |
| 76 | provider := { |
| 77 | ip := { |
| 78 | address_family := AF_INET, |
| 79 | local_udp_port := 21010, |
| 80 | local_ip := "127.0.0.1", |
| 81 | remote_udp_port := 23000, |
| 82 | remote_ip := "127.0.0.1" |
| 83 | } |
| 84 | }, |
| 85 | nsvci := 97 |
| 86 | } |
| 87 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 88 | }, |
| 89 | { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 90 | nsei := 97, |
| 91 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 92 | handle_sns := false, |
| 93 | nsvc := { |
| 94 | { |
| 95 | provider := { |
| 96 | ip := { |
| 97 | address_family := AF_INET, |
| 98 | local_udp_port := 21011, |
| 99 | local_ip := "127.0.0.1", |
| 100 | remote_udp_port := 23000, |
| 101 | remote_ip := "127.0.0.1" |
| 102 | } |
| 103 | }, |
| 104 | nsvci := 98 |
| 105 | } |
| 106 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 107 | }, |
| 108 | { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 109 | nsei := 98, |
| 110 | role_sgsn := false, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 111 | handle_sns := false, |
| 112 | nsvc := { |
| 113 | { |
| 114 | provider := { |
| 115 | ip := { |
| 116 | address_family := AF_INET, |
| 117 | local_udp_port := 21012, |
| 118 | local_ip := "127.0.0.1", |
| 119 | remote_udp_port := 23000, |
| 120 | remote_ip := "127.0.0.1" |
| 121 | } |
| 122 | }, |
| 123 | nsvci := 99 |
| 124 | } |
| 125 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 126 | } |
| 127 | }; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 128 | BssgpConfigs mp_gbconfigs := { |
| 129 | { |
| 130 | nsei := 96, |
| 131 | sgsn_role := false, |
| 132 | bvc := { |
| 133 | { |
| 134 | bvci := 196, |
| 135 | cell_id := { |
| 136 | ra_id := { |
| 137 | lai := { |
| 138 | mcc_mnc := c_mcc_mnc, |
| 139 | lac := 13135 |
| 140 | }, |
| 141 | rac := 0 |
| 142 | }, |
| 143 | cell_id := 20960 |
| 144 | }, |
| 145 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 146 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 147 | } |
| 148 | } |
| 149 | }, { |
| 150 | nsei := 97, |
| 151 | sgsn_role := false, |
| 152 | bvc := { |
| 153 | { |
| 154 | bvci := 210, |
| 155 | cell_id := { |
| 156 | ra_id := { |
| 157 | lai := { |
| 158 | mcc_mnc := c_mcc_mnc, |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 159 | lac := 13135 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 160 | }, |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 161 | rac := 1 |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 162 | }, |
| 163 | cell_id := 20961 |
| 164 | }, |
| 165 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 166 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 167 | } |
| 168 | } |
| 169 | }, { |
| 170 | nsei := 98, |
| 171 | sgsn_role := false, |
| 172 | bvc := { |
| 173 | { |
| 174 | bvci := 220, |
| 175 | cell_id := { |
| 176 | ra_id := { |
| 177 | lai := { |
| 178 | mcc_mnc := c_mcc_mnc, |
| 179 | lac := 13300 |
| 180 | }, |
| 181 | rac := 0 |
| 182 | }, |
| 183 | cell_id := 20962 |
| 184 | }, |
| 185 | depth := BSSGP_DECODE_DEPTH_BSSGP, |
| 186 | create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 191 | }; |
| 192 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 193 | type record GbInstance { |
| 194 | NS_CT vc_NS, |
| 195 | BSSGP_CT vc_BSSGP, |
Harald Welte | 67dc8c2 | 2020-11-17 18:32:29 +0100 | [diff] [blame] | 196 | BSSGP_BVC_CTs vc_BSSGP_BVC, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 197 | BssgpConfig cfg |
| 198 | }; |
Harald Welte | 67dc8c2 | 2020-11-17 18:32:29 +0100 | [diff] [blame] | 199 | type record of BSSGP_BVC_CT BSSGP_BVC_CTs |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 200 | |
| 201 | const integer NUM_PCU := 3; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 202 | type record of GbInstance GbInstances; |
| 203 | type record of BssgpConfig BssgpConfigs; |
| 204 | type record of NSConfiguration NSConfigurations; |
| 205 | type record of BssgpCellId BssgpCellIds; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 206 | |
| 207 | const integer NUM_SGSN := 1; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 208 | |
| 209 | type component test_CT { |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 210 | var GbInstances g_pcu; |
| 211 | var GbInstances g_sgsn; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 212 | |
| 213 | port BSSGP_CT_PROC_PT PROC; |
| 214 | |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 215 | port BSSGP_BVC_MGMT_PT SGSN_MGMT; |
| 216 | port BSSGP_BVC_MGMT_PT PCU_MGMT; |
| 217 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 218 | port TELNETasp_PT GBPVTY; |
| 219 | |
| 220 | var boolean g_initialized := false; |
| 221 | var boolean g_use_echo := false; |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 222 | |
| 223 | var ro_integer g_roi := {}; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | type component BSSGP_ConnHdlr { |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 227 | /* array of per-BVC ports on the PCU side */ |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 228 | port BSSGP_PT PCU[NUM_PCU]; |
| 229 | port BSSGP_PT PCU_SIG[NUM_PCU]; |
| 230 | port BSSGP_PROC_PT PCU_PROC[NUM_PCU]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 231 | /* component reference to the component to which we're currently connected */ |
| 232 | var BSSGP_BVC_CT pcu_ct[NUM_PCU]; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 233 | /* BSSGP BVC configuration of the component to which we're currently connected */ |
| 234 | var BssgpBvcConfig pcu_bvc_cfg[NUM_PCU]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 235 | |
| 236 | /* array of per-BVC ports on the SGSN side */ |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 237 | port BSSGP_PT SGSN[NUM_SGSN]; |
| 238 | port BSSGP_PT SGSN_SIG[NUM_SGSN]; |
| 239 | port BSSGP_PROC_PT SGSN_PROC[NUM_SGSN]; |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 240 | /* component reference to the component to which we're currently connected */ |
| 241 | var BSSGP_BVC_CT sgsn_ct[NUM_PCU]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 242 | |
| 243 | var BSSGP_ConnHdlrPars g_pars; |
| 244 | timer g_Tguard; |
| 245 | var LLC_Entities llc; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 246 | |
| 247 | var ro_integer g_roi := {}; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | type record SGSN_ConnHdlrNetworkPars { |
| 251 | boolean expect_ptmsi, |
| 252 | boolean expect_auth, |
| 253 | boolean expect_ciph |
| 254 | }; |
| 255 | |
| 256 | type record BSSGP_ConnHdlrPars { |
| 257 | /* IMEI of the simulated ME */ |
| 258 | hexstring imei, |
| 259 | /* IMSI of the simulated MS */ |
| 260 | hexstring imsi, |
| 261 | /* MSISDN of the simulated MS (probably unused) */ |
| 262 | hexstring msisdn, |
| 263 | /* P-TMSI allocated to the simulated MS */ |
| 264 | OCT4 p_tmsi optional, |
| 265 | OCT3 p_tmsi_sig optional, |
| 266 | /* TLLI of the simulated MS */ |
| 267 | OCT4 tlli, |
| 268 | OCT4 tlli_old optional, |
| 269 | RoutingAreaIdentificationV ra optional, |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 270 | GbInstances pcu, |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 271 | GbInstances sgsn, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 272 | float t_guard |
| 273 | }; |
| 274 | |
| 275 | private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdentificationV { |
| 276 | /* mcc_mnc is encoded as of 24.008 10.5.5.15 */ |
| 277 | var BcdMccMnc mcc_mnc := cell_id.ra_id.lai.mcc_mnc; |
| 278 | |
| 279 | var RoutingAreaIdentificationV ret := { |
| 280 | mccDigit1 := mcc_mnc[0], |
| 281 | mccDigit2 := mcc_mnc[1], |
| 282 | mccDigit3 := mcc_mnc[2], |
| 283 | mncDigit3 := mcc_mnc[3], |
| 284 | mncDigit1 := mcc_mnc[4], |
| 285 | mncDigit2 := mcc_mnc[5], |
| 286 | lac := int2oct(cell_id.ra_id.lai.lac, 16), |
| 287 | rac := int2oct(cell_id.ra_id.rac, 8) |
| 288 | } |
| 289 | return ret; |
| 290 | }; |
| 291 | |
Harald Welte | 9533943 | 2020-12-02 18:50:52 +0100 | [diff] [blame^] | 292 | private function f_fix_create_cb(inout BssgpConfig cfg) |
| 293 | { |
| 294 | for (var integer i := 0; i < lengthof(cfg.bvc); i := i + 1) { |
| 295 | if (not isbound(cfg.bvc[i].create_cb)) { |
| 296 | cfg.bvc[i].create_cb := refers(BSSGP_Emulation.DefaultCreateCallback) |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 301 | 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] | 302 | var charstring ns_id := id & "-NS(PCU[" & int2str(offset) & "])"; |
| 303 | var charstring bssgp_id := id & "-BSSGP(PCU[" & int2str(offset) & "])"; |
| 304 | gb.vc_NS := NS_CT.create(ns_id); |
| 305 | gb.vc_BSSGP := BSSGP_CT.create(bssgp_id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 306 | /* connect lower end of BSSGP emulation with NS upper port */ |
| 307 | connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP); |
| 308 | |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 309 | gb.vc_NS.start(NSStart(mp_nsconfig_pcu[offset], ns_id)); |
| 310 | gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 311 | |
| 312 | for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) { |
| 313 | connect(self:PROC, gb.vc_BSSGP:PROC); |
| 314 | gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC); |
| 315 | disconnect(self:PROC, gb.vc_BSSGP:PROC); |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 316 | connect(self:PCU_MGMT, gb.vc_BSSGP_BVC[i]:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 317 | } |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 318 | connect(self:PCU_MGMT, gb.vc_BSSGP:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | 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] | 322 | var charstring ns_id := id & "-NS(SGSN[" & int2str(offset) & "])"; |
| 323 | var charstring bssgp_id := id & "-BSSGP(SGSN[" & int2str(offset) & "])"; |
| 324 | gb.vc_NS := NS_CT.create(ns_id); |
| 325 | gb.vc_BSSGP := BSSGP_CT.create(bssgp_id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 326 | /* connect lower end of BSSGP emulation with NS upper port */ |
| 327 | connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP); |
| 328 | |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 329 | gb.vc_NS.start(NSStart(mp_nsconfig_sgsn[offset], ns_id)); |
| 330 | gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id)); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 331 | |
| 332 | for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) { |
| 333 | connect(self:PROC, gb.vc_BSSGP:PROC); |
| 334 | gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC); |
| 335 | disconnect(self:PROC, gb.vc_BSSGP:PROC); |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 336 | connect(self:SGSN_MGMT, gb.vc_BSSGP_BVC[i]:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 337 | } |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 338 | connect(self:SGSN_MGMT, gb.vc_BSSGP:MGMT); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | |
| 342 | private function f_init_vty() runs on test_CT { |
| 343 | map(self:GBPVTY, system:GBPVTY); |
| 344 | f_vty_set_prompts(GBPVTY); |
| 345 | f_vty_transceive(GBPVTY, "enable"); |
| 346 | } |
| 347 | |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 348 | type record of integer ro_integer; |
| 349 | |
| 350 | private function ro_integer_contains(ro_integer r, integer x) return boolean { |
| 351 | for (var integer j := 0; j < lengthof(r); j := j+1) { |
| 352 | if (r[j] == x) { |
| 353 | return true; |
| 354 | } |
| 355 | } |
| 356 | return false; |
| 357 | } |
| 358 | |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 359 | function f_init() runs on test_CT { |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 360 | var ro_integer bvci_unblocked := {}; |
| 361 | var BssgpStatusIndication bsi; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 362 | var integer i; |
| 363 | |
| 364 | if (g_initialized == true) { |
| 365 | return; |
| 366 | } |
| 367 | g_initialized := true; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 368 | |
| 369 | g_sgsn[0].cfg := { |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 370 | nsei := mp_nsconfig_sgsn[0].nsei, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 371 | sgsn_role := true, |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 372 | bvc := { } |
| 373 | } |
| 374 | for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) { |
| 375 | g_pcu[i].cfg := mp_gbconfigs[i]; |
Harald Welte | 9533943 | 2020-12-02 18:50:52 +0100 | [diff] [blame^] | 376 | /* make sure all have a proper crate_cb, which cannot be specified in config file */ |
| 377 | f_fix_create_cb(g_pcu[i].cfg); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 378 | /* concatenate all the PCU-side BVCs for the SGSN side */ |
Harald Welte | 9533943 | 2020-12-02 18:50:52 +0100 | [diff] [blame^] | 379 | g_sgsn[0].cfg.bvc := g_sgsn[0].cfg.bvc & g_pcu[i].cfg.bvc; |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 380 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 381 | |
| 382 | f_init_vty(); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 383 | for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) { |
Daniel Willmann | 443fc57 | 2020-11-18 13:26:57 +0100 | [diff] [blame] | 384 | f_vty_transceive(GBPVTY, "nsvc nsei " & int2str(g_sgsn[i].cfg.nsei) & " force-unconfigured"); |
Harald Welte | ea1ba59 | 2020-11-17 18:05:13 +0100 | [diff] [blame] | 385 | f_init_gb_sgsn(g_sgsn[i], "GbProxy_Test", i); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 386 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 387 | f_sleep(4.0); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 388 | for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
Harald Welte | 951e6a9 | 2020-12-02 19:08:45 +0100 | [diff] [blame] | 389 | f_vty_transceive(GBPVTY, "nsvc nsei " & int2str(g_pcu[i].cfg.nsei) & " force-unconfigured"); |
Harald Welte | b419d0e | 2020-11-16 16:45:05 +0100 | [diff] [blame] | 390 | f_init_gb_pcu(g_pcu[i], "GbProxy_Test", i); |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 391 | } |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 392 | |
| 393 | /* wait until all BVC are unblocked on both sides */ |
Harald Welte | d280127 | 2020-11-17 19:22:58 +0100 | [diff] [blame] | 394 | timer T := 15.0; |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 395 | T.start; |
| 396 | alt { |
| 397 | [] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi { |
| 398 | bvci_unblocked := bvci_unblocked & { bsi.bvci }; |
| 399 | if (lengthof(bvci_unblocked) != lengthof(g_sgsn[0].cfg.bvc)) { |
| 400 | repeat; |
| 401 | } |
| 402 | } |
| 403 | [] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) { |
| 404 | repeat; |
| 405 | } |
Harald Welte | 3c90515 | 2020-11-26 20:56:09 +0100 | [diff] [blame] | 406 | [] SGSN_MGMT.receive(BssgpResetIndication:?) { |
| 407 | repeat; |
| 408 | } |
Harald Welte | fbae83f | 2020-11-15 23:25:55 +0100 | [diff] [blame] | 409 | [] SGSN_MGMT.receive { |
| 410 | setverdict(fail, "Received unexpected message on SGSN_MGMT"); |
| 411 | mtc.stop; |
| 412 | } |
| 413 | |
| 414 | [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi { |
| 415 | repeat; |
| 416 | } |
| 417 | [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) { |
| 418 | repeat; |
| 419 | } |
| 420 | [] PCU_MGMT.receive(BssgpResetIndication:{0}) { |
| 421 | repeat; |
| 422 | } |
| 423 | [] PCU_MGMT.receive { |
| 424 | setverdict(fail, "Received unexpected message on PCU_MGMT"); |
| 425 | mtc.stop; |
| 426 | } |
| 427 | |
| 428 | [] T.timeout { |
| 429 | setverdict(fail, "Timeout waiting for unblock of all BVCs"); |
| 430 | mtc.stop; |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /* iterate over list and check all BVCI */ |
| 435 | for (i := 0; i < lengthof(g_sgsn[0].cfg.bvc); i := i+1) { |
| 436 | var BssgpBvci bvci := g_sgsn[0].cfg.bvc[i].bvci; |
| 437 | if (not ro_integer_contains(bvci_unblocked, bvci)) { |
| 438 | setverdict(fail, "BVCI=", bvci, " was not unblocked during start-up"); |
| 439 | mtc.stop; |
| 440 | } |
| 441 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | function f_cleanup() runs on test_CT { |
| 445 | self.stop; |
| 446 | } |
| 447 | |
| 448 | type function void_fn(charstring id) runs on BSSGP_ConnHdlr; |
| 449 | |
| 450 | /* helper function to create, connect and start a BSSGP_ConnHdlr component */ |
Harald Welte | 6d63f74 | 2020-11-15 19:44:04 +0100 | [diff] [blame] | 451 | function f_start_handler(void_fn fn, charstring id, GbInstances pcu, GbInstances sgsn, integer imsi_suffix, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 452 | float t_guard := 30.0) |
| 453 | runs on test_CT return BSSGP_ConnHdlr { |
| 454 | var BSSGP_ConnHdlr vc_conn; |
| 455 | |
| 456 | var BSSGP_ConnHdlrPars pars := { |
| 457 | imei := f_gen_imei(imsi_suffix), |
| 458 | imsi := f_gen_imsi(imsi_suffix), |
| 459 | msisdn := f_gen_msisdn(imsi_suffix), |
| 460 | p_tmsi := omit, |
| 461 | p_tmsi_sig := omit, |
| 462 | tlli := f_gprs_tlli_random(), |
| 463 | tlli_old := omit, |
| 464 | ra := omit, |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 465 | pcu := g_pcu, |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 466 | sgsn := g_sgsn, |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 467 | t_guard := t_guard |
| 468 | }; |
| 469 | |
| 470 | vc_conn := BSSGP_ConnHdlr.create(id); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 471 | |
| 472 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 473 | return vc_conn; |
| 474 | } |
| 475 | |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 476 | /* 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] | 477 | private function f_connect_to_pcu_bvc(integer port_idx, integer nse_idx, integer bvc_idx) |
| 478 | runs on BSSGP_ConnHdlr { |
| 479 | var BSSGP_BVC_CT bvc_ct := g_pars.pcu[nse_idx].vc_BSSGP_BVC[bvc_idx] |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 480 | if (PCU[port_idx].checkstate("Connected")) { |
| 481 | /* unregister + disconnect from old BVC */ |
| 482 | f_client_unregister(g_pars.imsi, PCU_PROC[port_idx]); |
| 483 | disconnect(self:PCU[port_idx], pcu_ct[port_idx]:BSSGP_SP); |
| 484 | disconnect(self:PCU_SIG[port_idx], pcu_ct[port_idx]:BSSGP_SP_SIG); |
| 485 | disconnect(self:PCU_PROC[port_idx], pcu_ct[port_idx]:BSSGP_PROC); |
| 486 | } |
| 487 | /* connect to new BVC and register us */ |
| 488 | connect(self:PCU[port_idx], bvc_ct:BSSGP_SP); |
| 489 | connect(self:PCU_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); |
| 490 | connect(self:PCU_PROC[port_idx], bvc_ct:BSSGP_PROC); |
| 491 | f_client_register(g_pars.imsi, g_pars.tlli, PCU_PROC[port_idx]); |
| 492 | pcu_ct[port_idx] := bvc_ct; |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 493 | 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] | 494 | } |
| 495 | |
| 496 | /* Connect the SGSN-side per-BVC ports (SGSN/SGSN_SIG/SGSN_PROC) array slot 'port_idx' to specified per-BVC component */ |
| 497 | private function f_connect_to_sgsn_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) runs on BSSGP_ConnHdlr { |
| 498 | if (SGSN[port_idx].checkstate("Connected")) { |
| 499 | /* unregister + disconnect from old BVC */ |
| 500 | f_client_unregister(g_pars.imsi, SGSN_PROC[port_idx]); |
| 501 | disconnect(self:SGSN[port_idx], sgsn_ct[port_idx]:BSSGP_SP); |
| 502 | disconnect(self:SGSN_SIG[port_idx], sgsn_ct[port_idx]:BSSGP_SP_SIG); |
| 503 | disconnect(self:SGSN_PROC[port_idx], sgsn_ct[port_idx]:BSSGP_PROC); |
| 504 | } |
| 505 | /* connect to new BVC and register us */ |
| 506 | connect(self:SGSN[port_idx], bvc_ct:BSSGP_SP); |
| 507 | connect(self:SGSN_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); |
| 508 | connect(self:SGSN_PROC[port_idx], bvc_ct:BSSGP_PROC); |
| 509 | f_client_register(g_pars.imsi, g_pars.tlli, SGSN_PROC[port_idx]); |
| 510 | sgsn_ct[port_idx] := bvc_ct; |
| 511 | } |
| 512 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 513 | private altstep as_Tguard() runs on BSSGP_ConnHdlr { |
| 514 | [] g_Tguard.timeout { |
| 515 | setverdict(fail, "Tguard timeout"); |
| 516 | mtc.stop; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | /* first function called in every ConnHdlr */ |
| 521 | private function f_handler_init(void_fn fn, charstring id, BSSGP_ConnHdlrPars pars) |
| 522 | runs on BSSGP_ConnHdlr { |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 523 | var integer i; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 524 | /* do some common stuff like setting up g_pars */ |
| 525 | g_pars := pars; |
| 526 | |
| 527 | llc := f_llc_create(false); |
| 528 | |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 529 | /* default connections on PCU side: First BVC of each NSE/PCU */ |
| 530 | for (i := 0; i < lengthof(g_pars.pcu); i := i+1) { |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 531 | 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] | 532 | } |
Harald Welte | 3dd21b3 | 2020-11-17 19:21:00 +0100 | [diff] [blame] | 533 | |
| 534 | /* default connections on SGSN side: First BVC of each NSE/SGSN */ |
| 535 | for (i := 0; i < lengthof(g_pars.sgsn); i := i+1) { |
| 536 | 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] | 537 | } |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 538 | |
| 539 | g_Tguard.start(pars.t_guard); |
| 540 | activate(as_Tguard()); |
| 541 | |
| 542 | /* call the user-supplied test case function */ |
| 543 | fn.apply(id); |
| 544 | } |
| 545 | |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 546 | private function f_client_register(hexstring imsi, OCT4 tlli, BSSGP_PROC_PT PT) |
| 547 | runs on BSSGP_ConnHdlr { |
| 548 | PT.call(BSSGP_register_client:{imsi, tlli}) { |
| 549 | [] PT.getreply(BSSGP_register_client:{imsi, tlli}) {}; |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | private function f_client_unregister(hexstring imsi, BSSGP_PROC_PT PT) |
| 554 | runs on BSSGP_ConnHdlr { |
| 555 | PT.call(BSSGP_unregister_client:{imsi}) { |
| 556 | [] PT.getreply(BSSGP_unregister_client:{imsi}) {}; |
| 557 | } |
| 558 | } |
| 559 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 560 | /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */ |
| 561 | friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 562 | integer pcu_idx := 0, integer sgsn_idx := 0, boolean use_sig := false) runs on BSSGP_ConnHdlr { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 563 | var PDU_BSSGP rx; |
| 564 | timer T := 1.0; |
| 565 | |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 566 | if (use_sig) { |
| 567 | PCU_SIG[pcu_idx].send(tx); |
| 568 | } else { |
| 569 | PCU[pcu_idx].send(tx); |
| 570 | } |
| 571 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 572 | T.start; |
| 573 | alt { |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 574 | [use_sig] SGSN_SIG[sgsn_idx].receive(exp_rx) { |
| 575 | setverdict(pass); |
| 576 | } |
| 577 | [not use_sig] SGSN[sgsn_idx].receive(exp_rx) { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 578 | setverdict(pass); |
| 579 | } |
| 580 | [] SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
| 581 | setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx); |
| 582 | mtc.stop; |
| 583 | } |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 584 | [] SGSN_SIG[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
| 585 | setverdict(fail, "Unexpected SIG BSSGP on SGSN side: ", rx); |
| 586 | mtc.stop; |
| 587 | } |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 588 | [] T.timeout { |
Harald Welte | 8b32641 | 2020-11-29 16:05:38 +0100 | [diff] [blame] | 589 | setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", exp_rx); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 590 | mtc.stop; |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | /* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ |
| 596 | friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 597 | integer sgsn_idx:= 0, integer pcu_idx := 0, boolean use_sig := false) runs on BSSGP_ConnHdlr { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 598 | var PDU_BSSGP rx; |
| 599 | timer T := 1.0; |
| 600 | |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 601 | if (use_sig) { |
| 602 | SGSN_SIG[sgsn_idx].send(tx); |
| 603 | } else { |
| 604 | SGSN[sgsn_idx].send(tx); |
| 605 | } |
| 606 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 607 | T.start; |
| 608 | alt { |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 609 | [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 610 | setverdict(pass); |
| 611 | } |
| 612 | [not use_sig] PCU[pcu_idx].receive(exp_rx) { |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 613 | setverdict(pass); |
| 614 | } |
| 615 | [] PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
| 616 | setverdict(fail, "Unexpected BSSGP on PCU side: ", rx); |
| 617 | mtc.stop; |
| 618 | } |
Daniel Willmann | 4798fd7 | 2020-11-24 16:23:29 +0100 | [diff] [blame] | 619 | [] PCU_SIG[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
| 620 | setverdict(fail, "Unexpected SIG BSSGP on PCU side: ", rx); |
| 621 | mtc.stop; |
| 622 | } |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 623 | [] T.timeout { |
Harald Welte | 8b32641 | 2020-11-29 16:05:38 +0100 | [diff] [blame] | 624 | setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", exp_rx); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 625 | mtc.stop; |
| 626 | } |
| 627 | } |
| 628 | } |
Harald Welte | 1e834f3 | 2020-11-15 20:02:59 +0100 | [diff] [blame] | 629 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 630 | /*********************************************************************** |
| 631 | * GlobaLTest_CT: Using the per-NSE GLOBAL ports on PCU + SGSN side |
| 632 | ***********************************************************************/ |
| 633 | |
| 634 | type component GlobalTest_CT extends test_CT { |
| 635 | port BSSGP_PT G_PCU[NUM_PCU]; |
| 636 | port BSSGP_PT G_SGSN[NUM_SGSN]; |
| 637 | }; |
| 638 | |
| 639 | private function f_global_init() runs on GlobalTest_CT { |
| 640 | var integer i; |
| 641 | for (i := 0; i < lengthof(g_sgsn); i := i+1) { |
| 642 | connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP:GLOBAL); |
| 643 | } |
| 644 | for (i := 0; i < lengthof(g_pcu); i := i+1) { |
| 645 | connect(self:G_PCU[i], g_pcu[i].vc_BSSGP:GLOBAL); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */ |
| 650 | friend function f_global_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 651 | integer pcu_idx := 0, integer sgsn_idx := 0) runs on GlobalTest_CT { |
| 652 | var PDU_BSSGP rx; |
| 653 | timer T := 1.0; |
| 654 | |
| 655 | G_PCU[pcu_idx].send(tx); |
| 656 | T.start; |
| 657 | alt { |
| 658 | [] G_SGSN[sgsn_idx].receive(exp_rx) { |
| 659 | setverdict(pass); |
| 660 | } |
| 661 | [] G_SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { |
| 662 | setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx); |
| 663 | mtc.stop; |
| 664 | } |
| 665 | [] T.timeout { |
| 666 | setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", rx); |
| 667 | mtc.stop; |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | /* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ |
| 673 | friend function f_global_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, |
| 674 | integer sgsn_idx := 0, integer pcu_idx := 0) runs on GlobalTest_CT { |
| 675 | var PDU_BSSGP rx; |
| 676 | timer T := 1.0; |
| 677 | |
| 678 | G_SGSN[sgsn_idx].send(tx); |
| 679 | T.start; |
| 680 | alt { |
| 681 | [] G_PCU[pcu_idx].receive(exp_rx) { |
| 682 | setverdict(pass); |
| 683 | } |
| 684 | [] G_PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx { |
| 685 | setverdict(fail, "Unexpected BSSGP on PCU side: ", rx); |
| 686 | mtc.stop; |
| 687 | } |
| 688 | [] T.timeout { |
| 689 | setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", rx); |
| 690 | mtc.stop; |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 696 | /* TODO: |
| 697 | * Detach without Attach |
| 698 | * SM procedures without attach / RAU |
| 699 | * ATTACH / RAU |
| 700 | ** with / without authentication |
| 701 | ** with / without P-TMSI allocation |
| 702 | * re-transmissions of LLC frames |
| 703 | * PDP Context activation |
| 704 | ** with different GGSN config in SGSN VTY |
| 705 | ** with different PDP context type (v4/v6/v46) |
| 706 | ** timeout from GGSN |
| 707 | ** multiple / secondary PDP context |
| 708 | */ |
| 709 | |
| 710 | private function f_TC_BVC_bringup(charstring id) runs on BSSGP_ConnHdlr { |
| 711 | f_sleep(5.0); |
| 712 | setverdict(pass); |
| 713 | } |
| 714 | |
| 715 | testcase TC_BVC_bringup() runs on test_CT { |
| 716 | var BSSGP_ConnHdlr vc_conn; |
| 717 | f_init(); |
| 718 | |
| 719 | vc_conn := f_start_handler(refers(f_TC_BVC_bringup), testcasename(), g_pcu, g_sgsn, 51); |
| 720 | vc_conn.done; |
| 721 | |
| 722 | f_cleanup(); |
| 723 | } |
| 724 | |
| 725 | 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] | 726 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 727 | timer T := 5.0; |
| 728 | var PDU_BSSGP rx_pdu; |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 729 | 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] | 730 | T.start; |
| 731 | alt { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 732 | [] 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] | 733 | return rx_pdu.pDU_BSSGP_SUSPEND_ACK.suspend_Reference_Number.suspend_Reference_Number_value; |
| 734 | } |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 735 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_SUSPEND_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) -> value rx_pdu { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 736 | setverdict(fail, "SUSPEND-NACK in response to SUSPEND for TLLI ", g_pars.tlli); |
| 737 | mtc.stop; |
| 738 | } |
| 739 | [] T.timeout { |
| 740 | setverdict(fail, "No SUSPEND-ACK in response to SUSPEND for TLLI ", g_pars.tlli); |
| 741 | mtc.stop; |
| 742 | } |
| 743 | } |
| 744 | return '00'O; |
| 745 | } |
| 746 | |
| 747 | 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] | 748 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 749 | timer T := 5.0; |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 750 | 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] | 751 | T.start; |
| 752 | alt { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 753 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_ACK(g_pars.tlli, bvcc.cell_id.ra_id)); |
| 754 | [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) { |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 755 | setverdict(fail, "RESUME-NACK in response to RESUME for TLLI ", g_pars.tlli); |
| 756 | mtc.stop; |
| 757 | } |
| 758 | [] T.timeout { |
| 759 | setverdict(fail, "No RESUME-ACK in response to SUSPEND for TLLI ", g_pars.tlli); |
| 760 | mtc.stop; |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 766 | /* send uplink-unitdata of a variety of different sizes; expect it to show up on SGSN */ |
| 767 | private function f_TC_ul_unitdata(charstring id) runs on BSSGP_ConnHdlr { |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 768 | var integer ran_idx := 0; |
| 769 | var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 770 | var integer i; |
| 771 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 772 | for (i := 0; i < max_fr_info_size-4; i := i+4) { |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 773 | var octetstring payload := f_rnd_octstring(i); |
Harald Welte | 16357a9 | 2020-11-17 18:20:00 +0100 | [diff] [blame] | 774 | 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] | 775 | /* 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] | 776 | 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] | 777 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 778 | log("UL-UNITDATA(payload_size=", i); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 779 | f_pcu2sgsn(pdu_tx, pdu_rx); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 780 | } |
| 781 | setverdict(pass); |
| 782 | } |
| 783 | |
| 784 | testcase TC_ul_unitdata() runs on test_CT |
| 785 | { |
| 786 | var BSSGP_ConnHdlr vc_conn; |
| 787 | f_init(); |
| 788 | |
| 789 | vc_conn := f_start_handler(refers(f_TC_ul_unitdata), testcasename(), g_pcu, g_sgsn, 1); |
| 790 | vc_conn.done; |
| 791 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 792 | |
| 793 | f_cleanup(); |
| 794 | } |
| 795 | |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 796 | /* send downlink-unitdata of a variety of different sizes; expect it to show up on PCU */ |
| 797 | private function f_TC_dl_unitdata(charstring id) runs on BSSGP_ConnHdlr { |
| 798 | var integer i; |
| 799 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 800 | for (i := 0; i < max_fr_info_size-4; i := i+4) { |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 801 | var octetstring payload := f_rnd_octstring(i); |
| 802 | var template (value) PDU_BSSGP pdu_tx := |
| 803 | ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi)); |
| 804 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 805 | var template (present) PDU_BSSGP pdu_rx := |
| 806 | tr_BSSGP_DL_UD(g_pars.tlli, payload, tr_BSSGP_IMSI(g_pars.imsi)); |
| 807 | |
Harald Welte | 0d5fceb | 2020-11-29 16:04:07 +0100 | [diff] [blame] | 808 | log("DL-UNITDATA(payload_size=", i); |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 809 | f_sgsn2pcu(pdu_tx, pdu_rx); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 810 | } |
| 811 | setverdict(pass); |
| 812 | } |
| 813 | |
| 814 | testcase TC_dl_unitdata() runs on test_CT |
| 815 | { |
| 816 | var BSSGP_ConnHdlr vc_conn; |
| 817 | f_init(); |
| 818 | |
| 819 | vc_conn := f_start_handler(refers(f_TC_dl_unitdata), testcasename(), g_pcu, g_sgsn, 2); |
| 820 | vc_conn.done; |
| 821 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 822 | |
| 823 | f_cleanup(); |
| 824 | } |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 825 | |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 826 | private function f_TC_ra_capability(charstring id) runs on BSSGP_ConnHdlr { |
| 827 | var integer i; |
| 828 | |
| 829 | for (i := 0; i < 10; i := i+1) { |
| 830 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP(g_pars.tlli, { ts_RaCapRec_BSSGP }); |
| 831 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 832 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP(g_pars.tlli, { tr_RaCapRec_BSSGP }) |
| 833 | |
Harald Welte | 22ef5d9 | 2020-11-16 13:35:14 +0100 | [diff] [blame] | 834 | f_sgsn2pcu(pdu_tx, pdu_rx); |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 835 | } |
| 836 | setverdict(pass); |
| 837 | } |
| 838 | testcase TC_ra_capability() runs on test_CT |
| 839 | { |
| 840 | var BSSGP_ConnHdlr vc_conn; |
| 841 | f_init(); |
| 842 | |
| 843 | vc_conn := f_start_handler(refers(f_TC_ra_capability), testcasename(), g_pcu, g_sgsn, 3); |
| 844 | vc_conn.done; |
| 845 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 846 | |
| 847 | f_cleanup(); |
| 848 | } |
| 849 | |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 850 | private function f_TC_ra_capability_upd(charstring id) runs on BSSGP_ConnHdlr { |
| 851 | var integer i; |
| 852 | var OCT1 tag; |
| 853 | for (i := 0; i < 10; i := i+1) { |
| 854 | tag := int2oct(23 + i, 1); |
| 855 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP_UPD(g_pars.tlli, tag); |
| 856 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 857 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP_UPD(g_pars.tlli, tag) |
| 858 | |
| 859 | f_pcu2sgsn(pdu_tx, pdu_rx); |
| 860 | |
| 861 | pdu_tx := ts_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O); |
| 862 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 863 | pdu_rx := tr_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O) |
| 864 | |
| 865 | f_sgsn2pcu(pdu_tx, pdu_rx); |
| 866 | } |
| 867 | setverdict(pass); |
| 868 | } |
| 869 | testcase TC_ra_capability_upd() runs on test_CT |
| 870 | { |
| 871 | var BSSGP_ConnHdlr vc_conn; |
| 872 | f_init(); |
| 873 | |
Daniel Willmann | 54833f2 | 2020-11-19 15:43:52 +0100 | [diff] [blame] | 874 | vc_conn := f_start_handler(refers(f_TC_ra_capability_upd), testcasename(), g_pcu, g_sgsn, 4); |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 875 | vc_conn.done; |
| 876 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 877 | |
| 878 | f_cleanup(); |
| 879 | } |
| 880 | |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 881 | private function f_TC_radio_status(charstring id) runs on BSSGP_ConnHdlr { |
| 882 | var integer i; |
| 883 | var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST; |
| 884 | for (i := 0; i < 10; i := i+1) { |
| 885 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(g_pars.tlli, cause); |
| 886 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 887 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(g_pars.tlli, cause) |
| 888 | |
| 889 | f_pcu2sgsn(pdu_tx, pdu_rx); |
| 890 | } |
| 891 | setverdict(pass); |
| 892 | } |
| 893 | testcase TC_radio_status() runs on test_CT |
| 894 | { |
| 895 | var BSSGP_ConnHdlr vc_conn; |
| 896 | f_init(); |
| 897 | |
Daniel Willmann | 54833f2 | 2020-11-19 15:43:52 +0100 | [diff] [blame] | 898 | vc_conn := f_start_handler(refers(f_TC_radio_status), testcasename(), g_pcu, g_sgsn, 5); |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 899 | vc_conn.done; |
| 900 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 901 | |
| 902 | f_cleanup(); |
| 903 | } |
| 904 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 905 | private function f_TC_suspend() runs on GlobalTest_CT { |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 906 | var integer i; |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 907 | |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 908 | /* TODO: Generate RA ID for each ConnHdlr */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 909 | var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id; |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 910 | for (i := 0; i < 10; i := i+1) { |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 911 | var OCT4 tlli := f_gprs_tlli_random(); |
| 912 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 913 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 914 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 915 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 916 | f_global_pcu2sgsn(pdu_tx, pdu_rx); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 917 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 918 | pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1)); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 919 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 920 | pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1)); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 921 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 922 | f_global_sgsn2pcu(pdu_tx, pdu_rx); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 923 | |
| 924 | /* These messages are simple passed through so just also test sending NACK */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 925 | pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 926 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 927 | pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 928 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 929 | f_global_sgsn2pcu(pdu_tx, pdu_rx); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 930 | } |
| 931 | setverdict(pass); |
| 932 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 933 | testcase TC_suspend() runs on GlobalTest_CT |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 934 | { |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 935 | f_init(); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 936 | f_global_init(); |
| 937 | f_TC_suspend(); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 938 | f_cleanup(); |
| 939 | } |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 940 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 941 | private function f_TC_resume() runs on GlobalTest_CT { |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 942 | var integer i; |
| 943 | |
| 944 | /* TODO: Generate RA ID for each ConnHdlr */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 945 | var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id; |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 946 | for (i := 0; i < 10; i := i+1) { |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 947 | var OCT4 tlli := f_gprs_tlli_random(); |
| 948 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1)); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 949 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 950 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1)); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 951 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 952 | f_global_pcu2sgsn(pdu_tx, pdu_rx); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 953 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 954 | pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 955 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 956 | pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 957 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 958 | f_global_sgsn2pcu(pdu_tx, pdu_rx); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 959 | |
| 960 | /* These messages are simple passed through so just also test sending NACK */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 961 | pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 962 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 963 | pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 964 | |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 965 | f_global_sgsn2pcu(pdu_tx, pdu_rx); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 966 | } |
| 967 | setverdict(pass); |
| 968 | } |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 969 | testcase TC_resume() runs on GlobalTest_CT |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 970 | { |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 971 | f_init(); |
Harald Welte | 3807ed1 | 2020-11-24 19:05:22 +0100 | [diff] [blame] | 972 | f_global_init(); |
| 973 | f_TC_resume(); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 974 | f_cleanup(); |
| 975 | } |
| 976 | |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 977 | /* test the load-sharing between multiple NS-VC on the BSS side */ |
| 978 | private function f_TC_dl_ud_unidir(charstring id) runs on BSSGP_ConnHdlr { |
| 979 | var integer i; |
| 980 | |
| 981 | for (i := 0; i < 10; i := i+1) { |
| 982 | var octetstring payload := f_rnd_octstring(i); |
| 983 | var template (value) PDU_BSSGP pdu_tx := |
| 984 | ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi)); |
| 985 | SGSN[0].send(pdu_tx); |
| 986 | } |
| 987 | setverdict(pass); |
| 988 | } |
| 989 | testcase TC_load_sharing_dl() runs on test_CT_NS |
| 990 | { |
| 991 | const integer num_ue := 10; |
| 992 | var BSSGP_ConnHdlr vc_conn[num_ue]; |
| 993 | f_init(); |
| 994 | |
| 995 | /* all BVC are now fully brought up. We disconnect BSSGP from NS on the BSS |
| 996 | * side so we get the raw NsUnitdataIndication and hence observe different |
| 997 | * NSVCI */ |
| 998 | disconnect(g_pcu[0].vc_NS:NS_SP, g_pcu[0].vc_BSSGP:BSCP); |
| 999 | connect(g_pcu[0].vc_NS:NS_SP, self:NS); |
| 1000 | |
| 1001 | /* there may still be some NS-VCs coming up? After all, the BVC-RESET succeeds after the first |
| 1002 | * of the NS-VC is ALIVE/UNBLOCKED */ |
| 1003 | f_sleep(3.0); |
| 1004 | |
| 1005 | /* start parallel components generating DL-UNITDATA from the SGSN side */ |
| 1006 | for (var integer i:= 0; i < num_ue; i := i+1) { |
| 1007 | vc_conn[i] := f_start_handler(refers(f_TC_dl_ud_unidir), testcasename(), g_pcu, g_sgsn, 5+i); |
| 1008 | } |
| 1009 | |
| 1010 | /* now start counting all the messages that were queued before */ |
| 1011 | /* TODO: We have a hard-coded assumption of 4 NS-VC in one NSE/NS-VCG here! */ |
| 1012 | var ro_integer rx_count := { 0, 0, 0, 0 }; |
| 1013 | timer T := 2.0; |
| 1014 | T.start; |
| 1015 | alt { |
| 1016 | [] as_NsUdiCount(0, rx_count); |
| 1017 | [] as_NsUdiCount(1, rx_count); |
| 1018 | [] as_NsUdiCount(2, rx_count); |
| 1019 | [] as_NsUdiCount(3, rx_count); |
| 1020 | [] NS.receive(NsUnitdataIndication:{0,?,?,*,*}) { repeat; } /* signaling BVC */ |
| 1021 | [] NS.receive(NsStatusIndication:?) { repeat; } |
| 1022 | [] NS.receive { |
| 1023 | setverdict(fail, "Rx unexpected NS"); |
| 1024 | mtc.stop; |
| 1025 | } |
| 1026 | [] T.timeout { |
| 1027 | } |
| 1028 | } |
| 1029 | for (var integer i := 0; i < lengthof(rx_count); i := i+1) { |
| 1030 | log("Rx on NSVCI ", mp_nsconfig_pcu[0].nsvc[i].nsvci, ": ", rx_count[i]); |
| 1031 | if (rx_count[i] == 0) { |
| 1032 | setverdict(fail, "Data not shared over all NSVC"); |
| 1033 | } |
| 1034 | } |
| 1035 | setverdict(pass); |
| 1036 | } |
| 1037 | private altstep as_NsUdiCount(integer nsvc_idx, inout ro_integer roi) runs on test_CT_NS { |
| 1038 | var NsUnitdataIndication udi; |
| 1039 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[0]; |
| 1040 | [] NS.receive(NsUnitdataIndication:{bvcc.bvci, g_pcu[0].cfg.nsei, mp_nsconfig_pcu[0].nsvc[nsvc_idx].nsvci, *, *}) -> value udi { |
| 1041 | roi[nsvc_idx] := roi[nsvc_idx] + 1; |
| 1042 | repeat; |
| 1043 | } |
| 1044 | } |
| 1045 | type component test_CT_NS extends test_CT { |
| 1046 | port NS_PT NS; |
| 1047 | }; |
| 1048 | |
| 1049 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1050 | /*********************************************************************** |
| 1051 | * PAGING PS procedure |
| 1052 | ***********************************************************************/ |
| 1053 | |
| 1054 | private function f_send_paging_ps(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1055 | boolean use_sig := false) |
| 1056 | runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP { |
| 1057 | var template (value) PDU_BSSGP pdu_tx; |
| 1058 | var template (present) PDU_BSSGP pdu_rx; |
| 1059 | /* we always specify '0' as BVCI in the templates below, as we override it with |
| 1060 | * 'p4' later anyway */ |
| 1061 | pdu_rx := tr_BSSGP_PS_PAGING(0); |
| 1062 | pdu_rx.pDU_BSSGP_PAGING_PS.iMSI := tr_BSSGP_IMSI(g_pars.imsi); |
| 1063 | if (ispresent(g_pars.p_tmsi)) { |
| 1064 | pdu_tx := ts_BSSGP_PS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi)); |
| 1065 | pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi)); |
| 1066 | } else { |
| 1067 | pdu_tx := ts_BSSGP_PS_PAGING_IMSI(0, g_pars.imsi); |
| 1068 | pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := omit; |
| 1069 | } |
| 1070 | pdu_tx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4; |
| 1071 | pdu_rx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4; |
| 1072 | if (use_sig == false) { |
| 1073 | SGSN[sgsn_idx].send(pdu_tx); |
| 1074 | } else { |
| 1075 | SGSN_SIG[sgsn_idx].send(pdu_tx); |
| 1076 | } |
| 1077 | return pdu_rx; |
| 1078 | } |
| 1079 | |
| 1080 | /* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on |
| 1081 | * specified PCU index */ |
| 1082 | private function f_send_paging_ps_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1083 | boolean use_sig := false,integer pcu_idx := 0) |
| 1084 | runs on BSSGP_ConnHdlr { |
| 1085 | var template (present) PDU_BSSGP exp_rx; |
| 1086 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1087 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1088 | exp_rx := f_send_paging_ps(p4, sgsn_idx, use_sig); |
| 1089 | /* Expect paging to propagate to the one BSS addressed by the BVCI only */ |
| 1090 | timer T := 2.0; |
| 1091 | T.start; |
| 1092 | alt { |
| 1093 | [not use_sig] PCU[pcu_idx].receive(exp_rx) { |
| 1094 | setverdict(pass); |
| 1095 | repeat; |
| 1096 | } |
| 1097 | [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1098 | setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC"); |
| 1099 | } |
| 1100 | [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1101 | setverdict(pass); |
| 1102 | repeat; |
| 1103 | } |
| 1104 | [use_sig] PCU[pcu_idx].receive(exp_rx) { |
| 1105 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1106 | } |
| 1107 | [] any from PCU.receive(exp_rx) { |
| 1108 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1109 | } |
| 1110 | [] any from PCU_SIG.receive(exp_rx) { |
| 1111 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1112 | } |
| 1113 | [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1114 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1115 | } |
| 1116 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1117 | setverdict(fail, "Different Paging than expected on SIGNALING BVC"); |
| 1118 | } |
| 1119 | [] T.timeout; |
| 1120 | } |
| 1121 | } |
| 1122 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1123 | /* send a PS-PAGING but don't expect it to show up on any PTP or SIG BVC */ |
| 1124 | private function f_send_paging_ps_exp_no_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1125 | boolean use_sig := false) |
| 1126 | runs on BSSGP_ConnHdlr { |
| 1127 | var template (present) PDU_BSSGP exp_rx; |
| 1128 | exp_rx := f_send_paging_ps(p4, sgsn_idx, use_sig); |
| 1129 | /* Expect paging to propagate to no BSS */ |
| 1130 | timer T := 2.0; |
| 1131 | T.start; |
| 1132 | alt { |
| 1133 | [] any from PCU.receive(exp_rx) { |
| 1134 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1135 | } |
| 1136 | [] any from PCU_SIG.receive(exp_rx) { |
| 1137 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1138 | } |
| 1139 | [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1140 | setverdict(fail, "Different Paging received on PTP BVC"); |
| 1141 | } |
| 1142 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1143 | setverdict(fail, "Different Paging received on SIGNALING BVC"); |
| 1144 | } |
| 1145 | [] T.timeout { |
| 1146 | setverdict(pass); |
| 1147 | } |
| 1148 | } |
| 1149 | } |
| 1150 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1151 | private function f_TC_paging_ps_ptp_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1152 | { |
| 1153 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1154 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1155 | f_send_paging_ps_exp_one_bss(ts_BssgpP4BssArea, 0, false, 0); |
| 1156 | } |
| 1157 | testcase TC_paging_ps_ptp_bss() runs on test_CT { |
| 1158 | var BSSGP_ConnHdlr vc_conn; |
| 1159 | f_init(); |
| 1160 | |
| 1161 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_bss), testcasename(), g_pcu, g_sgsn, 9); |
| 1162 | vc_conn.done; |
| 1163 | |
| 1164 | f_cleanup(); |
| 1165 | } |
| 1166 | |
| 1167 | /* PS-PAGING on PTP-BVC for Location Area */ |
| 1168 | private function f_TC_paging_ps_ptp_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1169 | { |
| 1170 | var template (present) PDU_BSSGP exp_rx; |
| 1171 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1172 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1173 | f_send_paging_ps_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, false, 0); |
| 1174 | } |
| 1175 | testcase TC_paging_ps_ptp_lac() runs on test_CT { |
| 1176 | var BSSGP_ConnHdlr vc_conn; |
| 1177 | f_init(); |
| 1178 | |
| 1179 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_lac), testcasename(), g_pcu, g_sgsn, 10); |
| 1180 | vc_conn.done; |
| 1181 | |
| 1182 | f_cleanup(); |
| 1183 | } |
| 1184 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1185 | /* PS-PAGING on PTP-BVC for unknown Location Area */ |
| 1186 | private function f_TC_paging_ps_ptp_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1187 | { |
| 1188 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1189 | mcc_mnc := '567F99'H, |
| 1190 | lac := 33333 |
| 1191 | }; |
| 1192 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown LAC */ |
| 1193 | f_send_paging_ps_exp_one_bss(ts_BssgpP4LAC(unknown_la), 0, false, 0); |
| 1194 | } |
| 1195 | testcase TC_paging_ps_ptp_lac_unknown() runs on test_CT { |
| 1196 | var BSSGP_ConnHdlr vc_conn; |
| 1197 | f_init(); |
| 1198 | |
| 1199 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_lac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1200 | vc_conn.done; |
| 1201 | |
| 1202 | f_cleanup(); |
| 1203 | } |
| 1204 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1205 | /* PS-PAGING on PTP-BVC for Routeing Area */ |
| 1206 | private function f_TC_paging_ps_ptp_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1207 | { |
| 1208 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1209 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1210 | f_send_paging_ps_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, false, 0); |
| 1211 | } |
| 1212 | testcase TC_paging_ps_ptp_rac() runs on test_CT { |
| 1213 | var BSSGP_ConnHdlr vc_conn; |
| 1214 | f_init(); |
| 1215 | |
| 1216 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_rac), testcasename(), g_pcu, g_sgsn, 11); |
| 1217 | vc_conn.done; |
| 1218 | |
| 1219 | f_cleanup(); |
| 1220 | } |
| 1221 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1222 | /* PS-PAGING on PTP-BVC for unknown Routeing Area */ |
| 1223 | private function f_TC_paging_ps_ptp_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1224 | { |
| 1225 | var RoutingAreaIdentification unknown_ra := { |
| 1226 | lai := { |
| 1227 | mcc_mnc := '567F99'H, |
| 1228 | lac := 33333 |
| 1229 | }, |
| 1230 | rac := 254 |
| 1231 | }; |
| 1232 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown RAC */ |
| 1233 | f_send_paging_ps_exp_one_bss(ts_BssgpP4RAC(unknown_ra), 0, false, 0); |
| 1234 | } |
| 1235 | testcase TC_paging_ps_ptp_rac_unknown() runs on test_CT { |
| 1236 | var BSSGP_ConnHdlr vc_conn; |
| 1237 | f_init(); |
| 1238 | |
| 1239 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_rac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1240 | vc_conn.done; |
| 1241 | |
| 1242 | f_cleanup(); |
| 1243 | } |
| 1244 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1245 | /* PS-PAGING on PTP-BVC for BVCI (one cell) */ |
| 1246 | private function f_TC_paging_ps_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1247 | { |
| 1248 | /* this should be the normal case for MS in READY MM state after a lower layer failure */ |
| 1249 | f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, false, 0); |
| 1250 | } |
| 1251 | testcase TC_paging_ps_ptp_bvci() runs on test_CT { |
| 1252 | var BSSGP_ConnHdlr vc_conn; |
| 1253 | f_init(); |
| 1254 | |
| 1255 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_bvci), testcasename(), g_pcu, g_sgsn, 12); |
| 1256 | vc_conn.done; |
| 1257 | |
| 1258 | f_cleanup(); |
| 1259 | } |
| 1260 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1261 | /* PS-PAGING on PTP-BVC for unknown BVCI */ |
| 1262 | private function f_TC_paging_ps_ptp_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1263 | { |
| 1264 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown BVCI */ |
| 1265 | f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(33333), 0, false, 0); |
| 1266 | } |
| 1267 | testcase TC_paging_ps_ptp_bvci_unknown() runs on test_CT { |
| 1268 | var BSSGP_ConnHdlr vc_conn; |
| 1269 | f_init(); |
| 1270 | |
| 1271 | vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_bvci_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1272 | vc_conn.done; |
| 1273 | |
| 1274 | f_cleanup(); |
| 1275 | } |
| 1276 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1277 | /* altstep for expecting BSSGP PDU on signaling BVC of given pcu_idx + storing in 'roi' */ |
| 1278 | private altstep as_paging_sig_pcu(integer pcu_idx, template (present) PDU_BSSGP exp_rx, inout ro_integer roi) |
| 1279 | runs on BSSGP_ConnHdlr { |
| 1280 | [] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1281 | if (ro_integer_contains(roi, pcu_idx)) { |
| 1282 | setverdict(fail, "Received multiple paging on same SIG BVC"); |
| 1283 | } |
| 1284 | roi := roi & { pcu_idx }; |
| 1285 | repeat; |
| 1286 | } |
| 1287 | [] PCU[pcu_idx].receive(exp_rx) { |
| 1288 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1289 | } |
| 1290 | [] PCU_SIG[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1291 | setverdict(fail, "Different Paging than expected received SIGNALING BVC"); |
| 1292 | } |
| 1293 | [] PCU[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) { |
| 1294 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1295 | } |
| 1296 | } |
| 1297 | |
| 1298 | type record of default ro_default; |
| 1299 | |
| 1300 | /* send PS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */ |
| 1301 | private function f_send_paging_ps_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1302 | ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr |
| 1303 | { |
| 1304 | var template (present) PDU_BSSGP exp_rx; |
| 1305 | exp_rx := f_send_paging_ps(p4, 0, true); |
| 1306 | |
| 1307 | /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */ |
| 1308 | var ro_default defaults := {}; |
| 1309 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1310 | var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi)); |
| 1311 | defaults := defaults & { d }; |
| 1312 | } |
| 1313 | f_sleep(2.0); |
| 1314 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 1315 | deactivate(defaults[i]); |
| 1316 | } |
| 1317 | log("Paging received on PCU ", g_roi); |
| 1318 | |
| 1319 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1320 | var boolean rx_on_i := ro_integer_contains(g_roi, i); |
| 1321 | var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i); |
| 1322 | if (exp_on_i and not rx_on_i) { |
| 1323 | setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei); |
| 1324 | } |
| 1325 | if (not exp_on_i and rx_on_i) { |
| 1326 | setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei); |
| 1327 | } |
| 1328 | } |
| 1329 | setverdict(pass); |
| 1330 | } |
| 1331 | |
| 1332 | /* PS-PAGING on SIG-BVC for BSS Area */ |
| 1333 | private function f_TC_paging_ps_sig_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1334 | { |
| 1335 | /* we expect the paging to arrive on all three NSE */ |
| 1336 | f_send_paging_ps_exp_multi(ts_BssgpP4BssArea, 0, {0, 1, 2}); |
| 1337 | } |
| 1338 | testcase TC_paging_ps_sig_bss() runs on test_CT { |
| 1339 | var BSSGP_ConnHdlr vc_conn; |
| 1340 | f_init(); |
| 1341 | |
| 1342 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_bss), testcasename(), g_pcu, g_sgsn, 13); |
| 1343 | vc_conn.done; |
| 1344 | |
| 1345 | f_cleanup(); |
| 1346 | } |
| 1347 | |
| 1348 | /* PS-PAGING on SIG-BVC for Location Area */ |
| 1349 | private function f_TC_paging_ps_sig_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1350 | { |
| 1351 | /* Both PCU index 0 and 1 have a BVC within the LAC */ |
| 1352 | f_send_paging_ps_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, {0, 1}); |
| 1353 | } |
| 1354 | testcase TC_paging_ps_sig_lac() runs on test_CT { |
| 1355 | var BSSGP_ConnHdlr vc_conn; |
| 1356 | f_init(); |
| 1357 | |
| 1358 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_lac), testcasename(), g_pcu, g_sgsn, 14); |
| 1359 | vc_conn.done; |
| 1360 | |
| 1361 | f_cleanup(); |
| 1362 | } |
| 1363 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1364 | /* PS-PAGING on SIG-BVC for unknown Location Area */ |
| 1365 | private function f_TC_paging_ps_sig_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1366 | { |
| 1367 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1368 | mcc_mnc := '567F99'H, |
| 1369 | lac := 33333 |
| 1370 | }; |
| 1371 | f_send_paging_ps_exp_no_bss(ts_BssgpP4LAC(unknown_la), 0, true); |
| 1372 | } |
| 1373 | testcase TC_paging_ps_sig_lac_unknown() runs on test_CT { |
| 1374 | var BSSGP_ConnHdlr vc_conn; |
| 1375 | f_init(); |
| 1376 | |
| 1377 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_lac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1378 | vc_conn.done; |
| 1379 | |
| 1380 | f_cleanup(); |
| 1381 | } |
| 1382 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1383 | /* PS-PAGING on SIG-BVC for Routeing Area */ |
| 1384 | private function f_TC_paging_ps_sig_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1385 | { |
| 1386 | /* Only PCU index 0 has a matching BVC within the LAC */ |
| 1387 | f_send_paging_ps_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, {0}); |
| 1388 | } |
| 1389 | testcase TC_paging_ps_sig_rac() runs on test_CT { |
| 1390 | var BSSGP_ConnHdlr vc_conn; |
| 1391 | f_init(); |
| 1392 | |
| 1393 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_rac), testcasename(), g_pcu, g_sgsn, 15); |
| 1394 | vc_conn.done; |
| 1395 | |
| 1396 | f_cleanup(); |
| 1397 | } |
| 1398 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1399 | /* PS-PAGING on SIG-BVC for unknown Routeing Area */ |
| 1400 | private function f_TC_paging_ps_sig_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1401 | { |
| 1402 | var RoutingAreaIdentification unknown_ra := { |
| 1403 | lai := { |
| 1404 | mcc_mnc := '567F99'H, |
| 1405 | lac := 33333 |
| 1406 | }, |
| 1407 | rac := 254 |
| 1408 | }; |
| 1409 | f_send_paging_ps_exp_no_bss(ts_BssgpP4RAC(unknown_ra), 0, true); |
| 1410 | } |
| 1411 | testcase TC_paging_ps_sig_rac_unknown() runs on test_CT { |
| 1412 | var BSSGP_ConnHdlr vc_conn; |
| 1413 | f_init(); |
| 1414 | |
| 1415 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_rac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1416 | vc_conn.done; |
| 1417 | |
| 1418 | f_cleanup(); |
| 1419 | } |
| 1420 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1421 | /* PS-PAGING on SIG-BVC for BVCI (one cell) */ |
| 1422 | private function f_TC_paging_ps_sig_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1423 | { |
| 1424 | f_send_paging_ps_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, {0}); |
| 1425 | } |
| 1426 | testcase TC_paging_ps_sig_bvci() runs on test_CT { |
| 1427 | var BSSGP_ConnHdlr vc_conn; |
| 1428 | f_init(); |
| 1429 | |
| 1430 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_bvci), testcasename(), g_pcu, g_sgsn, 16); |
| 1431 | vc_conn.done; |
| 1432 | |
| 1433 | f_cleanup(); |
| 1434 | } |
| 1435 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1436 | /* PS-PAGING on SIG-BVC for unknown BVCI */ |
| 1437 | private function f_TC_paging_ps_sig_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1438 | { |
| 1439 | f_send_paging_ps_exp_no_bss(ts_BssgpP4Bvci(33333), 0, true); |
| 1440 | } |
| 1441 | testcase TC_paging_ps_sig_bvci_unknown() runs on test_CT { |
| 1442 | var BSSGP_ConnHdlr vc_conn; |
| 1443 | f_init(); |
| 1444 | |
| 1445 | vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_bvci_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1446 | vc_conn.done; |
| 1447 | |
| 1448 | f_cleanup(); |
| 1449 | } |
| 1450 | |
| 1451 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1452 | |
| 1453 | /*********************************************************************** |
| 1454 | * PAGING CS procedure |
| 1455 | ***********************************************************************/ |
| 1456 | |
| 1457 | private function f_send_paging_cs(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1458 | boolean use_sig := false) |
| 1459 | runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP { |
| 1460 | var template (value) PDU_BSSGP pdu_tx; |
| 1461 | var template (present) PDU_BSSGP pdu_rx; |
| 1462 | /* we always specify '0' as BVCI in the templates below, as we override it with |
| 1463 | * 'p4' later anyway */ |
| 1464 | pdu_rx := tr_BSSGP_CS_PAGING(0); |
| 1465 | pdu_rx.pDU_BSSGP_PAGING_CS.iMSI := tr_BSSGP_IMSI(g_pars.imsi); |
| 1466 | if (ispresent(g_pars.p_tmsi)) { |
| 1467 | pdu_tx := ts_BSSGP_CS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi)); |
| 1468 | pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi)); |
| 1469 | } else { |
| 1470 | pdu_tx := ts_BSSGP_CS_PAGING_IMSI(0, g_pars.imsi); |
| 1471 | pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := omit; |
| 1472 | } |
| 1473 | pdu_tx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4; |
| 1474 | pdu_rx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4; |
| 1475 | if (use_sig == false) { |
| 1476 | SGSN[sgsn_idx].send(pdu_tx); |
| 1477 | } else { |
| 1478 | SGSN_SIG[sgsn_idx].send(pdu_tx); |
| 1479 | } |
| 1480 | return pdu_rx; |
| 1481 | } |
| 1482 | |
| 1483 | /* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on |
| 1484 | * specified PCU index */ |
| 1485 | private function f_send_paging_cs_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1486 | boolean use_sig := false,integer pcu_idx := 0) |
| 1487 | runs on BSSGP_ConnHdlr { |
| 1488 | var template (present) PDU_BSSGP exp_rx; |
| 1489 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1490 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1491 | exp_rx := f_send_paging_cs(p4, sgsn_idx, use_sig); |
| 1492 | /* Expect paging to propagate to the one BSS addressed by the BVCI only */ |
| 1493 | timer T := 2.0; |
| 1494 | T.start; |
| 1495 | alt { |
| 1496 | [not use_sig] PCU[pcu_idx].receive(exp_rx) { |
| 1497 | setverdict(pass); |
| 1498 | repeat; |
| 1499 | } |
| 1500 | [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1501 | setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC"); |
| 1502 | } |
| 1503 | [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) { |
| 1504 | setverdict(pass); |
| 1505 | repeat; |
| 1506 | } |
| 1507 | [use_sig] PCU[pcu_idx].receive(exp_rx) { |
| 1508 | setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC"); |
| 1509 | } |
| 1510 | [] any from PCU.receive(exp_rx) { |
| 1511 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1512 | } |
| 1513 | [] any from PCU_SIG.receive(exp_rx) { |
| 1514 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1515 | } |
| 1516 | [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 1517 | setverdict(fail, "Different Paging than expected received PTP BVC"); |
| 1518 | } |
| 1519 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 1520 | setverdict(fail, "Different Paging than expected on SIGNALING BVC"); |
| 1521 | } |
| 1522 | [] T.timeout; |
| 1523 | } |
| 1524 | } |
| 1525 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1526 | /* send a CS-PAGING but don't expect it to show up on any PTP or SIG BVC */ |
| 1527 | private function f_send_paging_cs_exp_no_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1528 | boolean use_sig := false) |
| 1529 | runs on BSSGP_ConnHdlr { |
| 1530 | var template (present) PDU_BSSGP exp_rx; |
| 1531 | exp_rx := f_send_paging_cs(p4, sgsn_idx, use_sig); |
| 1532 | /* Expect paging to propagate to no BSS */ |
| 1533 | timer T := 2.0; |
| 1534 | T.start; |
| 1535 | alt { |
| 1536 | [] any from PCU.receive(exp_rx) { |
| 1537 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1538 | } |
| 1539 | [] any from PCU_SIG.receive(exp_rx) { |
| 1540 | setverdict(fail, "Paging received on unexpected BVC"); |
| 1541 | } |
| 1542 | [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 1543 | setverdict(fail, "Different Paging received on PTP BVC"); |
| 1544 | } |
| 1545 | [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) { |
| 1546 | setverdict(fail, "Different Paging received on SIGNALING BVC"); |
| 1547 | } |
| 1548 | [] T.timeout { |
| 1549 | setverdict(pass); |
| 1550 | } |
| 1551 | } |
| 1552 | } |
| 1553 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1554 | private function f_TC_paging_cs_ptp_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1555 | { |
| 1556 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1557 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1558 | f_send_paging_cs_exp_one_bss(ts_BssgpP4BssArea, 0, false, 0); |
| 1559 | } |
| 1560 | testcase TC_paging_cs_ptp_bss() runs on test_CT { |
| 1561 | var BSSGP_ConnHdlr vc_conn; |
| 1562 | f_init(); |
| 1563 | |
| 1564 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_bss), testcasename(), g_pcu, g_sgsn, 17); |
| 1565 | vc_conn.done; |
| 1566 | |
| 1567 | f_cleanup(); |
| 1568 | } |
| 1569 | |
| 1570 | /* CS-PAGING on PTP-BVC for Location Area */ |
| 1571 | private function f_TC_paging_cs_ptp_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1572 | { |
| 1573 | var template (present) PDU_BSSGP exp_rx; |
| 1574 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1575 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1576 | f_send_paging_cs_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, false, 0); |
| 1577 | } |
| 1578 | testcase TC_paging_cs_ptp_lac() runs on test_CT { |
| 1579 | var BSSGP_ConnHdlr vc_conn; |
| 1580 | f_init(); |
| 1581 | |
| 1582 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_lac), testcasename(), g_pcu, g_sgsn, 18); |
| 1583 | vc_conn.done; |
| 1584 | |
| 1585 | f_cleanup(); |
| 1586 | } |
| 1587 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1588 | /* CS-PAGING on PTP-BVC for unknown Location Area */ |
| 1589 | private function f_TC_paging_cs_ptp_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1590 | { |
| 1591 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1592 | mcc_mnc := '567F99'H, |
| 1593 | lac := 33333 |
| 1594 | }; |
| 1595 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown LAC */ |
| 1596 | f_send_paging_cs_exp_one_bss(ts_BssgpP4LAC(unknown_la), 0, false, 0); |
| 1597 | } |
| 1598 | testcase TC_paging_cs_ptp_lac_unknown() runs on test_CT { |
| 1599 | var BSSGP_ConnHdlr vc_conn; |
| 1600 | f_init(); |
| 1601 | |
| 1602 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_lac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1603 | vc_conn.done; |
| 1604 | |
| 1605 | f_cleanup(); |
| 1606 | } |
| 1607 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1608 | /* CS-PAGING on PTP-BVC for Routeing Area */ |
| 1609 | private function f_TC_paging_cs_ptp_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1610 | { |
| 1611 | /* doesn't really make sense: Sending to a single BVCI means the message ends up |
| 1612 | * at that BVC (cell) only, and paging all over the BSS area is not possible */ |
| 1613 | f_send_paging_cs_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, false, 0); |
| 1614 | } |
| 1615 | testcase TC_paging_cs_ptp_rac() runs on test_CT { |
| 1616 | var BSSGP_ConnHdlr vc_conn; |
| 1617 | f_init(); |
| 1618 | |
| 1619 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_rac), testcasename(), g_pcu, g_sgsn, 19); |
| 1620 | vc_conn.done; |
| 1621 | |
| 1622 | f_cleanup(); |
| 1623 | } |
| 1624 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1625 | /* CS-PAGING on PTP-BVC for unknown Routeing Area */ |
| 1626 | private function f_TC_paging_cs_ptp_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1627 | { |
| 1628 | var RoutingAreaIdentification unknown_ra := { |
| 1629 | lai := { |
| 1630 | mcc_mnc := '567F99'H, |
| 1631 | lac := 33333 |
| 1632 | }, |
| 1633 | rac := 254 |
| 1634 | }; |
| 1635 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown RAC */ |
| 1636 | f_send_paging_cs_exp_one_bss(ts_BssgpP4RAC(unknown_ra), 0, false, 0); |
| 1637 | } |
| 1638 | testcase TC_paging_cs_ptp_rac_unknown() runs on test_CT { |
| 1639 | var BSSGP_ConnHdlr vc_conn; |
| 1640 | f_init(); |
| 1641 | |
| 1642 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_rac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1643 | vc_conn.done; |
| 1644 | |
| 1645 | f_cleanup(); |
| 1646 | } |
| 1647 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1648 | /* CS-PAGING on PTP-BVC for BVCI (one cell) */ |
| 1649 | private function f_TC_paging_cs_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1650 | { |
| 1651 | /* this should be the normal case for MS in READY MM state after a lower layer failure */ |
| 1652 | f_send_paging_cs_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, false, 0); |
| 1653 | } |
| 1654 | testcase TC_paging_cs_ptp_bvci() runs on test_CT { |
| 1655 | var BSSGP_ConnHdlr vc_conn; |
| 1656 | f_init(); |
| 1657 | |
| 1658 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_bvci), testcasename(), g_pcu, g_sgsn, 20); |
| 1659 | vc_conn.done; |
| 1660 | |
| 1661 | f_cleanup(); |
| 1662 | } |
| 1663 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1664 | /* CS-PAGING on PTP-BVC for unknown BVCI */ |
| 1665 | private function f_TC_paging_cs_ptp_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1666 | { |
| 1667 | /* as it's sent on the PTP BVC, we expect it to pass even for unknown BVCI */ |
| 1668 | f_send_paging_cs_exp_one_bss(ts_BssgpP4Bvci(33333), 0, false, 0); |
| 1669 | } |
| 1670 | testcase TC_paging_cs_ptp_bvci_unknown() runs on test_CT { |
| 1671 | var BSSGP_ConnHdlr vc_conn; |
| 1672 | f_init(); |
| 1673 | |
| 1674 | vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_bvci_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1675 | vc_conn.done; |
| 1676 | |
| 1677 | f_cleanup(); |
| 1678 | } |
| 1679 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1680 | /* send CS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */ |
| 1681 | private function f_send_paging_cs_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0, |
| 1682 | ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr |
| 1683 | { |
| 1684 | var template (present) PDU_BSSGP exp_rx; |
| 1685 | exp_rx := f_send_paging_cs(p4, 0, true); |
| 1686 | |
| 1687 | /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */ |
| 1688 | var ro_default defaults := {}; |
| 1689 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1690 | var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi)); |
| 1691 | defaults := defaults & { d }; |
| 1692 | } |
| 1693 | f_sleep(2.0); |
| 1694 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 1695 | deactivate(defaults[i]); |
| 1696 | } |
| 1697 | log("Paging received on PCU ", g_roi); |
| 1698 | |
| 1699 | for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) { |
| 1700 | var boolean rx_on_i := ro_integer_contains(g_roi, i); |
| 1701 | var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i); |
| 1702 | if (exp_on_i and not rx_on_i) { |
| 1703 | setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei); |
| 1704 | } |
| 1705 | if (not exp_on_i and rx_on_i) { |
| 1706 | setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei); |
| 1707 | } |
| 1708 | } |
| 1709 | setverdict(pass); |
| 1710 | } |
| 1711 | |
| 1712 | /* CS-PAGING on SIG-BVC for BSS Area */ |
| 1713 | private function f_TC_paging_cs_sig_bss(charstring id) runs on BSSGP_ConnHdlr |
| 1714 | { |
| 1715 | /* we expect the paging to arrive on all three NSE */ |
| 1716 | f_send_paging_cs_exp_multi(ts_BssgpP4BssArea, 0, {0, 1, 2}); |
| 1717 | } |
| 1718 | testcase TC_paging_cs_sig_bss() runs on test_CT { |
| 1719 | var BSSGP_ConnHdlr vc_conn; |
| 1720 | f_init(); |
| 1721 | |
| 1722 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_bss), testcasename(), g_pcu, g_sgsn, 13); |
| 1723 | vc_conn.done; |
| 1724 | |
| 1725 | f_cleanup(); |
| 1726 | } |
| 1727 | |
| 1728 | /* CS-PAGING on SIG-BVC for Location Area */ |
| 1729 | private function f_TC_paging_cs_sig_lac(charstring id) runs on BSSGP_ConnHdlr |
| 1730 | { |
| 1731 | /* Both PCU index 0 and 1 have a BVC within the LAC */ |
| 1732 | f_send_paging_cs_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, {0, 1}); |
| 1733 | } |
| 1734 | testcase TC_paging_cs_sig_lac() runs on test_CT { |
| 1735 | var BSSGP_ConnHdlr vc_conn; |
| 1736 | f_init(); |
| 1737 | |
| 1738 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_lac), testcasename(), g_pcu, g_sgsn, 14); |
| 1739 | vc_conn.done; |
| 1740 | |
| 1741 | f_cleanup(); |
| 1742 | } |
| 1743 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1744 | /* CS-PAGING on SIG-BVC for unknown Location Area */ |
| 1745 | private function f_TC_paging_cs_sig_lac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1746 | { |
| 1747 | var GSM_Types.LocationAreaIdentification unknown_la := { |
| 1748 | mcc_mnc := '567F99'H, |
| 1749 | lac := 33333 |
| 1750 | }; |
| 1751 | f_send_paging_cs_exp_no_bss(ts_BssgpP4LAC(unknown_la), 0, true); |
| 1752 | } |
| 1753 | testcase TC_paging_cs_sig_lac_unknown() runs on test_CT { |
| 1754 | var BSSGP_ConnHdlr vc_conn; |
| 1755 | f_init(); |
| 1756 | |
| 1757 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_lac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1758 | vc_conn.done; |
| 1759 | |
| 1760 | f_cleanup(); |
| 1761 | } |
| 1762 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1763 | /* CS-PAGING on SIG-BVC for Routeing Area */ |
| 1764 | private function f_TC_paging_cs_sig_rac(charstring id) runs on BSSGP_ConnHdlr |
| 1765 | { |
| 1766 | /* Only PCU index 0 has a matching BVC within the LAC */ |
| 1767 | f_send_paging_cs_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, {0}); |
| 1768 | } |
| 1769 | testcase TC_paging_cs_sig_rac() runs on test_CT { |
| 1770 | var BSSGP_ConnHdlr vc_conn; |
| 1771 | f_init(); |
| 1772 | |
| 1773 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_rac), testcasename(), g_pcu, g_sgsn, 15); |
| 1774 | vc_conn.done; |
| 1775 | |
| 1776 | f_cleanup(); |
| 1777 | } |
| 1778 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1779 | /* CS-PAGING on SIG-BVC for unknown Routeing Area */ |
| 1780 | private function f_TC_paging_cs_sig_rac_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1781 | { |
| 1782 | var RoutingAreaIdentification unknown_ra := { |
| 1783 | lai := { |
| 1784 | mcc_mnc := '567F99'H, |
| 1785 | lac := 33333 |
| 1786 | }, |
| 1787 | rac := 254 |
| 1788 | }; |
| 1789 | f_send_paging_cs_exp_no_bss(ts_BssgpP4RAC(unknown_ra), 0, true); |
| 1790 | } |
| 1791 | testcase TC_paging_cs_sig_rac_unknown() runs on test_CT { |
| 1792 | var BSSGP_ConnHdlr vc_conn; |
| 1793 | f_init(); |
| 1794 | |
| 1795 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_rac_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1796 | vc_conn.done; |
| 1797 | |
| 1798 | f_cleanup(); |
| 1799 | } |
| 1800 | |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 1801 | /* CS-PAGING on SIG-BVC for BVCI (one cell) */ |
| 1802 | private function f_TC_paging_cs_sig_bvci(charstring id) runs on BSSGP_ConnHdlr |
| 1803 | { |
| 1804 | f_send_paging_cs_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, {0}); |
| 1805 | } |
| 1806 | testcase TC_paging_cs_sig_bvci() runs on test_CT { |
| 1807 | var BSSGP_ConnHdlr vc_conn; |
| 1808 | f_init(); |
| 1809 | |
| 1810 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_bvci), testcasename(), g_pcu, g_sgsn, 16); |
| 1811 | vc_conn.done; |
| 1812 | |
| 1813 | f_cleanup(); |
| 1814 | } |
| 1815 | |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 1816 | /* CS-PAGING on SIG-BVC for unknown BVCI */ |
| 1817 | private function f_TC_paging_cs_sig_bvci_unknown(charstring id) runs on BSSGP_ConnHdlr |
| 1818 | { |
| 1819 | f_send_paging_cs_exp_no_bss(ts_BssgpP4Bvci(33333), 0, true); |
| 1820 | } |
| 1821 | testcase TC_paging_cs_sig_bvci_unknown() runs on test_CT { |
| 1822 | var BSSGP_ConnHdlr vc_conn; |
| 1823 | f_init(); |
| 1824 | |
| 1825 | vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_bvci_unknown), testcasename(), g_pcu, g_sgsn, 11); |
| 1826 | vc_conn.done; |
| 1827 | |
| 1828 | f_cleanup(); |
| 1829 | } |
| 1830 | |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 1831 | private function f_TC_flush_ll(charstring id) runs on BSSGP_ConnHdlr { |
| 1832 | var BssgpBvci bvci := g_pars.pcu[0].cfg.bvc[0].bvci; |
| 1833 | var integer i; |
| 1834 | for (i := 0; i < 10; i := i+1) { |
| 1835 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_FLUSH_LL(g_pars.tlli, bvci, bvci_new := bvci); |
| 1836 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1837 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_FLUSH_LL(g_pars.tlli, bvci, bvci_new := bvci); |
| 1838 | |
| 1839 | f_sgsn2pcu(pdu_tx, pdu_rx, use_sig := true); |
| 1840 | |
| 1841 | pdu_tx := ts_BSSGP_FLUSH_LL_ACK(g_pars.tlli, int2oct(0, 1), 23, bvci_new := bvci); |
| 1842 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1843 | pdu_rx := tr_BSSGP_FLUSH_LL_ACK(g_pars.tlli, int2oct(0, 1), 23, bvci_new := bvci); |
| 1844 | |
| 1845 | f_pcu2sgsn(pdu_tx, pdu_rx, use_sig := true); |
| 1846 | } |
| 1847 | setverdict(pass); |
| 1848 | } |
| 1849 | testcase TC_flush_ll() runs on test_CT |
| 1850 | { |
| 1851 | var BSSGP_ConnHdlr vc_conn; |
| 1852 | f_init(); |
| 1853 | |
| 1854 | vc_conn := f_start_handler(refers(f_TC_flush_ll), testcasename(), g_pcu, g_sgsn, 6); |
| 1855 | vc_conn.done; |
| 1856 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 1857 | |
| 1858 | f_cleanup(); |
| 1859 | } |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 1860 | |
Harald Welte | f8e5c5d | 2020-11-27 22:37:23 +0100 | [diff] [blame] | 1861 | private altstep as_bssgp_g_pcu_count(integer pcu_idx, template (present) PDU_BSSGP exp_rx, inout ro_integer roi) |
| 1862 | runs on GlobalTest_CT { |
| 1863 | [] G_PCU[pcu_idx].receive(exp_rx) from g_pcu[pcu_idx].vc_BSSGP { |
| 1864 | if (ro_integer_contains(roi, pcu_idx)) { |
| 1865 | setverdict(fail, "Received multiple on same SIG BVC"); |
| 1866 | } |
| 1867 | roi := roi & { pcu_idx }; |
| 1868 | repeat; |
| 1869 | } |
| 1870 | } |
| 1871 | /* send a INVOKE-TRACE from SGSN and expect to receive a copy on each NSE */ |
| 1872 | testcase TC_trace() runs on GlobalTest_CT |
| 1873 | { |
| 1874 | var BSSGP_ConnHdlr vc_conn; |
| 1875 | f_init(); |
| 1876 | f_global_init(); |
| 1877 | |
| 1878 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_INVOKE_TRACE('23'O, '4321'O); |
| 1879 | var template (present) PDU_BSSGP exp_rx := ts_BSSGP_INVOKE_TRACE('23'O, '4321'O); |
| 1880 | |
| 1881 | var ro_default defaults := {}; |
| 1882 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 1883 | activate(as_bssgp_g_pcu_count(i, exp_rx, g_roi)); |
| 1884 | } |
| 1885 | G_SGSN[0].send(pdu_tx); |
| 1886 | f_sleep(2.0); |
| 1887 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 1888 | deactivate(defaults[i]); |
| 1889 | } |
| 1890 | |
| 1891 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 1892 | if (not ro_integer_contains(g_roi, i)) { |
| 1893 | setverdict(fail, "Failed to receive TRACE on PCU index ", i); |
| 1894 | } |
| 1895 | } |
| 1896 | setverdict(pass); |
| 1897 | |
| 1898 | f_cleanup(); |
| 1899 | } |
| 1900 | |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 1901 | private function f_TC_llc_discarded(charstring id) runs on BSSGP_ConnHdlr { |
| 1902 | var BssgpBvci bvci := g_pars.pcu[0].cfg.bvc[0].bvci; |
| 1903 | |
| 1904 | var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_LLC_DISCARDED(g_pars.tlli, 23, bvci, 2342); |
| 1905 | /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ |
| 1906 | var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_LLC_DISCARDED(g_pars.tlli, 23, bvci, 2342); |
| 1907 | |
| 1908 | f_pcu2sgsn(pdu_tx, pdu_rx, use_sig := true); |
| 1909 | |
| 1910 | setverdict(pass); |
| 1911 | } |
| 1912 | /* Send a LLC-DISCARDED from BSS side and expect it to show up on SGSN (SIG BVC) */ |
| 1913 | testcase TC_llc_discarded() runs on test_CT |
| 1914 | { |
| 1915 | var BSSGP_ConnHdlr vc_conn; |
| 1916 | f_init(); |
| 1917 | |
| 1918 | vc_conn := f_start_handler(refers(f_TC_llc_discarded), testcasename(), g_pcu, g_sgsn, 6); |
| 1919 | vc_conn.done; |
| 1920 | /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ |
| 1921 | |
| 1922 | f_cleanup(); |
| 1923 | } |
| 1924 | |
Harald Welte | f20af41 | 2020-11-28 16:11:11 +0100 | [diff] [blame] | 1925 | /* Send an OVERLOAD from SGSN side and expect it to show up on each PCU (SIG BVC) */ |
| 1926 | testcase TC_overload() runs on GlobalTest_CT |
| 1927 | { |
| 1928 | f_init(); |
| 1929 | f_global_init(); |
| 1930 | |
| 1931 | var template (value) PDU_BSSGP pdu_tx := ts_OVERLOAD('1'B); |
| 1932 | var template (present) PDU_BSSGP exp_rx := tr_OVERLOAD('1'B); |
| 1933 | |
| 1934 | var ro_default defaults := {}; |
| 1935 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 1936 | activate(as_bssgp_g_pcu_count(i, exp_rx, g_roi)); |
| 1937 | } |
| 1938 | G_SGSN[0].send(pdu_tx); |
| 1939 | f_sleep(2.0); |
| 1940 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 1941 | deactivate(defaults[i]); |
| 1942 | } |
| 1943 | |
| 1944 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 1945 | if (not ro_integer_contains(g_roi, i)) { |
| 1946 | setverdict(fail, "Failed to receive OVERLOAD on PCU index ", i); |
| 1947 | } |
| 1948 | } |
| 1949 | setverdict(pass); |
| 1950 | |
| 1951 | f_cleanup(); |
| 1952 | } |
| 1953 | |
Harald Welte | 239aa50 | 2020-11-24 23:14:20 +0100 | [diff] [blame] | 1954 | private function f_block_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 1955 | { |
| 1956 | var BSSGP_BVC_CT bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 1957 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 1958 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 1959 | |
| 1960 | SGSN_MGMT.clear; |
| 1961 | PCU_MGMT.clear; |
| 1962 | |
| 1963 | /* block the PTP BVC from the PCU side */ |
| 1964 | PCU_MGMT.send(BssgpBlockRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to bvc_ct; |
| 1965 | /* expect state on both PCU and SGSN side to change */ |
| 1966 | interleave { |
| 1967 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) from bvc_ct; |
| 1968 | [] SGSN_MGMT.receive(tr_BssgpStsInd(*, bvc_cfg.bvci, BVC_S_BLOCKED)); |
| 1969 | } |
| 1970 | setverdict(pass); |
| 1971 | } |
| 1972 | testcase TC_bvc_block_ptp() runs on test_CT |
| 1973 | { |
| 1974 | f_init(); |
| 1975 | f_sleep(1.0); |
| 1976 | f_block_ptp_bvc_from_pcu(0, 0); |
| 1977 | f_cleanup(); |
| 1978 | } |
| 1979 | |
| 1980 | private function f_unblock_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 1981 | { |
| 1982 | var BSSGP_BVC_CT bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 1983 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 1984 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 1985 | |
| 1986 | SGSN_MGMT.clear; |
| 1987 | PCU_MGMT.clear; |
| 1988 | |
| 1989 | /* block the PTP BVC from the PCU side */ |
| 1990 | PCU_MGMT.send(BssgpUnblockRequest:{}) to bvc_ct; |
| 1991 | /* expect state on both PCU and SGSN side to change */ |
| 1992 | interleave { |
| 1993 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_UNBLOCKED)) from bvc_ct; |
| 1994 | [] SGSN_MGMT.receive(tr_BssgpStsInd(*, bvc_cfg.bvci, BVC_S_UNBLOCKED)); |
| 1995 | } |
| 1996 | setverdict(pass); |
| 1997 | } |
| 1998 | testcase TC_bvc_unblock_ptp() runs on test_CT |
| 1999 | { |
| 2000 | f_init(); |
| 2001 | f_sleep(1.0); |
| 2002 | f_block_ptp_bvc_from_pcu(0, 0); |
| 2003 | f_sleep(1.0); |
| 2004 | f_unblock_ptp_bvc_from_pcu(0, 0); |
| 2005 | f_cleanup(); |
| 2006 | } |
| 2007 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2008 | private altstep as_ignore_status(BSSGP_BVC_MGMT_PT pt) { |
| 2009 | [] pt.receive(BssgpStatusIndication:?) { repeat; } |
| 2010 | } |
| 2011 | private function f_get_sgsn_bvc_ct(integer sgsn_idx, BssgpBvci bvci) runs on test_CT return BSSGP_BVC_CT { |
| 2012 | for (var integer i := 0; i < lengthof(g_sgsn[sgsn_idx].cfg.bvc); i := i+1) { |
| 2013 | if (g_sgsn[sgsn_idx].cfg.bvc[i].bvci == bvci) { |
| 2014 | return g_sgsn[sgsn_idx].vc_BSSGP_BVC[i]; |
| 2015 | } |
| 2016 | } |
| 2017 | return null; |
| 2018 | } |
| 2019 | private function f_reset_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2020 | { |
| 2021 | var BSSGP_BVC_CT pcu_bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2022 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2023 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 2024 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(0, bvc_cfg.bvci); |
| 2025 | var default d; |
| 2026 | |
| 2027 | SGSN_MGMT.clear; |
| 2028 | PCU_MGMT.clear; |
| 2029 | |
| 2030 | /* block the PTP BVC from the PCU side */ |
| 2031 | PCU_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to pcu_bvc_ct; |
| 2032 | /* expect state on both PCU and SGSN side to change */ |
| 2033 | d := activate(as_ignore_status(SGSN_MGMT)); |
| 2034 | interleave { |
| 2035 | [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) from pcu_bvc_ct; |
| 2036 | [] SGSN_MGMT.receive(BssgpResetIndication:{bvc_cfg.bvci}) from sgsn_bvc_ct; |
| 2037 | } |
| 2038 | deactivate(d); |
| 2039 | setverdict(pass); |
| 2040 | } |
| 2041 | /* Send a BVC-RESET for a PTP BVC from the BSS side: expect it to propagate */ |
| 2042 | testcase TC_bvc_reset_ptp_from_bss() runs on test_CT |
| 2043 | { |
| 2044 | f_init(); |
| 2045 | f_sleep(3.0); |
| 2046 | f_reset_ptp_bvc_from_pcu(0, 0); |
| 2047 | f_cleanup(); |
| 2048 | } |
| 2049 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2050 | private altstep as_count_bvc_block(integer sgsn_idx, BssgpBvci bvci, inout ro_integer roi) |
| 2051 | runs on test_CT { |
| 2052 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(sgsn_idx, bvci); |
| 2053 | [] SGSN_MGMT.receive(tr_BssgpStsInd(?, bvci, BVC_S_BLOCKED)) from sgsn_bvc_ct { |
| 2054 | roi := roi & { bvci }; |
| 2055 | } |
| 2056 | } |
| 2057 | /* reset the signaling BVC from one BSS; expect no signaling BVC reset on SGSN; but BVC-BLOCK for PTP */ |
| 2058 | testcase TC_bvc_reset_sig_from_bss() runs on test_CT { |
| 2059 | |
| 2060 | f_init(); |
| 2061 | f_sleep(3.0); |
| 2062 | |
| 2063 | /* Start BVC-RESET procedure for BVCI=0 */ |
| 2064 | PCU_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to g_pcu[0].vc_BSSGP; |
| 2065 | |
| 2066 | /* Activate altsteps: One for each PTP BVC within that PCUs NSE */ |
| 2067 | var ro_default defaults := {}; |
| 2068 | for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { |
| 2069 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[i]; |
| 2070 | var default d := activate(as_count_bvc_block(0, bvcc.bvci, g_roi)); |
| 2071 | defaults := defaults & { d }; |
| 2072 | } |
| 2073 | |
| 2074 | timer T := 3.0; |
| 2075 | T.start; |
| 2076 | alt { |
| 2077 | [] SGSN_MGMT.receive(BssgpResetIndication:{0}) { |
| 2078 | setverdict(fail, "BSS-side Reset of BVCI=0 should not propagate"); |
| 2079 | } |
| 2080 | [] T.timeout; |
| 2081 | } |
| 2082 | |
| 2083 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2084 | deactivate(defaults[i]); |
| 2085 | } |
| 2086 | |
| 2087 | /* check if BVC-block was received on all expected BVC */ |
| 2088 | for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { |
| 2089 | var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[i]; |
| 2090 | if (not ro_integer_contains(g_roi, bvcc.bvci)) { |
| 2091 | setverdict(fail, "Missing SGSN-side BVC-BLOCK of BVCI=", bvcc.bvci); |
| 2092 | } |
| 2093 | } |
| 2094 | |
| 2095 | /* check if BVC-block was not received on any unexpected BVC is not required as |
| 2096 | * such a message would basically run into 'no matching clause' */ |
| 2097 | |
| 2098 | f_cleanup(); |
| 2099 | } |
| 2100 | |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2101 | private function f_reset_ptp_bvc_from_sgsn(integer pcu_idx, integer bvc_idx) runs on test_CT |
| 2102 | { |
| 2103 | var BSSGP_BVC_CT pcu_bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; |
| 2104 | var BssgpBvcConfig bvc_cfg := g_pcu[pcu_idx].cfg.bvc[bvc_idx]; |
| 2105 | var Nsei nsei_pcu := g_pcu[pcu_idx].cfg.nsei; |
| 2106 | var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(0, bvc_cfg.bvci); |
| 2107 | var default d; |
| 2108 | |
| 2109 | SGSN_MGMT.clear; |
| 2110 | PCU_MGMT.clear; |
| 2111 | |
| 2112 | /* block the PTP BVC from the PCU side */ |
| 2113 | SGSN_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to sgsn_bvc_ct; |
| 2114 | /* expect state on both PCU and SGSN side to change */ |
| 2115 | d := activate(as_ignore_status(PCU_MGMT)); |
| 2116 | interleave { |
| 2117 | [] SGSN_MGMT.receive(tr_BssgpStsInd(?, bvc_cfg.bvci, BVC_S_BLOCKED)) from sgsn_bvc_ct; |
| 2118 | [] PCU_MGMT.receive(BssgpResetIndication:{bvc_cfg.bvci}) from pcu_bvc_ct; |
| 2119 | } |
| 2120 | deactivate(d); |
| 2121 | setverdict(pass); |
| 2122 | } |
| 2123 | /* Send a BVC-RESET for a PTP BVC from the SGSN side: expect it to propagate */ |
| 2124 | testcase TC_bvc_reset_ptp_from_sgsn() runs on test_CT |
| 2125 | { |
| 2126 | f_init(); |
| 2127 | f_sleep(3.0); |
| 2128 | f_reset_ptp_bvc_from_sgsn(0, 0); |
| 2129 | f_cleanup(); |
| 2130 | } |
| 2131 | |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2132 | private altstep as_count_bvc0_block(integer pcu_idx, Nsei nsei, inout ro_integer roi) |
| 2133 | runs on test_CT { |
| 2134 | var BSSGP_CT pcu_ct := g_pcu[pcu_idx].vc_BSSGP; |
| 2135 | [] PCU_MGMT.receive(BssgpResetIndication:{0}) from pcu_ct { |
| 2136 | roi := roi & { nsei }; |
| 2137 | } |
| 2138 | } |
| 2139 | /* reset the signaling BVC from the SGSN; expect all signaling BVC on all BSS to be reset */ |
| 2140 | testcase TC_bvc_reset_sig_from_sgsn() runs on test_CT { |
| 2141 | |
| 2142 | f_init(); |
| 2143 | f_sleep(3.0); |
| 2144 | |
| 2145 | /* Start BVC-RESET procedure for BVCI=0 */ |
| 2146 | SGSN_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to g_sgsn[0].vc_BSSGP; |
| 2147 | |
| 2148 | /* Activate altsteps: One for each PCU NSE */ |
| 2149 | var ro_default defaults := {}; |
| 2150 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2151 | var NSConfiguration nscfg := mp_nsconfig_pcu[i]; |
| 2152 | var default d := activate(as_count_bvc0_block(i, nscfg.nsei, g_roi)); |
| 2153 | defaults := defaults & { d }; |
| 2154 | } |
| 2155 | |
| 2156 | f_sleep(3.0); |
| 2157 | |
| 2158 | for (var integer i := 0; i < lengthof(defaults); i := i+1) { |
| 2159 | deactivate(defaults[i]); |
| 2160 | } |
| 2161 | |
| 2162 | /* check if BVC-block was received on all expected BVC */ |
| 2163 | for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { |
| 2164 | var NSConfiguration nscfg := mp_nsconfig_pcu[i]; |
| 2165 | if (not ro_integer_contains(g_roi, nscfg.nsei)) { |
| 2166 | setverdict(fail, "Missing PCU-side BVC-RESET of BVCI=0 on PCU index ", i); |
| 2167 | } |
| 2168 | } |
| 2169 | |
| 2170 | /* check if BVC-block was not received on any unexpected BVC is not required as |
| 2171 | * such a message would basically run into 'no matching clause' */ |
| 2172 | |
| 2173 | f_cleanup(); |
| 2174 | } |
| 2175 | |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 2176 | control { |
| 2177 | execute( TC_BVC_bringup() ); |
Harald Welte | 9268601 | 2020-11-15 21:45:49 +0100 | [diff] [blame] | 2178 | execute( TC_ul_unitdata() ); |
Harald Welte | 78d8db9 | 2020-11-15 23:27:27 +0100 | [diff] [blame] | 2179 | execute( TC_dl_unitdata() ); |
Harald Welte | 6dc2ac4 | 2020-11-16 09:16:17 +0100 | [diff] [blame] | 2180 | execute( TC_ra_capability() ); |
Daniel Willmann | ace3ece | 2020-11-16 19:53:26 +0100 | [diff] [blame] | 2181 | execute( TC_ra_capability_upd() ); |
Daniel Willmann | 165d661 | 2020-11-19 14:27:29 +0100 | [diff] [blame] | 2182 | execute( TC_radio_status() ); |
Daniel Willmann | fa67f49 | 2020-11-19 15:48:05 +0100 | [diff] [blame] | 2183 | execute( TC_suspend() ); |
Daniel Willmann | 087a33d | 2020-11-19 15:58:43 +0100 | [diff] [blame] | 2184 | execute( TC_resume() ); |
Harald Welte | f8e5c5d | 2020-11-27 22:37:23 +0100 | [diff] [blame] | 2185 | execute( TC_trace() ); |
Harald Welte | c0351d1 | 2020-11-27 22:49:02 +0100 | [diff] [blame] | 2186 | execute( TC_llc_discarded() ); |
Harald Welte | f20af41 | 2020-11-28 16:11:11 +0100 | [diff] [blame] | 2187 | execute( TC_overload() ); |
Harald Welte | 239aa50 | 2020-11-24 23:14:20 +0100 | [diff] [blame] | 2188 | execute( TC_bvc_block_ptp() ); |
| 2189 | execute( TC_bvc_unblock_ptp() ); |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2190 | execute( TC_bvc_reset_ptp_from_bss() ); |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2191 | execute( TC_bvc_reset_sig_from_bss() ); |
Harald Welte | 60a8ec7 | 2020-11-25 17:12:53 +0100 | [diff] [blame] | 2192 | execute( TC_bvc_reset_ptp_from_sgsn() ); |
Harald Welte | 16786e9 | 2020-11-27 19:11:56 +0100 | [diff] [blame] | 2193 | execute( TC_bvc_reset_sig_from_sgsn() ); |
Harald Welte | f8ef028 | 2020-11-18 12:16:59 +0100 | [diff] [blame] | 2194 | if (false) { |
| 2195 | /* don't enable this by default, as we don't yet have any automatic test setup for FR with 4 NS-VC */ |
| 2196 | execute( TC_load_sharing_dl() ); |
| 2197 | } |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2198 | |
| 2199 | /* PAGING-PS over PTP BVC */ |
| 2200 | execute( TC_paging_ps_ptp_bss() ); |
| 2201 | execute( TC_paging_ps_ptp_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2202 | execute( TC_paging_ps_ptp_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2203 | execute( TC_paging_ps_ptp_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2204 | execute( TC_paging_ps_ptp_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2205 | execute( TC_paging_ps_ptp_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2206 | execute( TC_paging_ps_ptp_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2207 | |
| 2208 | /* PAGING-PS over SIG BVC */ |
| 2209 | execute( TC_paging_ps_sig_bss() ); |
| 2210 | execute( TC_paging_ps_sig_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2211 | execute( TC_paging_ps_sig_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2212 | execute( TC_paging_ps_sig_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2213 | execute( TC_paging_ps_sig_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2214 | execute( TC_paging_ps_sig_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2215 | execute( TC_paging_ps_sig_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2216 | |
| 2217 | /* PAGING-CS over PTP BVC */ |
| 2218 | execute( TC_paging_cs_ptp_bss() ); |
| 2219 | execute( TC_paging_cs_ptp_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2220 | execute( TC_paging_cs_ptp_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2221 | execute( TC_paging_cs_ptp_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2222 | execute( TC_paging_cs_ptp_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2223 | execute( TC_paging_cs_ptp_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2224 | execute( TC_paging_cs_ptp_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2225 | |
| 2226 | /* PAGING-CS over SIG BVC */ |
| 2227 | execute( TC_paging_cs_sig_bss() ); |
| 2228 | execute( TC_paging_cs_sig_lac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2229 | execute( TC_paging_cs_sig_lac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2230 | execute( TC_paging_cs_sig_rac() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2231 | execute( TC_paging_cs_sig_rac_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2232 | execute( TC_paging_cs_sig_bvci() ); |
Harald Welte | 7462a59 | 2020-11-23 22:07:07 +0100 | [diff] [blame] | 2233 | execute( TC_paging_cs_sig_bvci_unknown() ); |
Harald Welte | 0e18824 | 2020-11-22 21:46:48 +0100 | [diff] [blame] | 2234 | |
| 2235 | |
Daniel Willmann | 91a8e25b | 2020-11-24 14:50:59 +0100 | [diff] [blame] | 2236 | execute( TC_flush_ll() ); |
Daniel Willmann | 423d8f4 | 2020-09-08 18:58:22 +0200 | [diff] [blame] | 2237 | } |
| 2238 | |
| 2239 | |
| 2240 | } |