WIP: Prepare MSC_Tests for ability to emulate two BSCs
Change-Id: Ibe3ae6ed4181c6ba7501f5443b4f22e3c8abeb3e
diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 497489f..c31c9eb 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -19,11 +19,15 @@
#mp_bsc_ip := "127.0.0.1";
#mp_test_ip := "127.0.0.1";
-#mp_sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" };
-#mp_own_pc := 185;
-#mp_own_ssn := 254;
-#mp_peer_pc := 187;
-#mp_peer_ssn := 254;
+#BSC_Tests.mp_bssap_cfg := {
+# sccp_service_type := "mtp3_itu",
+# sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
+# own_pc := 185,
+# own_ssn := 254,
+# peer_pc := 187,
+# peer_ssn := 254,
+# sio := '83'O
+#};
#mp_ipa_mgcp_uses_osmo_ext := true;
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..cb2b41e 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -56,7 +56,7 @@
IPA_Client rsl
}
-type component test_CT extends BSSAP_Adapter_CT, CTRL_Adapter_CT {
+type component test_CT extends CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
@@ -64,6 +64,10 @@
var MGCP_Emulation_CT vc_MGCP;
+ var BSSAP_Adapter g_bssap;
+ /* for old legacy-tests only */
+ port BSSAP_CODEC_PT BSSAP;
+
/* are we initialized yet */
var boolean g_initialized := false;
@@ -81,6 +85,36 @@
integer mp_bsc_ctrl_port := 4249;
/* IP address at which the test binds */
charstring mp_test_ip := "127.0.0.1";
+
+ BSSAP_Configuration mp_bssap_cfg := {
+ sccp_service_type := "mtp3_itu",
+ sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
+ own_pc := 185,
+ own_ssn := 254,
+ peer_pc := 187,
+ peer_ssn := 254,
+ sio := '83'O
+ };
+}
+
+private function f_legacy_bssap_reset() runs on test_CT {
+ var BSSAP_N_UNITDATA_ind ud_ind;
+ timer T := 5.0;
+ BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+ T.start;
+ alt {
+ [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) {
+ log("Received RESET-ACK in response to RESET, we're ready to go!");
+ }
+ [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind {
+ log("Respoding to inbound RESET with RESET-ACK");
+ BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
+ ts_BSSMAP_ResetAck));
+ repeat;
+ }
+ [] BSSAP.receive { repeat; }
+ [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); }
+ }
}
type record IPA_Client {
@@ -215,9 +249,11 @@
/* Call a function of our 'parent component' BSSAP_Adapter_CT to start the
* MSC-side BSSAP emulation */
if (handler_mode) {
- f_bssap_init("VirtMSC", MSC_BssmapOps);
+ f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps);
} else {
- f_bssap_init("VirtMSC", omit);
+ f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit);
+ connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT);
+ f_legacy_bssap_reset();
}
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
@@ -268,7 +304,6 @@
var BSSAP_N_UNITDATA_ind ud_ind;
f_init(1);
- f_bssap_reset();
IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
@@ -281,7 +316,6 @@
var integer chreq_total;
f_init(1);
- f_bssap_reset();
chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total");
IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
@@ -296,7 +330,6 @@
var RSL_Message rx_rsl;
f_init(1);
- f_bssap_reset();
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -315,7 +348,6 @@
var ASP_RSL_Unitdata rx_rsl_ud;
f_init(1);
- f_bssap_reset();
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -345,7 +377,6 @@
var RSL_Message rx_rsl;
f_init(1);
- f_bssap_reset();
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -367,7 +398,6 @@
var integer chact_nack;
f_init(1);
- f_bssap_reset();
chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack");
@@ -392,7 +422,6 @@
var integer chreq_total, chreq_nochan;
f_init(1);
- f_bssap_reset();
chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total");
chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel");
@@ -440,9 +469,8 @@
/* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction) */
testcase TC_outbound_connect() runs on test_CT {
f_init(1);
- f_bssap_reset();
- BSSAP.send(ts_BSSAP_CONNECT_req(g_sccp_addr_peer, g_sccp_addr_own, 2342, ts_BSSMAP_AssignmentReq));
+ BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, 2342, ts_BSSMAP_AssignmentReq));
BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?));
setverdict(pass);
}
@@ -454,7 +482,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00000000'O);
/* send assignment without AoIP IEs */
@@ -479,7 +506,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00000000'O);
/* send assignment without AoIP IEs */
@@ -560,7 +586,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00010203040506'O);
@@ -585,7 +610,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00010203040506'O);
@@ -657,7 +681,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00010203040506'O);
@@ -680,7 +703,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00010203040506'O);
@@ -696,7 +718,6 @@
var DchanTuple dt;
f_init(1);
- f_bssap_reset();
dt := f_est_dchan('23'O, 23, '00010203040506'O);
@@ -704,9 +725,9 @@
IPA_RSL[0].clear;
/* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */
- BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0)));
+ BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
interleave {
- [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
+ [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
[] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { }
}
@@ -719,7 +740,6 @@
timer T := 2.0;
f_init(1);
- f_bssap_reset();
var octetstring l3 := '00010203040506'O;
var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6));
@@ -743,7 +763,6 @@
var RslChannelNr chan_nr;
f_init(1);
- f_bssap_reset();
chan_nr := f_chreq_act_ack()
@@ -769,7 +788,6 @@
timer T := 2.0;
f_init(1);
- f_bssap_reset();
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -794,7 +812,6 @@
timer T := 2.0;
f_init(1);
- f_bssap_reset();
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -821,7 +838,6 @@
var charstring ctrl_resp;
f_init(1);
- f_bssap_reset();
/* See https://osmocom.org/issues/2729 */
f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected");
@@ -832,7 +848,6 @@
var charstring ctrl_resp;
f_init(1);
- f_bssap_reset();
f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected");
setverdict(pass);
@@ -842,7 +857,6 @@
var charstring ctrl_resp;
f_init(1);
- f_bssap_reset();
/* all below values must match the osmo-bsc.cfg config file used */
@@ -872,7 +886,7 @@
}
function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT {
- BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, bssap));
+ BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, bssap));
}
@@ -914,7 +928,6 @@
var integer i;
f_init();
- f_bssap_reset();
/* Clear the queue, it might still contain stuff like BCCH FILLING */
for (i := 0; i < sizeof(bts_ids); i := i + 1) {
@@ -982,7 +995,6 @@
var integer i;
f_init();
- f_bssap_reset();
/* Clear the queue, it might still contain stuff like BCCH FILLING */
for (i := 0; i < NUM_BTS; i := i + 1) {
@@ -1188,9 +1200,9 @@
f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all);
/* Perform a BSSMAP Reset and wait for ACK */
- BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0)));
+ BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
alt {
- [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
+ [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
[] BSSAP.receive { repeat; }
}
@@ -1223,7 +1235,6 @@
var integer rsl_fail;
f_init(1);
- f_bssap_reset();
rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail");
@@ -1251,11 +1262,11 @@
var MSC_ConnHdlr vc_conn;
vc_conn := MSC_ConnHdlr.create(id);
- connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
+ connect(vc_conn:BSSMAPEM, g_bssap.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:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC);
- connect(vc_conn:BSSAP, vc_BSSMAP:CLIENT);
+ connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
return vc_conn;