Harald Welte has submitted this change and it was merged.

Change subject: bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for 
MGCP
......................................................................


bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for MGCP

forward-ported by Harald Welte

Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
2 files changed, 39 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 6b5ce24..8766503 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -31,6 +31,7 @@
 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 @@
        /* 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 @@
        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 @@
                }
 }
 
+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) */
@@ -195,6 +218,8 @@
                f_bssap_init("VirtMSC", omit);
        }
        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 */
@@ -1197,8 +1222,10 @@
 
        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;
 }
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d1be0ef..3dbb782 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -10,6 +10,7 @@
 
 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 @@
 /* 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 @@
        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 @@
 }
 
 /* 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 @@
 
        /* 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 @@
                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");
                }

-- 
To view, visit https://gerrit.osmocom.org/6166
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>

Reply via email to