blob: 721dd3236ca387e4144b43e45787a33d14fd1ad5 [file] [log] [blame]
Harald Welte023b61b2020-09-12 20:41:05 +02001module FRNET_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 := true,
Harald Welte90f19742020-11-06 19:34:40 +010016 handle_sns := false,
17 nsvc := {
18 {
19 provider := {
20 fr := {
21 netdev := "hdlc2",
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
42type component test_CT {
43 var GbInstances g_gb;
44};
45
46private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
47 var charstring id_idx := id & int2str(offset);
48 gb.vc_NS := NS_CT.create(id_idx & "-NSemu");
49 gb.vc_BSSGP := BSSGP_CT.create(id_idx & "-BSSGPemu");
50 connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
51 gb.vc_NS.start(NSStart(mp_nsconfig[offset], id_idx));
52 gb.vc_BSSGP.start(BssgpStart(gb.cfg, testcasename()));
53}
54
Harald Weltede6f3ee2020-11-11 19:01:46 +010055function f_gen_bvc(integer base, integer idx) return BssgpBvcConfig {
56 var BssgpBvcConfig bvc := {
57 bvci := base + 100 + idx,
58 cell_id := {
59 ra_id := {
60 lai := {
61 mcc_mnc := '262F42'H,
62 lac := base + 300 + idx
Harald Welte023b61b2020-09-12 20:41:05 +020063 },
Harald Weltede6f3ee2020-11-11 19:01:46 +010064 rac := 1
65 },
66 cell_id := base + 600 + idx
67 },
68 depth := BSSGP_DECODE_DEPTH_LLC
Harald Welte023b61b2020-09-12 20:41:05 +020069 };
Harald Weltede6f3ee2020-11-11 19:01:46 +010070 return bvc;
71}
72
73testcase TC_foo() runs on test_CT {
74
75 for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
76 g_gb[i].cfg := {
77 nsei := mp_nsconfig[i].nsei,
78 sgsn_role := true,
79 bvc := { }
80 };
81 /* create 'mp_num_bvc' number of BVCs */
82 for (var integer j := 0; j < mp_num_bvc; j := j+1) {
83 g_gb[i].cfg.bvc := g_gb[i].cfg.bvc & { f_gen_bvc(i * 1000, j) };
84 }
85 f_init_gb(g_gb[i], "gb", i);
86 }
87
Harald Welte023b61b2020-09-12 20:41:05 +020088 while (true) {
89 f_sleep(100.0);
90 }
91}
92
Harald Welted0770752020-11-11 19:03:41 +010093control {
94 execute( TC_foo() );
95}
96
Harald Welte023b61b2020-09-12 20:41:05 +020097
98}