aboutsummaryrefslogtreecommitdiffstats
path: root/fr/FR_Tests.ttcn
blob: 9f9b70e08c8f3bcf60673314923fec70b16f8350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
module FR_Tests {

import from General_Types all;
import from Osmocom_Types all;
import from Osmocom_Gb_Types all;

import from NS_Emulation all;
import from BSSGP_Emulation all;

modulepar {
	integer mp_num_bvc := 10;
	NSConfigurations mp_nsconfig := {
		{
			nsei := 123,
			role_sgsn := false,
			handle_sns := false,
			nsvc := {
				{
					provider := {
						fr := {
							netdev := "hdlc1",
							dlci := 123
						}
					},
					nsvci := 123
				}
			}
		}
	};
}

type record GbInstance {
	NS_CT vc_NS,
	BSSGP_CT vc_BSSGP,
	BssgpConfig cfg
};

type record of GbInstance GbInstances;
type record of NSConfiguration NSConfigurations;
type record of BssgpCellId BssgpCellIds;


type component test_CT {
	var GbInstances g_gb;
};

private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
	var charstring id_idx := id & int2str(offset);
	gb.vc_NS := NS_CT.create(id_idx & "-NSemu");
	gb.vc_BSSGP := BSSGP_CT.create(id_idx & "-BSSGPemu");
	connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
	gb.vc_NS.start(NSStart(mp_nsconfig[offset], id_idx));
	gb.vc_BSSGP.start(BssgpStart(gb.cfg, testcasename()));
}

function f_gen_bvc(integer base, integer idx) return BssgpBvcConfig {
	var BssgpBvcConfig bvc := {
		bvci := base + 100 + idx,
		cell_id := {
			ra_id := {
				lai := {
					mcc_mnc := '262F42'H,
					lac := base + 300 + idx
				},
				rac := 1
			},
			cell_id := base + 600 + idx
		},
		depth := BSSGP_DECODE_DEPTH_LLC,
		create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
	};
	return bvc;
}


testcase TC_foo() runs on test_CT {

	for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
		g_gb[i].cfg := {
			nsei := mp_nsconfig[i].nsei,
			sgsn_role := false,
			bvc := { }
		};
		/* create 'mp_num_bvc' number of BVCs */
		for (var integer j := 0; j < mp_num_bvc; j := j+1) {
			g_gb[i].cfg.bvc := g_gb[i].cfg.bvc & { f_gen_bvc(i * 1000, j) };
		}
		f_init_gb(g_gb[i], "gb", i);
	}
	while (true) {
		f_sleep(100.0);
	}
}

control {
	execute( TC_foo() );
}

}