Change in ...osmo-ttcn3-hacks[master]: WIP

pespin gerrit-no-reply at lists.osmocom.org
Mon Jun 17 14:34:17 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14493


Change subject: WIP
......................................................................

WIP

Change-Id: I21ffcaa241e4fc0bd2c6563e21f1c8bdb4d14dd6
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M library/BSSMAP_Templates.ttcn
3 files changed, 94 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/14493/1

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 00995bf..37e1bf8 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1233,6 +1233,20 @@
 	setverdict(pass);
 }
 
+/* Verify MGCP muxed over IPA from MSC (or BSC-NAT) is forwarded to MGW by BSC */
+testcase TC_assignment_mgcp_ipa() runs on test_CT {
+	var TestHdlrParams pars := f_gen_test_hdlr_pars();
+	var MSC_ConnHdlr vc_conn;
+
+	f_init(1, true);
+	f_sleep(1.0);
+
+	pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+	pars.forward_mgcp_ipa := true;
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
+	vc_conn.done;
+}
+
 function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT {
 	BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, bssap));
 }
@@ -1717,6 +1731,7 @@
 	}
 	connect(vc_conn:BSSAP, g_bssap.vc_RAN:CLIENT);
 	connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
+	connect(vc_conn:MGCP_MSC_CLIENT, g_bssap.vc_RAN:MGCP)
 }
 
 function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit)
@@ -4018,6 +4033,7 @@
 	execute( TC_ctrl() );
 	if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER) {
 		execute( TC_ctrl_location() );
+		execute( TC_assignment_mgcp_ipa() );
 	}
 
 	/* RSL DCHAN Channel ACtivation / Deactivation */
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index c709794..870103f 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -15,6 +15,7 @@
 import from General_Types all;
 import from Osmocom_Types all;
 import from GSM_Types all;
+import from IPA_Emulation all;
 import from SCCPasp_Types all;
 import from BSSAP_Types all;
 import from RAN_Emulation all;
@@ -23,6 +24,7 @@
 import from IPL4asp_Types all;
 import from Native_Functions all;
 
+import from MGCP_CodecPort all;
 import from MGCP_Types all;
 import from MGCP_Templates all;
 import from MGCP_Emulation all;
@@ -357,9 +359,19 @@
 	port RAN_PROC_PT RAN;
 	port TELNETasp_PT BSCVTY;
 
+	/* Proxy MGCP-over-IPA and MGCP-over-UDP */
+	//var MGCP_Adapter_CT vc_MGCP_UDP;
+	port IPA_MGCP_PT MGCP_MSC_CLIENT;
+	var integer g_trans_id := 0;
+	var MgcpConnectionId g_mgcp_conn_id;
+
 	var MediaState g_media;
 	var TestHdlrParams g_pars;
 
+	var charstring host_bts := "127.0.0.2";
+	var charstring host_mgw := "127.0.0.3";
+	var charstring host_msc := "127.0.0.4";
+
 	var boolean g_vty_initialized := false;
 }
 
@@ -372,6 +384,19 @@
 		f_vty_transceive(BSCVTY, "enable");
 		g_vty_initialized := true;
 	}
+
+/*
+	if (g_pars.forward_mgcp_ipa) {
+		vc_MGCP_UDP := MGCP_Adapter_CT.create(int2str(i) & "-MGCP_UDP");
+		connect(vc_BSSMAP:MGCP, vc_MGCP_UDP:MGCP);
+		vc_MGCP_UDP.start(MGCP_Adapter.main());
+	}*/
+}
+
+private function get_next_trans_id() runs on MSC_ConnHdlr return MgcpTransId {
+	var MgcpTransId tid := int2str(g_trans_id);
+	g_trans_id := g_trans_id + 1;
+	return tid;
 }
 
 /* Callback function from general RAN_Emulation whenever a connectionless
@@ -453,7 +478,8 @@
 	TestHdlrParamsLcls lcls,
 	TestHdlrParamsHandover handover optional,
 	boolean		aoip,
-	boolean		use_osmux
+	boolean		use_osmux,
+	boolean		forward_mgcp_ipa /* only used for SCCPLite: Forward MGCP towards BSC's attached MGW over BSC<->MSC IPA conn */
 };
 
 /* Note: Do not use valueof() to get a value of this template, use
@@ -478,7 +504,8 @@
 	},
 	handover := omit,
 	aoip := true,
-	use_osmux := false
+	use_osmux := false,
+	forward_mgcp_ipa := false
 }
 
 function f_create_chan_and_exp() runs on MSC_ConnHdlr {
@@ -846,6 +873,30 @@
 	}
 }
 
+/* Send a MGCP request + receive a (matching!) response */
+function mgcp_transceive_mgw(template MgcpCommand cmd, template MgcpResponse resp := ?) runs on MSC_ConnHdlr {
+	template MgcpResponse resp_any := ?
+	var MgcpResponse resp_val;
+	resp.line.trans_id := cmd.line.trans_id;
+	timer T := 5.0;
+
+	BSSAP.send(cmd);
+	T.start;
+	alt {
+		[] BSSAP.receive(resp) -> value resp_val { }
+		[] BSSAP.receive(resp_any) {
+			setverdict(fail, "Response didn't match template");
+			mtc.stop;
+			}
+		[] BSSAP.receive { repeat; }
+		[] T.timeout {
+			setverdict(fail, "Timeout waiting for response to ", cmd);
+			mtc.stop;
+			}
+	}
+	T.stop;
+}
+
 /* Helper function to check if the activity on the MGCP matches what we
  * expected */
 function f_check_mgcp_expectations() runs on MSC_ConnHdlr {
@@ -878,7 +929,7 @@
 		codecType := FR_AMR;
 	}
 
-	f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", codecType);
+	f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw, codecType);
 
 	/* patch in the LCLS related items, as needed */
 	f_ass_patch_lcls(ass_tpl, exp_ass_cpl);
@@ -964,6 +1015,7 @@
 			g_media.mgcp_conn[0].mdcx_seen_exp := 1;
 			g_media.mgcp_conn[1].crcx_seen_exp := 0;
 			g_media.mgcp_conn[1].mdcx_seen_exp := 0;
+			/* FIXME: may want to add something here */
 		} else {
 			g_media.mgcp_conn[0].crcx_seen_exp := 1;
 			g_media.mgcp_conn[0].mdcx_seen_exp := 1;
@@ -1028,6 +1080,24 @@
 		}
 	}
 
+	if (g_pars.forward_mgcp_ipa) {
+		/* With SCCPLite, connect to BSC-located MGW using a CRCX + SDP.
+		   It is sent in MGCP over IPA in the BSC<->MSC (BSC-NAT)
+		   connection. BSC will forward it to its MGW. */
+		var template MgcpCommand cmd;
+		var template MgcpResponse resp := ?;
+		var integer cic := f_bssmap_ie_cic_2_int(ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode);
+		var MgcpEndpoint ep := int2str(cic) & "@mgw"; /* 1: matches value configured in BSC_Tests.ttcn pass in AssignReq */
+		var MgcpCallId call_id := '51234'H;
+		var SDP_attribute_list attributes := { valueof(ts_SDP_ptime(20)) };
+		cmd := ts_CRCX(get_next_trans_id(), ep, "sendrecv", call_id);
+		cmd.sdp := ts_SDP(host_msc, host_mgw, "23", "42",
+			     14000, { int2str(g_media.mgcp_conn[0].rtp_pt) },
+			     { valueof(ts_SDP_ptime(20)) });
+		g_mgcp_conn_id := f_mgcp_alloc_conn_id();
+		mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
+	}
+
 	f_check_mgcp_expectations();
 
 	if (st.is_assignment and st.assignment_done) {
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index b377358..9015680 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -402,6 +402,11 @@
 	cicLow := bit2oct((substr(int2bit(span, 11), 8, 3) << 5) & int2bit(ts, 5))
 }
 
+function f_bssmap_ie_cic_2_int(BSSMAP_IE_CircuitIdentityCode cic_ie) return integer {
+	var integer cic := (oct2int(cic_ie.cicHigh) * 256) + oct2int(cic_ie.cicLow);
+	return cic;
+}
+
 template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA(BSSMAP_FIELD_IPAddress addr,
 									    uint16_t udp_port,
 									    integer len) := {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14493
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I21ffcaa241e4fc0bd2c6563e21f1c8bdb4d14dd6
Gerrit-Change-Number: 14493
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190617/8586b217/attachment.html>


More information about the gerrit-log mailing list