blob: b220bb9684fd45c599300c26edb2e769c6af5e03 [file] [log] [blame]
Harald Welte023b61b2020-09-12 20:41:05 +02001module FR_Tests {
2
3import from General_Types all;
4import from Osmocom_Types all;
5import from Osmocom_Gb_Types all;
6
7import from NS_Emulation all;
8import from BSSGP_Emulation all;
9
10modulepar {
Harald Weltede6f3ee2020-11-11 19:01:46 +010011 integer mp_num_bvc := 10;
Harald Welte023b61b2020-09-12 20:41:05 +020012 NSConfigurations mp_nsconfig := {
13 {
Harald Welte023b61b2020-09-12 20:41:05 +020014 nsei := 123,
15 role_sgsn := false,
Harald Welte90f19742020-11-06 19:34:40 +010016 handle_sns := false,
17 nsvc := {
18 {
19 provider := {
20 fr := {
21 netdev := "hdlc1",
22 dlci := 123
23 }
24 },
25 nsvci := 123
26 }
27 }
Harald Welte023b61b2020-09-12 20:41:05 +020028 }
29 };
30}
31
32type record GbInstance {
33 NS_CT vc_NS,
34 BSSGP_CT vc_BSSGP,
35 BssgpConfig cfg
36};
37
Harald Weltede6f3ee2020-11-11 19:01:46 +010038type record of GbInstance GbInstances;
39type record of NSConfiguration NSConfigurations;
40type record of BssgpCellId BssgpCellIds;
Harald Welte023b61b2020-09-12 20:41:05 +020041
42
43type component test_CT {
44 var GbInstances g_gb;
45};
46
47private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
48 var charstring id_idx := id & int2str(offset);
49 gb.vc_NS := NS_CT.create(id_idx & "-NSemu");
50 gb.vc_BSSGP := BSSGP_CT.create(id_idx & "-BSSGPemu");
51 connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
52 gb.vc_NS.start(NSStart(mp_nsconfig[offset], id_idx));
53 gb.vc_BSSGP.start(BssgpStart(gb.cfg, testcasename()));
54}
55
Harald Weltede6f3ee2020-11-11 19:01:46 +010056function f_gen_bvc(integer base, integer idx) return BssgpBvcConfig {
57 var BssgpBvcConfig bvc := {
58 bvci := base + 100 + idx,
59 cell_id := {
60 ra_id := {
61 lai := {
62 mcc_mnc := '262F42'H,
63 lac := base + 300 + idx
Harald Welte023b61b2020-09-12 20:41:05 +020064 },
Harald Weltede6f3ee2020-11-11 19:01:46 +010065 rac := 1
66 },
67 cell_id := base + 600 + idx
68 },
69 depth := BSSGP_DECODE_DEPTH_LLC
Harald Welte023b61b2020-09-12 20:41:05 +020070 };
Harald Weltede6f3ee2020-11-11 19:01:46 +010071 return bvc;
72}
73
74
75testcase TC_foo() runs on test_CT {
76
77 for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
78 g_gb[i].cfg := {
79 nsei := mp_nsconfig[i].nsei,
80 sgsn_role := false,
81 bvc := { }
82 };
83 /* create 'mp_num_bvc' number of BVCs */
84 for (var integer j := 0; j < mp_num_bvc; j := j+1) {
85 g_gb[i].cfg.bvc := g_gb[i].cfg.bvc & { f_gen_bvc(i * 1000, j) };
86 }
87 f_init_gb(g_gb[i], "gb", i);
88 }
Harald Welte023b61b2020-09-12 20:41:05 +020089 while (true) {
90 f_sleep(100.0);
91 }
92}
93
94control {
95 execute( TC_foo() );
96}
97
98}