blob: 9f9b70e08c8f3bcf60673314923fec70b16f8350 [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 },
Harald Welte4d112c92020-11-12 19:48:31 +010069 depth := BSSGP_DECODE_DEPTH_LLC,
70 create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
Harald Welte023b61b2020-09-12 20:41:05 +020071 };
Harald Weltede6f3ee2020-11-11 19:01:46 +010072 return bvc;
73}
74
75
76testcase TC_foo() runs on test_CT {
77
78 for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
79 g_gb[i].cfg := {
80 nsei := mp_nsconfig[i].nsei,
81 sgsn_role := false,
82 bvc := { }
83 };
84 /* create 'mp_num_bvc' number of BVCs */
85 for (var integer j := 0; j < mp_num_bvc; j := j+1) {
86 g_gb[i].cfg.bvc := g_gb[i].cfg.bvc & { f_gen_bvc(i * 1000, j) };
87 }
88 f_init_gb(g_gb[i], "gb", i);
89 }
Harald Welte023b61b2020-09-12 20:41:05 +020090 while (true) {
91 f_sleep(100.0);
92 }
93}
94
95control {
96 execute( TC_foo() );
97}
98
99}