summaryrefslogtreecommitdiffstats
path: root/bsc-nat/MSC_Simulation.ttcn
blob: bc47f89f0e85e1368e701f3830714451a165d73f (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
module MSC_Simulation {

import from IPL4asp_Types all;

import from IPA_Emulation all;

import from SCCP_Types all;
import from SCCPasp_Types all;
import from SCCP_Emulation all;

/* 
import from MobileL3_Types all;
import from MobileL3_CommonIE_Types all;
import from L3_Templates all;

import from BSSAP_Types all;
import from BSSMAP_Templates all;
*/
import from RAN_Emulation all;

import from MGCP_Adapter all;

import from MSC_ConnectionHandler all;

type component MSC_CT {
	/* component references */
	var IPA_Emulation_CT vc_IPA;
	var SCCP_CT vc_SCCP;
	var RAN_Emulation_CT vc_BSSMAP;
	var MGCP_Adapter_CT vc_MGCP_UDP;
	/* test port to SCCP emulation */
	port SCCPasp_PT SCCP;
}

modulepar {
	boolean mp_mgcp_uses_udp := false;
}

function main(charstring local_ip, PortNumber local_port,
	      MSC_SCCP_MTP3_parameters sccp_pars,
	      SCCP_PAR_Address sccp_addr_own, charstring id) runs on MSC_CT
{
	/* create components */
	vc_IPA := IPA_Emulation_CT.create(id & "-IPA");
	vc_SCCP := SCCP_CT.create(id & "-SCCP");
	vc_BSSMAP := RAN_Emulation_CT.create(id & "-BSSMAP");

	map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT);

	/* connect MTP3 service provider (IPA) to lower side of SCCP */
	connect(vc_IPA:MTP3_SP_PORT, vc_SCCP:MTP3_SCCP_PORT);

	/* connect BSSNAP dispatcher to upper side of SCCP */
	connect(vc_BSSMAP:BSSAP, vc_SCCP:SCCP_SP_PORT);

	if (mp_mgcp_uses_udp == false) {
		/* connect BSSMAP dispatcher to IPA_Emulation MGCP */
		connect(vc_BSSMAP:MGCP, vc_IPA:IPA_MGCP_PORT);
	} else {
		vc_MGCP_UDP := MGCP_Adapter_CT.create(id & "-MGCP_UDP");
		connect(vc_BSSMAP:MGCP, vc_MGCP_UDP:MGCP);
		vc_MGCP_UDP.start(MGCP_Adapter.main());
	}

	vc_IPA.start(IPA_Emulation.main_server(local_ip, local_port));
	vc_SCCP.start(SCCPStart(sccp_pars));
	vc_BSSMAP.start(RAN_Emulation.main(MSC_ConnectionHandler.MSC_RanOps, id & "-BSSMAP"));

	/* wait until termination of respective components */
	vc_IPA.done;
	vc_BSSMAP.done;
	vc_SCCP.done;
	if (mp_mgcp_uses_udp) {
		vc_MGCP_UDP.done;
	}
}

}