bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for MGCP
forward-ported by Harald Welte Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
This commit is contained in:
parent
3826a1bd1d
commit
191e0d9260
|
@ -31,6 +31,7 @@ import from IPA_Emulation all;
|
|||
import from IPA_Types all;
|
||||
import from RSL_Types all;
|
||||
import from RSL_Emulation all;
|
||||
import from MGCP_Emulation all;
|
||||
|
||||
import from Osmocom_CTRL_Functions all;
|
||||
import from Osmocom_CTRL_Types all;
|
||||
|
@ -59,6 +60,8 @@ type component test_CT extends BSSAP_Adapter_CT, CTRL_Adapter_CT {
|
|||
/* array of per-BTS RSL test ports */
|
||||
port IPA_RSL_PT IPA_RSL[NUM_BTS];
|
||||
|
||||
var MGCP_Emulation_CT vc_MGCP;
|
||||
|
||||
/* are we initialized yet */
|
||||
var boolean g_initialized := false;
|
||||
|
||||
|
@ -74,6 +77,8 @@ modulepar {
|
|||
integer mp_bsc_rsl_port := 3003;
|
||||
/* port number to which to establish the IPA CTRL connection */
|
||||
integer mp_bsc_ctrl_port := 4249;
|
||||
/* IP address at which the test binds */
|
||||
charstring mp_test_ip := "127.0.0.1";
|
||||
}
|
||||
|
||||
type record IPA_Client {
|
||||
|
@ -176,6 +181,24 @@ altstep as_Tguard() runs on test_CT {
|
|||
}
|
||||
}
|
||||
|
||||
function f_init_mgcp(charstring id) runs on test_CT {
|
||||
id := id & "-MGCP";
|
||||
|
||||
var MGCPOps ops := {
|
||||
create_cb := refers(MGCP_Emulation.ExpectedCreateCallback),
|
||||
unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback)
|
||||
};
|
||||
var MGCP_conn_parameters mgcp_pars := {
|
||||
callagent_ip := mp_bsc_ip,
|
||||
callagent_udp_port := 2727,
|
||||
mgw_ip := mp_test_ip,
|
||||
mgw_udp_port := 2427
|
||||
};
|
||||
|
||||
vc_MGCP := MGCP_Emulation_CT.create(id);
|
||||
vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
|
||||
}
|
||||
|
||||
/* global initialization function
|
||||
* \param nr_bts Number of BTSs we should start/bring up
|
||||
* \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */
|
||||
|
@ -196,6 +219,8 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs o
|
|||
}
|
||||
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
|
||||
|
||||
f_init_mgcp("VirtMSC");
|
||||
|
||||
for (i := 0; i < nr_bts; i := i+1) {
|
||||
/* wait until osmo-bts-omldummy has respawned */
|
||||
f_wait_oml(i, "degraded", 5.0);
|
||||
|
@ -1197,8 +1222,10 @@ function f_start_handler(void_fn fn, charstring id) runs on test_CT return MSC_C
|
|||
|
||||
vc_conn := MSC_ConnHdlr.create(id);
|
||||
connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
|
||||
connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
|
||||
connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
|
||||
connect(vc_conn:BSSAP, vc_BSSMAP:CLIENT);
|
||||
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
|
||||
vc_conn.start(derefers(fn)(id));
|
||||
return vc_conn;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import from BSSMAP_Templates all;
|
|||
|
||||
import from MGCP_Types all;
|
||||
import from MGCP_Templates all;
|
||||
import from MGCP_Emulation all;
|
||||
import from SDP_Types all;
|
||||
|
||||
import from RSL_Emulation all;
|
||||
|
@ -24,7 +25,7 @@ import from L3_Templates all;
|
|||
/* this component represents a single subscriber connection at the MSC.
|
||||
* There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr components.
|
||||
* We inherit all component variables, ports, functions, ... from BSSAP_ConnHdlr */
|
||||
type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr {
|
||||
type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr {
|
||||
/* SCCP Connecction Identifier for the underlying SCCP connection */
|
||||
var integer g_sccp_conn_id;
|
||||
|
||||
|
@ -55,6 +56,10 @@ const BssmapOps MSC_BssmapOps := {
|
|||
role_ms := false
|
||||
}
|
||||
|
||||
const MGCPOps MSC_MGCPOps := {
|
||||
create_cb := refers(MGCP_Emulation.ExpectedCreateCallback)
|
||||
}
|
||||
|
||||
type enumerated MSC_State {
|
||||
MSC_STATE_NONE,
|
||||
MSC_STATE_WAIT_ASS_COMPL,
|
||||
|
@ -65,7 +70,7 @@ type enumerated MSC_State {
|
|||
}
|
||||
|
||||
/* register an expect with the BSSMAP core */
|
||||
private function f_create_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
|
||||
private function f_create_bssmap_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
|
||||
BSSMAPEM.call(BSSMAPEM_register:{l3_enc, self}) {
|
||||
[] BSSMAPEM.getreply(BSSMAPEM_register:{?, ?}) {};
|
||||
}
|
||||
|
@ -92,7 +97,7 @@ function f_create_chan_and_exp(TestHdlrParams pars) runs on MSC_ConnHdlr {
|
|||
|
||||
/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
|
||||
RSL_Emulation.f_chan_est(pars.ra, l3_enc, pars.link_id, pars.fn);
|
||||
f_create_exp(l3_enc);
|
||||
f_create_bssmap_exp(l3_enc);
|
||||
}
|
||||
|
||||
function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on MSC_ConnHdlr {
|
||||
|
@ -184,10 +189,14 @@ runs on MSC_ConnHdlr return PDU_BSSAP {
|
|||
crcx_seen := true;
|
||||
repeat;
|
||||
}
|
||||
/* mgw CRCX goes here */
|
||||
|
||||
[crcx_seen] RSL.receive(tr_RSL_IPA_MDCX(g_chan_nr, ?)) -> value rsl{
|
||||
RSL.send(ts_RSL_IPA_MDCX_ACK(g_chan_nr, 1, 1, 1, 1));
|
||||
repeat;
|
||||
}
|
||||
/* mgw MGCX goes here */
|
||||
|
||||
[exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
|
||||
setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue