Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module MSC_Simulation { |
| 2 | |
| 3 | import from IPL4asp_Types all; |
| 4 | |
| 5 | import from IPA_Emulation all; |
| 6 | |
| 7 | import from SCCP_Types all; |
| 8 | import from SCCPasp_Types all; |
| 9 | import from SCCP_Emulation all; |
| 10 | |
| 11 | /* |
| 12 | import from MobileL3_Types all; |
| 13 | import from MobileL3_CommonIE_Types all; |
| 14 | import from L3_Templates all; |
| 15 | |
| 16 | import from BSSAP_Types all; |
| 17 | import from BSSMAP_Templates all; |
| 18 | */ |
| 19 | import from BSSMAP_Emulation all; |
| 20 | |
| 21 | import from MGCP_Adapter all; |
| 22 | |
| 23 | import from MSC_ConnectionHandler all; |
| 24 | |
| 25 | type component MSC_CT { |
| 26 | /* component references */ |
| 27 | var IPA_Emulation_CT vc_IPA; |
| 28 | var SCCP_CT vc_SCCP; |
| 29 | var BSSMAP_Emulation_CT vc_BSSMAP; |
| 30 | var MGCP_Adapter_CT vc_MGCP_UDP; |
| 31 | /* test port to SCCP emulation */ |
| 32 | port SCCPasp_PT SCCP; |
| 33 | } |
| 34 | |
| 35 | modulepar { |
| 36 | boolean mp_mgcp_uses_udp := false; |
| 37 | } |
| 38 | |
| 39 | function main(charstring local_ip, PortNumber local_port, |
| 40 | MSC_SCCP_MTP3_parameters sccp_pars, |
| 41 | SCCP_PAR_Address sccp_addr_own, charstring id) runs on MSC_CT |
| 42 | { |
| 43 | /* create components */ |
| 44 | vc_IPA := IPA_Emulation_CT.create(id & "-IPA"); |
| 45 | vc_SCCP := SCCP_CT.create(id & "-SCCP"); |
| 46 | vc_BSSMAP := BSSMAP_Emulation_CT.create(id & "-BSSMAP"); |
| 47 | |
| 48 | map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 49 | |
| 50 | /* connect MTP3 service provider (IPA) to lower side of SCCP */ |
| 51 | connect(vc_IPA:MTP3_SP_PORT, vc_SCCP:MTP3_SCCP_PORT); |
| 52 | |
| 53 | /* connect BSSNAP dispatcher to upper side of SCCP */ |
| 54 | connect(vc_BSSMAP:SCCP, vc_SCCP:SCCP_SP_PORT); |
| 55 | |
| 56 | if (mp_mgcp_uses_udp == false) { |
| 57 | /* connect BSSMAP dispatcher to IPA_Emulation MGCP */ |
| 58 | connect(vc_BSSMAP:MGCP, vc_IPA:IPA_MGCP_PORT); |
| 59 | } else { |
| 60 | vc_MGCP_UDP := MGCP_Adapter_CT.create(id & "-MGCP_UDP"); |
| 61 | connect(vc_BSSMAP:MGCP, vc_MGCP_UDP:MGCP); |
| 62 | vc_MGCP_UDP.start(MGCP_Adapter.main()); |
| 63 | } |
| 64 | |
| 65 | vc_IPA.start(IPA_Emulation.main_server(local_ip, local_port)); |
| 66 | vc_SCCP.start(SCCPStart(sccp_pars)); |
| 67 | vc_BSSMAP.start(BSSMAP_Emulation.main(MSC_BssmapOps, id & "-BSSMAP")); |
| 68 | |
| 69 | /* wait until termination of respective components */ |
| 70 | vc_IPA.done; |
| 71 | vc_BSSMAP.done; |
| 72 | vc_SCCP.done; |
| 73 | if (mp_mgcp_uses_udp) { |
| 74 | vc_MGCP_UDP.done; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | } |