blob: 5e4555d65f54a42faccb0bf46b7b9a73a1cb6f0b [file] [log] [blame]
Daniel Willmann423d8f42020-09-08 18:58:22 +02001module 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
15import from General_Types all;
16import from Osmocom_Types all;
17import from GSM_Types all;
18import from Native_Functions all;
19import from NS_Types all;
20import from NS_Emulation all;
21import from BSSGP_Types all;
22import from BSSGP_Emulation all;
23import from SCCPasp_Types all;
24import from Osmocom_Gb_Types all;
25
26import from MobileL3_CommonIE_Types all;
27import from MobileL3_GMM_SM_Types all;
28import from MobileL3_Types all;
29import from L3_Templates all;
30import from L3_Common all;
31
32import from TELNETasp_PortType all;
33import from Osmocom_VTY_Functions all;
34
35import from LLC_Types all;
36import from LLC_Templates all;
37
38import from GSM_RR_Types all;
39
Harald Welte6d63f742020-11-15 19:44:04 +010040/* mcc_mnc is 24.008 10.5.5.15 encoded. 262 42 */
41const BcdMccMnc c_mcc_mnc := '262F42'H;
42
Daniel Willmann423d8f42020-09-08 18:58:22 +020043modulepar {
44 /* IP/port on which we run our internal GSUP/HLR emulation */
Harald Welte6d63f742020-11-15 19:44:04 +010045 NSConfigurations mp_nsconfig_sgsn := {
Daniel Willmann423d8f42020-09-08 18:58:22 +020046 {
Daniel Willmann423d8f42020-09-08 18:58:22 +020047 nsei := 101,
48 role_sgsn := true,
Harald Welte90f19742020-11-06 19:34:40 +010049 handle_sns := false,
50 nsvc := {
51 {
52 provider := {
53 ip := {
54 address_family := AF_INET,
55 local_udp_port := 7777,
56 local_ip := "127.0.0.1",
57 remote_udp_port := 23000,
58 remote_ip := "127.0.0.1"
59 }
60 },
61 nsvci := 101
62 }
63 }
Daniel Willmann423d8f42020-09-08 18:58:22 +020064 }
65 };
Harald Welte6d63f742020-11-15 19:44:04 +010066 NSConfigurations mp_nsconfig_pcu := {
Daniel Willmann423d8f42020-09-08 18:58:22 +020067 {
Daniel Willmann423d8f42020-09-08 18:58:22 +020068 nsei := 96,
69 role_sgsn := false,
Harald Welte90f19742020-11-06 19:34:40 +010070 handle_sns := false,
71 nsvc := {
72 {
73 provider := {
74 ip := {
75 address_family := AF_INET,
76 local_udp_port := 21010,
77 local_ip := "127.0.0.1",
78 remote_udp_port := 23000,
79 remote_ip := "127.0.0.1"
80 }
81 },
82 nsvci := 97
83 }
84 }
Daniel Willmann423d8f42020-09-08 18:58:22 +020085 },
86 {
Daniel Willmann423d8f42020-09-08 18:58:22 +020087 nsei := 97,
88 role_sgsn := false,
Harald Welte90f19742020-11-06 19:34:40 +010089 handle_sns := false,
90 nsvc := {
91 {
92 provider := {
93 ip := {
94 address_family := AF_INET,
95 local_udp_port := 21011,
96 local_ip := "127.0.0.1",
97 remote_udp_port := 23000,
98 remote_ip := "127.0.0.1"
99 }
100 },
101 nsvci := 98
102 }
103 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200104 },
105 {
Daniel Willmann423d8f42020-09-08 18:58:22 +0200106 nsei := 98,
107 role_sgsn := false,
Harald Welte90f19742020-11-06 19:34:40 +0100108 handle_sns := false,
109 nsvc := {
110 {
111 provider := {
112 ip := {
113 address_family := AF_INET,
114 local_udp_port := 21012,
115 local_ip := "127.0.0.1",
116 remote_udp_port := 23000,
117 remote_ip := "127.0.0.1"
118 }
119 },
120 nsvci := 99
121 }
122 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200123 }
124 };
Harald Welte6d63f742020-11-15 19:44:04 +0100125 BssgpConfigs mp_gbconfigs := {
126 {
127 nsei := 96,
128 sgsn_role := false,
129 bvc := {
130 {
131 bvci := 196,
132 cell_id := {
133 ra_id := {
134 lai := {
135 mcc_mnc := c_mcc_mnc,
136 lac := 13135
137 },
138 rac := 0
139 },
140 cell_id := 20960
141 },
142 depth := BSSGP_DECODE_DEPTH_BSSGP,
143 create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
144 }
145 }
146 }, {
147 nsei := 97,
148 sgsn_role := false,
149 bvc := {
150 {
151 bvci := 210,
152 cell_id := {
153 ra_id := {
154 lai := {
155 mcc_mnc := c_mcc_mnc,
Harald Welte0e188242020-11-22 21:46:48 +0100156 lac := 13135
Harald Welte6d63f742020-11-15 19:44:04 +0100157 },
Harald Welte0e188242020-11-22 21:46:48 +0100158 rac := 1
Harald Welte6d63f742020-11-15 19:44:04 +0100159 },
160 cell_id := 20961
161 },
162 depth := BSSGP_DECODE_DEPTH_BSSGP,
163 create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
164 }
165 }
166 }, {
167 nsei := 98,
168 sgsn_role := false,
169 bvc := {
170 {
171 bvci := 220,
172 cell_id := {
173 ra_id := {
174 lai := {
175 mcc_mnc := c_mcc_mnc,
176 lac := 13300
177 },
178 rac := 0
179 },
180 cell_id := 20962
181 },
182 depth := BSSGP_DECODE_DEPTH_BSSGP,
183 create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
184 }
185 }
186 }
187 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200188};
189
Daniel Willmann423d8f42020-09-08 18:58:22 +0200190type record GbInstance {
191 NS_CT vc_NS,
192 BSSGP_CT vc_BSSGP,
Harald Welte67dc8c22020-11-17 18:32:29 +0100193 BSSGP_BVC_CTs vc_BSSGP_BVC,
Daniel Willmann423d8f42020-09-08 18:58:22 +0200194 BssgpConfig cfg
195};
Harald Welte67dc8c22020-11-17 18:32:29 +0100196type record of BSSGP_BVC_CT BSSGP_BVC_CTs
Daniel Willmann423d8f42020-09-08 18:58:22 +0200197
198const integer NUM_PCU := 3;
Harald Welte6d63f742020-11-15 19:44:04 +0100199type record of GbInstance GbInstances;
200type record of BssgpConfig BssgpConfigs;
201type record of NSConfiguration NSConfigurations;
202type record of BssgpCellId BssgpCellIds;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200203
204const integer NUM_SGSN := 1;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200205
206type component test_CT {
Harald Welte6d63f742020-11-15 19:44:04 +0100207 var GbInstances g_pcu;
208 var GbInstances g_sgsn;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200209
210 port BSSGP_CT_PROC_PT PROC;
211
Harald Weltefbae83f2020-11-15 23:25:55 +0100212 port BSSGP_BVC_MGMT_PT SGSN_MGMT;
213 port BSSGP_BVC_MGMT_PT PCU_MGMT;
214
Daniel Willmann423d8f42020-09-08 18:58:22 +0200215 port TELNETasp_PT GBPVTY;
216
217 var boolean g_initialized := false;
218 var boolean g_use_echo := false;
219};
220
221type component BSSGP_ConnHdlr {
Harald Welte3dd21b32020-11-17 19:21:00 +0100222 /* array of per-BVC ports on the PCU side */
Daniel Willmann423d8f42020-09-08 18:58:22 +0200223 port BSSGP_PT PCU[NUM_PCU];
224 port BSSGP_PT PCU_SIG[NUM_PCU];
225 port BSSGP_PROC_PT PCU_PROC[NUM_PCU];
Harald Welte3dd21b32020-11-17 19:21:00 +0100226 /* component reference to the component to which we're currently connected */
227 var BSSGP_BVC_CT pcu_ct[NUM_PCU];
Harald Welte0e188242020-11-22 21:46:48 +0100228 /* BSSGP BVC configuration of the component to which we're currently connected */
229 var BssgpBvcConfig pcu_bvc_cfg[NUM_PCU];
Harald Welte3dd21b32020-11-17 19:21:00 +0100230
231 /* array of per-BVC ports on the SGSN side */
Daniel Willmann423d8f42020-09-08 18:58:22 +0200232 port BSSGP_PT SGSN[NUM_SGSN];
233 port BSSGP_PT SGSN_SIG[NUM_SGSN];
234 port BSSGP_PROC_PT SGSN_PROC[NUM_SGSN];
Harald Welte3dd21b32020-11-17 19:21:00 +0100235 /* component reference to the component to which we're currently connected */
236 var BSSGP_BVC_CT sgsn_ct[NUM_PCU];
Daniel Willmann423d8f42020-09-08 18:58:22 +0200237
238 var BSSGP_ConnHdlrPars g_pars;
239 timer g_Tguard;
240 var LLC_Entities llc;
Harald Welte0e188242020-11-22 21:46:48 +0100241
242 var ro_integer g_roi := {};
Daniel Willmann423d8f42020-09-08 18:58:22 +0200243}
244
245type record SGSN_ConnHdlrNetworkPars {
246 boolean expect_ptmsi,
247 boolean expect_auth,
248 boolean expect_ciph
249};
250
251type record BSSGP_ConnHdlrPars {
252 /* IMEI of the simulated ME */
253 hexstring imei,
254 /* IMSI of the simulated MS */
255 hexstring imsi,
256 /* MSISDN of the simulated MS (probably unused) */
257 hexstring msisdn,
258 /* P-TMSI allocated to the simulated MS */
259 OCT4 p_tmsi optional,
260 OCT3 p_tmsi_sig optional,
261 /* TLLI of the simulated MS */
262 OCT4 tlli,
263 OCT4 tlli_old optional,
264 RoutingAreaIdentificationV ra optional,
Harald Welte16357a92020-11-17 18:20:00 +0100265 GbInstances pcu,
Harald Welte3dd21b32020-11-17 19:21:00 +0100266 GbInstances sgsn,
Daniel Willmann423d8f42020-09-08 18:58:22 +0200267 float t_guard
268};
269
270private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdentificationV {
271 /* mcc_mnc is encoded as of 24.008 10.5.5.15 */
272 var BcdMccMnc mcc_mnc := cell_id.ra_id.lai.mcc_mnc;
273
274 var RoutingAreaIdentificationV ret := {
275 mccDigit1 := mcc_mnc[0],
276 mccDigit2 := mcc_mnc[1],
277 mccDigit3 := mcc_mnc[2],
278 mncDigit3 := mcc_mnc[3],
279 mncDigit1 := mcc_mnc[4],
280 mncDigit2 := mcc_mnc[5],
281 lac := int2oct(cell_id.ra_id.lai.lac, 16),
282 rac := int2oct(cell_id.ra_id.rac, 8)
283 }
284 return ret;
285};
286
287private function f_init_gb_pcu(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
Harald Welteb419d0e2020-11-16 16:45:05 +0100288 var charstring ns_id := id & "-NS(PCU[" & int2str(offset) & "])";
289 var charstring bssgp_id := id & "-BSSGP(PCU[" & int2str(offset) & "])";
290 gb.vc_NS := NS_CT.create(ns_id);
291 gb.vc_BSSGP := BSSGP_CT.create(bssgp_id);
Daniel Willmann423d8f42020-09-08 18:58:22 +0200292 /* connect lower end of BSSGP emulation with NS upper port */
293 connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
294
Harald Welteb419d0e2020-11-16 16:45:05 +0100295 gb.vc_NS.start(NSStart(mp_nsconfig_pcu[offset], ns_id));
296 gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id));
Daniel Willmann423d8f42020-09-08 18:58:22 +0200297
298 for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) {
299 connect(self:PROC, gb.vc_BSSGP:PROC);
300 gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC);
301 disconnect(self:PROC, gb.vc_BSSGP:PROC);
Harald Weltefbae83f2020-11-15 23:25:55 +0100302 connect(self:PCU_MGMT, gb.vc_BSSGP_BVC[i]:MGMT);
Daniel Willmann423d8f42020-09-08 18:58:22 +0200303 }
304}
305
306private function f_init_gb_sgsn(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
Harald Welteb419d0e2020-11-16 16:45:05 +0100307 var charstring ns_id := id & "-NS(SGSN[" & int2str(offset) & "])";
308 var charstring bssgp_id := id & "-BSSGP(SGSN[" & int2str(offset) & "])";
309 gb.vc_NS := NS_CT.create(ns_id);
310 gb.vc_BSSGP := BSSGP_CT.create(bssgp_id);
Daniel Willmann423d8f42020-09-08 18:58:22 +0200311 /* connect lower end of BSSGP emulation with NS upper port */
312 connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
313
Harald Welteb419d0e2020-11-16 16:45:05 +0100314 gb.vc_NS.start(NSStart(mp_nsconfig_sgsn[offset], ns_id));
315 gb.vc_BSSGP.start(BssgpStart(gb.cfg, bssgp_id));
Daniel Willmann423d8f42020-09-08 18:58:22 +0200316
317 for (var integer i := 0; i < lengthof(gb.cfg.bvc); i := i + 1) {
318 connect(self:PROC, gb.vc_BSSGP:PROC);
319 gb.vc_BSSGP_BVC[i] := f_bssgp_get_bvci_ct(gb.cfg.bvc[i].bvci, PROC);
320 disconnect(self:PROC, gb.vc_BSSGP:PROC);
Harald Weltefbae83f2020-11-15 23:25:55 +0100321 connect(self:SGSN_MGMT, gb.vc_BSSGP_BVC[i]:MGMT);
Daniel Willmann423d8f42020-09-08 18:58:22 +0200322 }
323}
324
325
326private function f_init_vty() runs on test_CT {
327 map(self:GBPVTY, system:GBPVTY);
328 f_vty_set_prompts(GBPVTY);
329 f_vty_transceive(GBPVTY, "enable");
330}
331
Harald Weltefbae83f2020-11-15 23:25:55 +0100332type record of integer ro_integer;
333
334private function ro_integer_contains(ro_integer r, integer x) return boolean {
335 for (var integer j := 0; j < lengthof(r); j := j+1) {
336 if (r[j] == x) {
337 return true;
338 }
339 }
340 return false;
341}
342
Harald Welte6d63f742020-11-15 19:44:04 +0100343function f_init() runs on test_CT {
Harald Weltefbae83f2020-11-15 23:25:55 +0100344 var ro_integer bvci_unblocked := {};
345 var BssgpStatusIndication bsi;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200346 var integer i;
347
348 if (g_initialized == true) {
349 return;
350 }
351 g_initialized := true;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200352
353 g_sgsn[0].cfg := {
Harald Welte6d63f742020-11-15 19:44:04 +0100354 nsei := mp_nsconfig_sgsn[0].nsei,
Daniel Willmann423d8f42020-09-08 18:58:22 +0200355 sgsn_role := true,
Harald Welte6d63f742020-11-15 19:44:04 +0100356 bvc := { }
357 }
358 for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) {
359 g_pcu[i].cfg := mp_gbconfigs[i];
360 /* concatenate all the PCU-side BVCs for the SGSN side */
361 g_sgsn[0].cfg.bvc := g_sgsn[0].cfg.bvc & mp_gbconfigs[i].bvc;
362 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200363
364 f_init_vty();
Harald Welte6d63f742020-11-15 19:44:04 +0100365 for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
Daniel Willmann443fc572020-11-18 13:26:57 +0100366 f_vty_transceive(GBPVTY, "nsvc nsei " & int2str(g_sgsn[i].cfg.nsei) & " force-unconfigured");
Harald Welteea1ba592020-11-17 18:05:13 +0100367 f_init_gb_sgsn(g_sgsn[i], "GbProxy_Test", i);
Harald Welte6d63f742020-11-15 19:44:04 +0100368 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200369 f_sleep(4.0);
Harald Welte6d63f742020-11-15 19:44:04 +0100370 for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
Harald Welteb419d0e2020-11-16 16:45:05 +0100371 f_init_gb_pcu(g_pcu[i], "GbProxy_Test", i);
Harald Welte6d63f742020-11-15 19:44:04 +0100372 }
Harald Weltefbae83f2020-11-15 23:25:55 +0100373
374 /* wait until all BVC are unblocked on both sides */
Harald Welted2801272020-11-17 19:22:58 +0100375 timer T := 15.0;
Harald Weltefbae83f2020-11-15 23:25:55 +0100376 T.start;
377 alt {
378 [] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi {
379 bvci_unblocked := bvci_unblocked & { bsi.bvci };
380 if (lengthof(bvci_unblocked) != lengthof(g_sgsn[0].cfg.bvc)) {
381 repeat;
382 }
383 }
384 [] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) {
385 repeat;
386 }
387 [] SGSN_MGMT.receive {
388 setverdict(fail, "Received unexpected message on SGSN_MGMT");
389 mtc.stop;
390 }
391
392 [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi {
393 repeat;
394 }
395 [] PCU_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) {
396 repeat;
397 }
398 [] PCU_MGMT.receive(BssgpResetIndication:{0}) {
399 repeat;
400 }
401 [] PCU_MGMT.receive {
402 setverdict(fail, "Received unexpected message on PCU_MGMT");
403 mtc.stop;
404 }
405
406 [] T.timeout {
407 setverdict(fail, "Timeout waiting for unblock of all BVCs");
408 mtc.stop;
409 }
410 }
411
412 /* iterate over list and check all BVCI */
413 for (i := 0; i < lengthof(g_sgsn[0].cfg.bvc); i := i+1) {
414 var BssgpBvci bvci := g_sgsn[0].cfg.bvc[i].bvci;
415 if (not ro_integer_contains(bvci_unblocked, bvci)) {
416 setverdict(fail, "BVCI=", bvci, " was not unblocked during start-up");
417 mtc.stop;
418 }
419 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200420}
421
422function f_cleanup() runs on test_CT {
423 self.stop;
424}
425
426type function void_fn(charstring id) runs on BSSGP_ConnHdlr;
427
428/* helper function to create, connect and start a BSSGP_ConnHdlr component */
Harald Welte6d63f742020-11-15 19:44:04 +0100429function f_start_handler(void_fn fn, charstring id, GbInstances pcu, GbInstances sgsn, integer imsi_suffix,
Daniel Willmann423d8f42020-09-08 18:58:22 +0200430 float t_guard := 30.0)
431runs on test_CT return BSSGP_ConnHdlr {
432 var BSSGP_ConnHdlr vc_conn;
433
434 var BSSGP_ConnHdlrPars pars := {
435 imei := f_gen_imei(imsi_suffix),
436 imsi := f_gen_imsi(imsi_suffix),
437 msisdn := f_gen_msisdn(imsi_suffix),
438 p_tmsi := omit,
439 p_tmsi_sig := omit,
440 tlli := f_gprs_tlli_random(),
441 tlli_old := omit,
442 ra := omit,
Harald Welte16357a92020-11-17 18:20:00 +0100443 pcu := g_pcu,
Harald Welte3dd21b32020-11-17 19:21:00 +0100444 sgsn := g_sgsn,
Daniel Willmann423d8f42020-09-08 18:58:22 +0200445 t_guard := t_guard
446 };
447
448 vc_conn := BSSGP_ConnHdlr.create(id);
Daniel Willmann423d8f42020-09-08 18:58:22 +0200449
450 vc_conn.start(f_handler_init(fn, id, pars));
451 return vc_conn;
452}
453
Harald Welte3dd21b32020-11-17 19:21:00 +0100454/* Connect the PCU-side per-BVC ports (PCU/PCU_SIG/PCU_PROC) array slot 'port_idx' to specified per-BVC component */
Harald Welte0e188242020-11-22 21:46:48 +0100455private function f_connect_to_pcu_bvc(integer port_idx, integer nse_idx, integer bvc_idx)
456runs on BSSGP_ConnHdlr {
457 var BSSGP_BVC_CT bvc_ct := g_pars.pcu[nse_idx].vc_BSSGP_BVC[bvc_idx]
Harald Welte3dd21b32020-11-17 19:21:00 +0100458 if (PCU[port_idx].checkstate("Connected")) {
459 /* unregister + disconnect from old BVC */
460 f_client_unregister(g_pars.imsi, PCU_PROC[port_idx]);
461 disconnect(self:PCU[port_idx], pcu_ct[port_idx]:BSSGP_SP);
462 disconnect(self:PCU_SIG[port_idx], pcu_ct[port_idx]:BSSGP_SP_SIG);
463 disconnect(self:PCU_PROC[port_idx], pcu_ct[port_idx]:BSSGP_PROC);
464 }
465 /* connect to new BVC and register us */
466 connect(self:PCU[port_idx], bvc_ct:BSSGP_SP);
467 connect(self:PCU_SIG[port_idx], bvc_ct:BSSGP_SP_SIG);
468 connect(self:PCU_PROC[port_idx], bvc_ct:BSSGP_PROC);
469 f_client_register(g_pars.imsi, g_pars.tlli, PCU_PROC[port_idx]);
470 pcu_ct[port_idx] := bvc_ct;
Harald Welte0e188242020-11-22 21:46:48 +0100471 pcu_bvc_cfg[port_idx] := g_pars.pcu[nse_idx].cfg.bvc[bvc_idx];
Harald Welte3dd21b32020-11-17 19:21:00 +0100472}
473
474/* Connect the SGSN-side per-BVC ports (SGSN/SGSN_SIG/SGSN_PROC) array slot 'port_idx' to specified per-BVC component */
475private function f_connect_to_sgsn_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) runs on BSSGP_ConnHdlr {
476 if (SGSN[port_idx].checkstate("Connected")) {
477 /* unregister + disconnect from old BVC */
478 f_client_unregister(g_pars.imsi, SGSN_PROC[port_idx]);
479 disconnect(self:SGSN[port_idx], sgsn_ct[port_idx]:BSSGP_SP);
480 disconnect(self:SGSN_SIG[port_idx], sgsn_ct[port_idx]:BSSGP_SP_SIG);
481 disconnect(self:SGSN_PROC[port_idx], sgsn_ct[port_idx]:BSSGP_PROC);
482 }
483 /* connect to new BVC and register us */
484 connect(self:SGSN[port_idx], bvc_ct:BSSGP_SP);
485 connect(self:SGSN_SIG[port_idx], bvc_ct:BSSGP_SP_SIG);
486 connect(self:SGSN_PROC[port_idx], bvc_ct:BSSGP_PROC);
487 f_client_register(g_pars.imsi, g_pars.tlli, SGSN_PROC[port_idx]);
488 sgsn_ct[port_idx] := bvc_ct;
489}
490
Daniel Willmann423d8f42020-09-08 18:58:22 +0200491private altstep as_Tguard() runs on BSSGP_ConnHdlr {
492 [] g_Tguard.timeout {
493 setverdict(fail, "Tguard timeout");
494 mtc.stop;
495 }
496}
497
498/* first function called in every ConnHdlr */
499private function f_handler_init(void_fn fn, charstring id, BSSGP_ConnHdlrPars pars)
500runs on BSSGP_ConnHdlr {
Harald Welte1e834f32020-11-15 20:02:59 +0100501 var integer i;
Daniel Willmann423d8f42020-09-08 18:58:22 +0200502 /* do some common stuff like setting up g_pars */
503 g_pars := pars;
504
505 llc := f_llc_create(false);
506
Harald Welte3dd21b32020-11-17 19:21:00 +0100507 /* default connections on PCU side: First BVC of each NSE/PCU */
508 for (i := 0; i < lengthof(g_pars.pcu); i := i+1) {
Harald Welte0e188242020-11-22 21:46:48 +0100509 f_connect_to_pcu_bvc(port_idx := i, nse_idx := i, bvc_idx := 0);
Harald Welte1e834f32020-11-15 20:02:59 +0100510 }
Harald Welte3dd21b32020-11-17 19:21:00 +0100511
512 /* default connections on SGSN side: First BVC of each NSE/SGSN */
513 for (i := 0; i < lengthof(g_pars.sgsn); i := i+1) {
514 f_connect_to_sgsn_bvc(i, g_pars.sgsn[i].vc_BSSGP_BVC[0]);
Harald Welte1e834f32020-11-15 20:02:59 +0100515 }
Daniel Willmann423d8f42020-09-08 18:58:22 +0200516
517 g_Tguard.start(pars.t_guard);
518 activate(as_Tguard());
519
520 /* call the user-supplied test case function */
521 fn.apply(id);
522}
523
Harald Welte1e834f32020-11-15 20:02:59 +0100524private function f_client_register(hexstring imsi, OCT4 tlli, BSSGP_PROC_PT PT)
525runs on BSSGP_ConnHdlr {
526 PT.call(BSSGP_register_client:{imsi, tlli}) {
527 [] PT.getreply(BSSGP_register_client:{imsi, tlli}) {};
528 }
529}
530
531private function f_client_unregister(hexstring imsi, BSSGP_PROC_PT PT)
532runs on BSSGP_ConnHdlr {
533 PT.call(BSSGP_unregister_client:{imsi}) {
534 [] PT.getreply(BSSGP_unregister_client:{imsi}) {};
535 }
536}
537
Harald Welte22ef5d92020-11-16 13:35:14 +0100538/* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */
539friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
540 integer pcu_idx := 0, integer sgsn_idx := 0) runs on BSSGP_ConnHdlr {
541 var PDU_BSSGP rx;
542 timer T := 1.0;
543
544 PCU[pcu_idx].send(tx);
545 T.start;
546 alt {
547 [] SGSN[sgsn_idx].receive(exp_rx) {
548 setverdict(pass);
549 }
550 [] SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx {
551 setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx);
552 mtc.stop;
553 }
554 [] T.timeout {
555 setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", rx);
556 mtc.stop;
557 }
558 }
559}
560
561/* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */
562friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
563 integer sgsn_idx:= 0, integer pcu_idx := 0) runs on BSSGP_ConnHdlr {
564 var PDU_BSSGP rx;
565 timer T := 1.0;
566
567 SGSN[sgsn_idx].send(tx);
568 T.start;
569 alt {
570 [] PCU[pcu_idx].receive(exp_rx) {
571 setverdict(pass);
572 }
573 [] PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx {
574 setverdict(fail, "Unexpected BSSGP on PCU side: ", rx);
575 mtc.stop;
576 }
577 [] T.timeout {
578 setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", rx);
579 mtc.stop;
580 }
581 }
582}
Harald Welte1e834f32020-11-15 20:02:59 +0100583
Daniel Willmann423d8f42020-09-08 18:58:22 +0200584/* TODO:
585 * Detach without Attach
586 * SM procedures without attach / RAU
587 * ATTACH / RAU
588 ** with / without authentication
589 ** with / without P-TMSI allocation
590 * re-transmissions of LLC frames
591 * PDP Context activation
592 ** with different GGSN config in SGSN VTY
593 ** with different PDP context type (v4/v6/v46)
594 ** timeout from GGSN
595 ** multiple / secondary PDP context
596 */
597
598private function f_TC_BVC_bringup(charstring id) runs on BSSGP_ConnHdlr {
599 f_sleep(5.0);
600 setverdict(pass);
601}
602
603testcase TC_BVC_bringup() runs on test_CT {
604 var BSSGP_ConnHdlr vc_conn;
605 f_init();
606
607 vc_conn := f_start_handler(refers(f_TC_BVC_bringup), testcasename(), g_pcu, g_sgsn, 51);
608 vc_conn.done;
609
610 f_cleanup();
611}
612
613friend function f_bssgp_suspend(integer ran_idx := 0) runs on BSSGP_ConnHdlr return OCT1 {
Harald Welte16357a92020-11-17 18:20:00 +0100614 var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0];
Daniel Willmann423d8f42020-09-08 18:58:22 +0200615 timer T := 5.0;
616 var PDU_BSSGP rx_pdu;
Harald Welte16357a92020-11-17 18:20:00 +0100617 PCU_SIG[ran_idx].send(ts_BSSGP_SUSPEND(g_pars.tlli, bvcc.cell_id.ra_id));
Daniel Willmann423d8f42020-09-08 18:58:22 +0200618 T.start;
619 alt {
Harald Welte16357a92020-11-17 18:20:00 +0100620 [] PCU_SIG[ran_idx].receive(tr_BSSGP_SUSPEND_ACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) -> value rx_pdu {
Daniel Willmann423d8f42020-09-08 18:58:22 +0200621 return rx_pdu.pDU_BSSGP_SUSPEND_ACK.suspend_Reference_Number.suspend_Reference_Number_value;
622 }
Harald Welte16357a92020-11-17 18:20:00 +0100623 [] PCU_SIG[ran_idx].receive(tr_BSSGP_SUSPEND_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) -> value rx_pdu {
Daniel Willmann423d8f42020-09-08 18:58:22 +0200624 setverdict(fail, "SUSPEND-NACK in response to SUSPEND for TLLI ", g_pars.tlli);
625 mtc.stop;
626 }
627 [] T.timeout {
628 setverdict(fail, "No SUSPEND-ACK in response to SUSPEND for TLLI ", g_pars.tlli);
629 mtc.stop;
630 }
631 }
632 return '00'O;
633}
634
635friend function f_bssgp_resume(OCT1 susp_ref, integer ran_idx := 0) runs on BSSGP_ConnHdlr {
Harald Welte16357a92020-11-17 18:20:00 +0100636 var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0];
Daniel Willmann423d8f42020-09-08 18:58:22 +0200637 timer T := 5.0;
Harald Welte16357a92020-11-17 18:20:00 +0100638 PCU_SIG[ran_idx].send(ts_BSSGP_RESUME(g_pars.tlli, bvcc.cell_id.ra_id, susp_ref));
Daniel Willmann423d8f42020-09-08 18:58:22 +0200639 T.start;
640 alt {
Harald Welte16357a92020-11-17 18:20:00 +0100641 [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_ACK(g_pars.tlli, bvcc.cell_id.ra_id));
642 [] PCU_SIG[ran_idx].receive(tr_BSSGP_RESUME_NACK(g_pars.tlli, bvcc.cell_id.ra_id, ?)) {
Daniel Willmann423d8f42020-09-08 18:58:22 +0200643 setverdict(fail, "RESUME-NACK in response to RESUME for TLLI ", g_pars.tlli);
644 mtc.stop;
645 }
646 [] T.timeout {
647 setverdict(fail, "No RESUME-ACK in response to SUSPEND for TLLI ", g_pars.tlli);
648 mtc.stop;
649 }
650 }
651}
652
653
Harald Welte92686012020-11-15 21:45:49 +0100654/* send uplink-unitdata of a variety of different sizes; expect it to show up on SGSN */
655private function f_TC_ul_unitdata(charstring id) runs on BSSGP_ConnHdlr {
Harald Welte16357a92020-11-17 18:20:00 +0100656 var integer ran_idx := 0;
657 var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0];
Harald Welte92686012020-11-15 21:45:49 +0100658 var integer i;
659
660 for (i := 0; i < 1024; i := i+1) {
661 var octetstring payload := f_rnd_octstring(i);
Harald Welte16357a92020-11-17 18:20:00 +0100662 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload);
Harald Welte92686012020-11-15 21:45:49 +0100663 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
Harald Welte16357a92020-11-17 18:20:00 +0100664 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload);
Harald Welte92686012020-11-15 21:45:49 +0100665
Harald Welte22ef5d92020-11-16 13:35:14 +0100666 f_pcu2sgsn(pdu_tx, pdu_rx);
Harald Welte92686012020-11-15 21:45:49 +0100667 }
668 setverdict(pass);
669}
670
671testcase TC_ul_unitdata() runs on test_CT
672{
673 var BSSGP_ConnHdlr vc_conn;
674 f_init();
675
676 vc_conn := f_start_handler(refers(f_TC_ul_unitdata), testcasename(), g_pcu, g_sgsn, 1);
677 vc_conn.done;
678 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
679
680 f_cleanup();
681}
682
Harald Welte78d8db92020-11-15 23:27:27 +0100683/* send downlink-unitdata of a variety of different sizes; expect it to show up on PCU */
684private function f_TC_dl_unitdata(charstring id) runs on BSSGP_ConnHdlr {
685 var integer i;
686
687 for (i := 0; i < 1024; i := i+1) {
688 var octetstring payload := f_rnd_octstring(i);
689 var template (value) PDU_BSSGP pdu_tx :=
690 ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi));
691 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
692 var template (present) PDU_BSSGP pdu_rx :=
693 tr_BSSGP_DL_UD(g_pars.tlli, payload, tr_BSSGP_IMSI(g_pars.imsi));
694
Harald Welte22ef5d92020-11-16 13:35:14 +0100695 f_sgsn2pcu(pdu_tx, pdu_rx);
Harald Welte78d8db92020-11-15 23:27:27 +0100696 }
697 setverdict(pass);
698}
699
700testcase TC_dl_unitdata() runs on test_CT
701{
702 var BSSGP_ConnHdlr vc_conn;
703 f_init();
704
705 vc_conn := f_start_handler(refers(f_TC_dl_unitdata), testcasename(), g_pcu, g_sgsn, 2);
706 vc_conn.done;
707 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
708
709 f_cleanup();
710}
Harald Welte92686012020-11-15 21:45:49 +0100711
Harald Welte6dc2ac42020-11-16 09:16:17 +0100712private function f_TC_ra_capability(charstring id) runs on BSSGP_ConnHdlr {
713 var integer i;
714
715 for (i := 0; i < 10; i := i+1) {
716 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP(g_pars.tlli, { ts_RaCapRec_BSSGP });
717 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
718 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP(g_pars.tlli, { tr_RaCapRec_BSSGP })
719
Harald Welte22ef5d92020-11-16 13:35:14 +0100720 f_sgsn2pcu(pdu_tx, pdu_rx);
Harald Welte6dc2ac42020-11-16 09:16:17 +0100721 }
722 setverdict(pass);
723}
724testcase TC_ra_capability() runs on test_CT
725{
726 var BSSGP_ConnHdlr vc_conn;
727 f_init();
728
729 vc_conn := f_start_handler(refers(f_TC_ra_capability), testcasename(), g_pcu, g_sgsn, 3);
730 vc_conn.done;
731 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
732
733 f_cleanup();
734}
735
Daniel Willmannace3ece2020-11-16 19:53:26 +0100736private function f_TC_ra_capability_upd(charstring id) runs on BSSGP_ConnHdlr {
737 var integer i;
738 var OCT1 tag;
739 for (i := 0; i < 10; i := i+1) {
740 tag := int2oct(23 + i, 1);
741 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RA_CAP_UPD(g_pars.tlli, tag);
742 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
743 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP_UPD(g_pars.tlli, tag)
744
745 f_pcu2sgsn(pdu_tx, pdu_rx);
746
747 pdu_tx := ts_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O);
748 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
749 pdu_rx := tr_BSSGP_RA_CAP_UPD_ACK(g_pars.tlli, tag, '42'O)
750
751 f_sgsn2pcu(pdu_tx, pdu_rx);
752 }
753 setverdict(pass);
754}
755testcase TC_ra_capability_upd() runs on test_CT
756{
757 var BSSGP_ConnHdlr vc_conn;
758 f_init();
759
Daniel Willmann54833f22020-11-19 15:43:52 +0100760 vc_conn := f_start_handler(refers(f_TC_ra_capability_upd), testcasename(), g_pcu, g_sgsn, 4);
Daniel Willmannace3ece2020-11-16 19:53:26 +0100761 vc_conn.done;
762 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
763
764 f_cleanup();
765}
766
Daniel Willmann165d6612020-11-19 14:27:29 +0100767private function f_TC_radio_status(charstring id) runs on BSSGP_ConnHdlr {
768 var integer i;
769 var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST;
770 for (i := 0; i < 10; i := i+1) {
771 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(g_pars.tlli, cause);
772 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
773 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(g_pars.tlli, cause)
774
775 f_pcu2sgsn(pdu_tx, pdu_rx);
776 }
777 setverdict(pass);
778}
779testcase TC_radio_status() runs on test_CT
780{
781 var BSSGP_ConnHdlr vc_conn;
782 f_init();
783
Daniel Willmann54833f22020-11-19 15:43:52 +0100784 vc_conn := f_start_handler(refers(f_TC_radio_status), testcasename(), g_pcu, g_sgsn, 5);
Daniel Willmann165d6612020-11-19 14:27:29 +0100785 vc_conn.done;
786 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
787
788 f_cleanup();
789}
790
Daniel Willmannfa67f492020-11-19 15:48:05 +0100791private function f_TC_suspend(charstring id) runs on BSSGP_ConnHdlr {
792 var integer i;
Daniel Willmann165d6612020-11-19 14:27:29 +0100793
Daniel Willmannfa67f492020-11-19 15:48:05 +0100794 /* TODO: Generate RA ID for each ConnHdlr */
795 var RoutingAreaIdentification ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id;
796 for (i := 0; i < 10; i := i+1) {
797
798 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(g_pars.tlli, ra_id);
799 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
800 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(g_pars.tlli, ra_id);
801
802 f_pcu2sgsn(pdu_tx, pdu_rx);
803
804 pdu_tx := ts_BSSGP_SUSPEND_ACK(g_pars.tlli, ra_id, int2oct(i, 1));
805 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
806 pdu_rx := tr_BSSGP_SUSPEND_ACK(g_pars.tlli, ra_id, int2oct(i, 1));
807
808 f_sgsn2pcu(pdu_tx, pdu_rx);
809
810 /* These messages are simple passed through so just also test sending NACK */
811 pdu_tx := ts_BSSGP_SUSPEND_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
812 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
813 pdu_rx := tr_BSSGP_SUSPEND_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
814
815 f_sgsn2pcu(pdu_tx, pdu_rx);
816 }
817 setverdict(pass);
818}
819testcase TC_suspend() runs on test_CT
820{
821 var BSSGP_ConnHdlr vc_conn;
822 f_init();
823
824 vc_conn := f_start_handler(refers(f_TC_suspend), testcasename(), g_pcu, g_sgsn, 6);
825 vc_conn.done;
826 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
827
828 f_cleanup();
829}
Harald Welte6dc2ac42020-11-16 09:16:17 +0100830
Daniel Willmann087a33d2020-11-19 15:58:43 +0100831private function f_TC_resume(charstring id) runs on BSSGP_ConnHdlr {
832 var integer i;
833
834 /* TODO: Generate RA ID for each ConnHdlr */
835 var RoutingAreaIdentification ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id;
836 for (i := 0; i < 10; i := i+1) {
837
838 var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(g_pars.tlli, ra_id, int2oct(i, 1));
839 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
840 var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(g_pars.tlli, ra_id, int2oct(i, 1));
841
842 f_pcu2sgsn(pdu_tx, pdu_rx);
843
844 pdu_tx := ts_BSSGP_RESUME_ACK(g_pars.tlli, ra_id);
845 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
846 pdu_rx := tr_BSSGP_RESUME_ACK(g_pars.tlli, ra_id);
847
848 f_sgsn2pcu(pdu_tx, pdu_rx);
849
850 /* These messages are simple passed through so just also test sending NACK */
851 pdu_tx := ts_BSSGP_RESUME_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
852 /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
853 pdu_rx := tr_BSSGP_RESUME_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
854
855 f_sgsn2pcu(pdu_tx, pdu_rx);
856 }
857 setverdict(pass);
858}
859testcase TC_resume() runs on test_CT
860{
861 var BSSGP_ConnHdlr vc_conn;
862 f_init();
863
864 vc_conn := f_start_handler(refers(f_TC_resume), testcasename(), g_pcu, g_sgsn, 6);
865 vc_conn.done;
866 /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
867
868 f_cleanup();
869}
870
Harald Weltef8ef0282020-11-18 12:16:59 +0100871/* test the load-sharing between multiple NS-VC on the BSS side */
872private function f_TC_dl_ud_unidir(charstring id) runs on BSSGP_ConnHdlr {
873 var integer i;
874
875 for (i := 0; i < 10; i := i+1) {
876 var octetstring payload := f_rnd_octstring(i);
877 var template (value) PDU_BSSGP pdu_tx :=
878 ts_BSSGP_DL_UD(g_pars.tlli, payload, omit, ts_BSSGP_IMSI(g_pars.imsi));
879 SGSN[0].send(pdu_tx);
880 }
881 setverdict(pass);
882}
883testcase TC_load_sharing_dl() runs on test_CT_NS
884{
885 const integer num_ue := 10;
886 var BSSGP_ConnHdlr vc_conn[num_ue];
887 f_init();
888
889 /* all BVC are now fully brought up. We disconnect BSSGP from NS on the BSS
890 * side so we get the raw NsUnitdataIndication and hence observe different
891 * NSVCI */
892 disconnect(g_pcu[0].vc_NS:NS_SP, g_pcu[0].vc_BSSGP:BSCP);
893 connect(g_pcu[0].vc_NS:NS_SP, self:NS);
894
895 /* there may still be some NS-VCs coming up? After all, the BVC-RESET succeeds after the first
896 * of the NS-VC is ALIVE/UNBLOCKED */
897 f_sleep(3.0);
898
899 /* start parallel components generating DL-UNITDATA from the SGSN side */
900 for (var integer i:= 0; i < num_ue; i := i+1) {
901 vc_conn[i] := f_start_handler(refers(f_TC_dl_ud_unidir), testcasename(), g_pcu, g_sgsn, 5+i);
902 }
903
904 /* now start counting all the messages that were queued before */
905 /* TODO: We have a hard-coded assumption of 4 NS-VC in one NSE/NS-VCG here! */
906 var ro_integer rx_count := { 0, 0, 0, 0 };
907 timer T := 2.0;
908 T.start;
909 alt {
910 [] as_NsUdiCount(0, rx_count);
911 [] as_NsUdiCount(1, rx_count);
912 [] as_NsUdiCount(2, rx_count);
913 [] as_NsUdiCount(3, rx_count);
914 [] NS.receive(NsUnitdataIndication:{0,?,?,*,*}) { repeat; } /* signaling BVC */
915 [] NS.receive(NsStatusIndication:?) { repeat; }
916 [] NS.receive {
917 setverdict(fail, "Rx unexpected NS");
918 mtc.stop;
919 }
920 [] T.timeout {
921 }
922 }
923 for (var integer i := 0; i < lengthof(rx_count); i := i+1) {
924 log("Rx on NSVCI ", mp_nsconfig_pcu[0].nsvc[i].nsvci, ": ", rx_count[i]);
925 if (rx_count[i] == 0) {
926 setverdict(fail, "Data not shared over all NSVC");
927 }
928 }
929 setverdict(pass);
930}
931private altstep as_NsUdiCount(integer nsvc_idx, inout ro_integer roi) runs on test_CT_NS {
932 var NsUnitdataIndication udi;
933 var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[0];
934 [] NS.receive(NsUnitdataIndication:{bvcc.bvci, g_pcu[0].cfg.nsei, mp_nsconfig_pcu[0].nsvc[nsvc_idx].nsvci, *, *}) -> value udi {
935 roi[nsvc_idx] := roi[nsvc_idx] + 1;
936 repeat;
937 }
938}
939type component test_CT_NS extends test_CT {
940 port NS_PT NS;
941};
942
943
Harald Welte0e188242020-11-22 21:46:48 +0100944/***********************************************************************
945 * PAGING PS procedure
946 ***********************************************************************/
947
948private function f_send_paging_ps(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
949 boolean use_sig := false)
950runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP {
951 var template (value) PDU_BSSGP pdu_tx;
952 var template (present) PDU_BSSGP pdu_rx;
953 /* we always specify '0' as BVCI in the templates below, as we override it with
954 * 'p4' later anyway */
955 pdu_rx := tr_BSSGP_PS_PAGING(0);
956 pdu_rx.pDU_BSSGP_PAGING_PS.iMSI := tr_BSSGP_IMSI(g_pars.imsi);
957 if (ispresent(g_pars.p_tmsi)) {
958 pdu_tx := ts_BSSGP_PS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi));
959 pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi));
960 } else {
961 pdu_tx := ts_BSSGP_PS_PAGING_IMSI(0, g_pars.imsi);
962 pdu_rx.pDU_BSSGP_PAGING_PS.pTMSI := omit;
963 }
964 pdu_tx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4;
965 pdu_rx.pDU_BSSGP_PAGING_PS.paging_Field4 := p4;
966 if (use_sig == false) {
967 SGSN[sgsn_idx].send(pdu_tx);
968 } else {
969 SGSN_SIG[sgsn_idx].send(pdu_tx);
970 }
971 return pdu_rx;
972}
973
974/* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on
975 * specified PCU index */
976private function f_send_paging_ps_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
977 boolean use_sig := false,integer pcu_idx := 0)
978runs on BSSGP_ConnHdlr {
979 var template (present) PDU_BSSGP exp_rx;
980 /* doesn't really make sense: Sending to a single BVCI means the message ends up
981 * at that BVC (cell) only, and paging all over the BSS area is not possible */
982 exp_rx := f_send_paging_ps(p4, sgsn_idx, use_sig);
983 /* Expect paging to propagate to the one BSS addressed by the BVCI only */
984 timer T := 2.0;
985 T.start;
986 alt {
987 [not use_sig] PCU[pcu_idx].receive(exp_rx) {
988 setverdict(pass);
989 repeat;
990 }
991 [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) {
992 setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC");
993 }
994 [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) {
995 setverdict(pass);
996 repeat;
997 }
998 [use_sig] PCU[pcu_idx].receive(exp_rx) {
999 setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC");
1000 }
1001 [] any from PCU.receive(exp_rx) {
1002 setverdict(fail, "Paging received on unexpected BVC");
1003 }
1004 [] any from PCU_SIG.receive(exp_rx) {
1005 setverdict(fail, "Paging received on unexpected BVC");
1006 }
1007 [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) {
1008 setverdict(fail, "Different Paging than expected received PTP BVC");
1009 }
1010 [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) {
1011 setverdict(fail, "Different Paging than expected on SIGNALING BVC");
1012 }
1013 [] T.timeout;
1014 }
1015}
1016
1017private function f_TC_paging_ps_ptp_bss(charstring id) runs on BSSGP_ConnHdlr
1018{
1019 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1020 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1021 f_send_paging_ps_exp_one_bss(ts_BssgpP4BssArea, 0, false, 0);
1022}
1023testcase TC_paging_ps_ptp_bss() runs on test_CT {
1024 var BSSGP_ConnHdlr vc_conn;
1025 f_init();
1026
1027 vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_bss), testcasename(), g_pcu, g_sgsn, 9);
1028 vc_conn.done;
1029
1030 f_cleanup();
1031}
1032
1033/* PS-PAGING on PTP-BVC for Location Area */
1034private function f_TC_paging_ps_ptp_lac(charstring id) runs on BSSGP_ConnHdlr
1035{
1036 var template (present) PDU_BSSGP exp_rx;
1037 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1038 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1039 f_send_paging_ps_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, false, 0);
1040}
1041testcase TC_paging_ps_ptp_lac() runs on test_CT {
1042 var BSSGP_ConnHdlr vc_conn;
1043 f_init();
1044
1045 vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_lac), testcasename(), g_pcu, g_sgsn, 10);
1046 vc_conn.done;
1047
1048 f_cleanup();
1049}
1050
1051/* PS-PAGING on PTP-BVC for Routeing Area */
1052private function f_TC_paging_ps_ptp_rac(charstring id) runs on BSSGP_ConnHdlr
1053{
1054 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1055 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1056 f_send_paging_ps_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, false, 0);
1057}
1058testcase TC_paging_ps_ptp_rac() runs on test_CT {
1059 var BSSGP_ConnHdlr vc_conn;
1060 f_init();
1061
1062 vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_rac), testcasename(), g_pcu, g_sgsn, 11);
1063 vc_conn.done;
1064
1065 f_cleanup();
1066}
1067
1068/* PS-PAGING on PTP-BVC for BVCI (one cell) */
1069private function f_TC_paging_ps_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr
1070{
1071 /* this should be the normal case for MS in READY MM state after a lower layer failure */
1072 f_send_paging_ps_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, false, 0);
1073}
1074testcase TC_paging_ps_ptp_bvci() runs on test_CT {
1075 var BSSGP_ConnHdlr vc_conn;
1076 f_init();
1077
1078 vc_conn := f_start_handler(refers(f_TC_paging_ps_ptp_bvci), testcasename(), g_pcu, g_sgsn, 12);
1079 vc_conn.done;
1080
1081 f_cleanup();
1082}
1083
1084/* altstep for expecting BSSGP PDU on signaling BVC of given pcu_idx + storing in 'roi' */
1085private altstep as_paging_sig_pcu(integer pcu_idx, template (present) PDU_BSSGP exp_rx, inout ro_integer roi)
1086runs on BSSGP_ConnHdlr {
1087[] PCU_SIG[pcu_idx].receive(exp_rx) {
1088 if (ro_integer_contains(roi, pcu_idx)) {
1089 setverdict(fail, "Received multiple paging on same SIG BVC");
1090 }
1091 roi := roi & { pcu_idx };
1092 repeat;
1093 }
1094[] PCU[pcu_idx].receive(exp_rx) {
1095 setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC");
1096 }
1097[] PCU_SIG[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) {
1098 setverdict(fail, "Different Paging than expected received SIGNALING BVC");
1099 }
1100[] PCU[pcu_idx].receive(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}) {
1101 setverdict(fail, "Different Paging than expected received PTP BVC");
1102 }
1103}
1104
1105type record of default ro_default;
1106
1107/* send PS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */
1108private function f_send_paging_ps_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
1109 ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr
1110{
1111 var template (present) PDU_BSSGP exp_rx;
1112 exp_rx := f_send_paging_ps(p4, 0, true);
1113
1114 /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */
1115 var ro_default defaults := {};
1116 for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
1117 var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi));
1118 defaults := defaults & { d };
1119 }
1120 f_sleep(2.0);
1121 for (var integer i := 0; i < lengthof(defaults); i := i+1) {
1122 deactivate(defaults[i]);
1123 }
1124 log("Paging received on PCU ", g_roi);
1125
1126 for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
1127 var boolean rx_on_i := ro_integer_contains(g_roi, i);
1128 var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i);
1129 if (exp_on_i and not rx_on_i) {
1130 setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei);
1131 }
1132 if (not exp_on_i and rx_on_i) {
1133 setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei);
1134 }
1135 }
1136 setverdict(pass);
1137}
1138
1139/* PS-PAGING on SIG-BVC for BSS Area */
1140private function f_TC_paging_ps_sig_bss(charstring id) runs on BSSGP_ConnHdlr
1141{
1142 /* we expect the paging to arrive on all three NSE */
1143 f_send_paging_ps_exp_multi(ts_BssgpP4BssArea, 0, {0, 1, 2});
1144}
1145testcase TC_paging_ps_sig_bss() runs on test_CT {
1146 var BSSGP_ConnHdlr vc_conn;
1147 f_init();
1148
1149 vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_bss), testcasename(), g_pcu, g_sgsn, 13);
1150 vc_conn.done;
1151
1152 f_cleanup();
1153}
1154
1155/* PS-PAGING on SIG-BVC for Location Area */
1156private function f_TC_paging_ps_sig_lac(charstring id) runs on BSSGP_ConnHdlr
1157{
1158 /* Both PCU index 0 and 1 have a BVC within the LAC */
1159 f_send_paging_ps_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, {0, 1});
1160}
1161testcase TC_paging_ps_sig_lac() runs on test_CT {
1162 var BSSGP_ConnHdlr vc_conn;
1163 f_init();
1164
1165 vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_lac), testcasename(), g_pcu, g_sgsn, 14);
1166 vc_conn.done;
1167
1168 f_cleanup();
1169}
1170
1171/* PS-PAGING on SIG-BVC for Routeing Area */
1172private function f_TC_paging_ps_sig_rac(charstring id) runs on BSSGP_ConnHdlr
1173{
1174 /* Only PCU index 0 has a matching BVC within the LAC */
1175 f_send_paging_ps_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, {0});
1176}
1177testcase TC_paging_ps_sig_rac() runs on test_CT {
1178 var BSSGP_ConnHdlr vc_conn;
1179 f_init();
1180
1181 vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_rac), testcasename(), g_pcu, g_sgsn, 15);
1182 vc_conn.done;
1183
1184 f_cleanup();
1185}
1186
1187/* PS-PAGING on SIG-BVC for BVCI (one cell) */
1188private function f_TC_paging_ps_sig_bvci(charstring id) runs on BSSGP_ConnHdlr
1189{
1190 f_send_paging_ps_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, {0});
1191}
1192testcase TC_paging_ps_sig_bvci() runs on test_CT {
1193 var BSSGP_ConnHdlr vc_conn;
1194 f_init();
1195
1196 vc_conn := f_start_handler(refers(f_TC_paging_ps_sig_bvci), testcasename(), g_pcu, g_sgsn, 16);
1197 vc_conn.done;
1198
1199 f_cleanup();
1200}
1201
1202
1203/***********************************************************************
1204 * PAGING CS procedure
1205 ***********************************************************************/
1206
1207private function f_send_paging_cs(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
1208 boolean use_sig := false)
1209runs on BSSGP_ConnHdlr return template (present) PDU_BSSGP {
1210 var template (value) PDU_BSSGP pdu_tx;
1211 var template (present) PDU_BSSGP pdu_rx;
1212 /* we always specify '0' as BVCI in the templates below, as we override it with
1213 * 'p4' later anyway */
1214 pdu_rx := tr_BSSGP_CS_PAGING(0);
1215 pdu_rx.pDU_BSSGP_PAGING_CS.iMSI := tr_BSSGP_IMSI(g_pars.imsi);
1216 if (ispresent(g_pars.p_tmsi)) {
1217 pdu_tx := ts_BSSGP_CS_PAGING_PTMSI(0, g_pars.imsi, oct2int(g_pars.p_tmsi));
1218 pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := tr_BSSGP_TMSI(oct2int(g_pars.p_tmsi));
1219 } else {
1220 pdu_tx := ts_BSSGP_CS_PAGING_IMSI(0, g_pars.imsi);
1221 pdu_rx.pDU_BSSGP_PAGING_CS.tMSI := omit;
1222 }
1223 pdu_tx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4;
1224 pdu_rx.pDU_BSSGP_PAGING_CS.paging_Field4 := p4;
1225 if (use_sig == false) {
1226 SGSN[sgsn_idx].send(pdu_tx);
1227 } else {
1228 SGSN_SIG[sgsn_idx].send(pdu_tx);
1229 }
1230 return pdu_rx;
1231}
1232
1233/* send paging defined by 'p4' on given SGSN-side index (ptp or signaling) and expect one paging to arrive on
1234 * specified PCU index */
1235private function f_send_paging_cs_exp_one_bss(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
1236 boolean use_sig := false,integer pcu_idx := 0)
1237runs on BSSGP_ConnHdlr {
1238 var template (present) PDU_BSSGP exp_rx;
1239 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1240 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1241 exp_rx := f_send_paging_cs(p4, sgsn_idx, use_sig);
1242 /* Expect paging to propagate to the one BSS addressed by the BVCI only */
1243 timer T := 2.0;
1244 T.start;
1245 alt {
1246 [not use_sig] PCU[pcu_idx].receive(exp_rx) {
1247 setverdict(pass);
1248 repeat;
1249 }
1250 [not use_sig] PCU_SIG[pcu_idx].receive(exp_rx) {
1251 setverdict(fail, "Received paging on SIGNALING BVC, expected PTP BVC");
1252 }
1253 [use_sig] PCU_SIG[pcu_idx].receive(exp_rx) {
1254 setverdict(pass);
1255 repeat;
1256 }
1257 [use_sig] PCU[pcu_idx].receive(exp_rx) {
1258 setverdict(fail, "Received paging on PTP BVC, expected SIGNALING BVC");
1259 }
1260 [] any from PCU.receive(exp_rx) {
1261 setverdict(fail, "Paging received on unexpected BVC");
1262 }
1263 [] any from PCU_SIG.receive(exp_rx) {
1264 setverdict(fail, "Paging received on unexpected BVC");
1265 }
1266 [] any from PCU.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) {
1267 setverdict(fail, "Different Paging than expected received PTP BVC");
1268 }
1269 [] any from PCU_SIG.receive(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}) {
1270 setverdict(fail, "Different Paging than expected on SIGNALING BVC");
1271 }
1272 [] T.timeout;
1273 }
1274}
1275
1276private function f_TC_paging_cs_ptp_bss(charstring id) runs on BSSGP_ConnHdlr
1277{
1278 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1279 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1280 f_send_paging_cs_exp_one_bss(ts_BssgpP4BssArea, 0, false, 0);
1281}
1282testcase TC_paging_cs_ptp_bss() runs on test_CT {
1283 var BSSGP_ConnHdlr vc_conn;
1284 f_init();
1285
1286 vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_bss), testcasename(), g_pcu, g_sgsn, 17);
1287 vc_conn.done;
1288
1289 f_cleanup();
1290}
1291
1292/* CS-PAGING on PTP-BVC for Location Area */
1293private function f_TC_paging_cs_ptp_lac(charstring id) runs on BSSGP_ConnHdlr
1294{
1295 var template (present) PDU_BSSGP exp_rx;
1296 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1297 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1298 f_send_paging_cs_exp_one_bss(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, false, 0);
1299}
1300testcase TC_paging_cs_ptp_lac() runs on test_CT {
1301 var BSSGP_ConnHdlr vc_conn;
1302 f_init();
1303
1304 vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_lac), testcasename(), g_pcu, g_sgsn, 18);
1305 vc_conn.done;
1306
1307 f_cleanup();
1308}
1309
1310/* CS-PAGING on PTP-BVC for Routeing Area */
1311private function f_TC_paging_cs_ptp_rac(charstring id) runs on BSSGP_ConnHdlr
1312{
1313 /* doesn't really make sense: Sending to a single BVCI means the message ends up
1314 * at that BVC (cell) only, and paging all over the BSS area is not possible */
1315 f_send_paging_cs_exp_one_bss(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, false, 0);
1316}
1317testcase TC_paging_cs_ptp_rac() runs on test_CT {
1318 var BSSGP_ConnHdlr vc_conn;
1319 f_init();
1320
1321 vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_rac), testcasename(), g_pcu, g_sgsn, 19);
1322 vc_conn.done;
1323
1324 f_cleanup();
1325}
1326
1327/* CS-PAGING on PTP-BVC for BVCI (one cell) */
1328private function f_TC_paging_cs_ptp_bvci(charstring id) runs on BSSGP_ConnHdlr
1329{
1330 /* this should be the normal case for MS in READY MM state after a lower layer failure */
1331 f_send_paging_cs_exp_one_bss(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, false, 0);
1332}
1333testcase TC_paging_cs_ptp_bvci() runs on test_CT {
1334 var BSSGP_ConnHdlr vc_conn;
1335 f_init();
1336
1337 vc_conn := f_start_handler(refers(f_TC_paging_cs_ptp_bvci), testcasename(), g_pcu, g_sgsn, 20);
1338 vc_conn.done;
1339
1340 f_cleanup();
1341}
1342
1343/* send CS-PAGING on SIG BVC, expect it to arrive on given list of PCU indexes */
1344private function f_send_paging_cs_exp_multi(template (value) Paging_Field4 p4, integer sgsn_idx := 0,
1345 ro_integer exp_on_pcu_idx) runs on BSSGP_ConnHdlr
1346{
1347 var template (present) PDU_BSSGP exp_rx;
1348 exp_rx := f_send_paging_cs(p4, 0, true);
1349
1350 /* FIXME: make sure the relevant BVCs/BSS are connected to the ports! */
1351 var ro_default defaults := {};
1352 for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
1353 var default d := activate(as_paging_sig_pcu(i, exp_rx, g_roi));
1354 defaults := defaults & { d };
1355 }
1356 f_sleep(2.0);
1357 for (var integer i := 0; i < lengthof(defaults); i := i+1) {
1358 deactivate(defaults[i]);
1359 }
1360 log("Paging received on PCU ", g_roi);
1361
1362 for (var integer i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
1363 var boolean rx_on_i := ro_integer_contains(g_roi, i);
1364 var boolean exp_on_i := ro_integer_contains(exp_on_pcu_idx, i);
1365 if (exp_on_i and not rx_on_i) {
1366 setverdict(fail, "PS-PAGING not received on ", mp_nsconfig_pcu[i].nsei);
1367 }
1368 if (not exp_on_i and rx_on_i) {
1369 setverdict(fail, "PS-PAGING not expected but received on ", mp_nsconfig_pcu[i].nsei);
1370 }
1371 }
1372 setverdict(pass);
1373}
1374
1375/* CS-PAGING on SIG-BVC for BSS Area */
1376private function f_TC_paging_cs_sig_bss(charstring id) runs on BSSGP_ConnHdlr
1377{
1378 /* we expect the paging to arrive on all three NSE */
1379 f_send_paging_cs_exp_multi(ts_BssgpP4BssArea, 0, {0, 1, 2});
1380}
1381testcase TC_paging_cs_sig_bss() runs on test_CT {
1382 var BSSGP_ConnHdlr vc_conn;
1383 f_init();
1384
1385 vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_bss), testcasename(), g_pcu, g_sgsn, 13);
1386 vc_conn.done;
1387
1388 f_cleanup();
1389}
1390
1391/* CS-PAGING on SIG-BVC for Location Area */
1392private function f_TC_paging_cs_sig_lac(charstring id) runs on BSSGP_ConnHdlr
1393{
1394 /* Both PCU index 0 and 1 have a BVC within the LAC */
1395 f_send_paging_cs_exp_multi(ts_BssgpP4LAC(pcu_bvc_cfg[0].cell_id.ra_id.lai), 0, {0, 1});
1396}
1397testcase TC_paging_cs_sig_lac() runs on test_CT {
1398 var BSSGP_ConnHdlr vc_conn;
1399 f_init();
1400
1401 vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_lac), testcasename(), g_pcu, g_sgsn, 14);
1402 vc_conn.done;
1403
1404 f_cleanup();
1405}
1406
1407/* CS-PAGING on SIG-BVC for Routeing Area */
1408private function f_TC_paging_cs_sig_rac(charstring id) runs on BSSGP_ConnHdlr
1409{
1410 /* Only PCU index 0 has a matching BVC within the LAC */
1411 f_send_paging_cs_exp_multi(ts_BssgpP4RAC(pcu_bvc_cfg[0].cell_id.ra_id), 0, {0});
1412}
1413testcase TC_paging_cs_sig_rac() runs on test_CT {
1414 var BSSGP_ConnHdlr vc_conn;
1415 f_init();
1416
1417 vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_rac), testcasename(), g_pcu, g_sgsn, 15);
1418 vc_conn.done;
1419
1420 f_cleanup();
1421}
1422
1423/* CS-PAGING on SIG-BVC for BVCI (one cell) */
1424private function f_TC_paging_cs_sig_bvci(charstring id) runs on BSSGP_ConnHdlr
1425{
1426 f_send_paging_cs_exp_multi(ts_BssgpP4Bvci(pcu_bvc_cfg[0].bvci), 0, {0});
1427}
1428testcase TC_paging_cs_sig_bvci() runs on test_CT {
1429 var BSSGP_ConnHdlr vc_conn;
1430 f_init();
1431
1432 vc_conn := f_start_handler(refers(f_TC_paging_cs_sig_bvci), testcasename(), g_pcu, g_sgsn, 16);
1433 vc_conn.done;
1434
1435 f_cleanup();
1436}
1437
Harald Welte6dc2ac42020-11-16 09:16:17 +01001438
Daniel Willmann423d8f42020-09-08 18:58:22 +02001439control {
1440 execute( TC_BVC_bringup() );
Harald Welte92686012020-11-15 21:45:49 +01001441 execute( TC_ul_unitdata() );
Harald Welte78d8db92020-11-15 23:27:27 +01001442 execute( TC_dl_unitdata() );
Harald Welte6dc2ac42020-11-16 09:16:17 +01001443 execute( TC_ra_capability() );
Daniel Willmannace3ece2020-11-16 19:53:26 +01001444 execute( TC_ra_capability_upd() );
Daniel Willmann165d6612020-11-19 14:27:29 +01001445 execute( TC_radio_status() );
Daniel Willmannfa67f492020-11-19 15:48:05 +01001446 execute( TC_suspend() );
Daniel Willmann087a33d2020-11-19 15:58:43 +01001447 execute( TC_resume() );
Harald Weltef8ef0282020-11-18 12:16:59 +01001448 if (false) {
1449 /* don't enable this by default, as we don't yet have any automatic test setup for FR with 4 NS-VC */
1450 execute( TC_load_sharing_dl() );
1451 }
Harald Welte0e188242020-11-22 21:46:48 +01001452
1453 /* PAGING-PS over PTP BVC */
1454 execute( TC_paging_ps_ptp_bss() );
1455 execute( TC_paging_ps_ptp_lac() );
1456 execute( TC_paging_ps_ptp_rac() );
1457 execute( TC_paging_ps_ptp_bvci() );
1458
1459 /* PAGING-PS over SIG BVC */
1460 execute( TC_paging_ps_sig_bss() );
1461 execute( TC_paging_ps_sig_lac() );
1462 execute( TC_paging_ps_sig_rac() );
1463 execute( TC_paging_ps_sig_bvci() );
1464
1465 /* PAGING-CS over PTP BVC */
1466 execute( TC_paging_cs_ptp_bss() );
1467 execute( TC_paging_cs_ptp_lac() );
1468 execute( TC_paging_cs_ptp_rac() );
1469 execute( TC_paging_cs_ptp_bvci() );
1470
1471 /* PAGING-CS over SIG BVC */
1472 execute( TC_paging_cs_sig_bss() );
1473 execute( TC_paging_cs_sig_lac() );
1474 execute( TC_paging_cs_sig_rac() );
1475 execute( TC_paging_cs_sig_bvci() );
1476
1477
Daniel Willmann423d8f42020-09-08 18:58:22 +02001478}
1479
1480
1481}