Change in osmo-ttcn3-hacks[master]: BTS: equip ConnHdlr with the RTP emulation component

laforge gerrit-no-reply at lists.osmocom.org
Fri Jul 16 16:05:52 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24842 )

Change subject: BTS: equip ConnHdlr with the RTP emulation component
......................................................................

BTS: equip ConnHdlr with the RTP emulation component

Change-Id: Icb04cb73d8d55eb75edc2af2f18bb99d2c3f24a5
---
M bts/BTS_Tests.ttcn
M bts/gen_links.sh
M bts/regen_makefile.sh
3 files changed, 68 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  neels: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index a7fdf16..38490a0 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -44,6 +44,7 @@
 import from IPA_Emulation all;
 import from IPA_Testing all;
 import from RSL_Emulation all;
+import from RTP_Emulation all;
 
 import from IPL4asp_Types all;
 import from TRXC_Types all;
@@ -93,6 +94,8 @@
 	integer mp_ctrl_port := 4238;
 	charstring mp_bsc_ctrl_ip := "127.0.0.1";
 	integer mp_bsc_ctrl_port := 4249;
+	charstring mp_rtpem_bind_ip := "127.0.0.1";
+	integer mp_rtpem_bind_port := 6766;
 	integer mp_tolerance_rxqual := 1;
 	integer mp_tolerance_rxlev := 3;
 	integer mp_tolerance_timing_offset_256syms := 0;
@@ -205,6 +208,10 @@
 
 	/* PCU Interface of BTS */
 	port PCUIF_CODEC_PT PCU;
+
+	var RTP_Emulation_CT vc_RTPEM;
+	port RTPEM_CTRL_PT RTPEM_CTRL;
+	port RTPEM_DATA_PT RTPEM_DATA;
 }
 
 private function f_init_rsl(charstring id) runs on test_CT {
@@ -2285,6 +2292,60 @@
 	g_first_meas_res := true;
 }
 
+/* Initialize and start the RTP emulation component for a ConnHdlr */
+friend function f_rtpem_activate(inout octetstring payload,
+				 RtpemConfig cfg := c_RtpemDefaultCfg,
+				 RtpemMode mode := RTPEM_MODE_BIDIR)
+runs on ConnHdlr {
+	/* Step 0: initialize, connect and start the emulation component */
+	vc_RTPEM := RTP_Emulation_CT.create(testcasename() & "-RTPEM");
+	map(vc_RTPEM:RTP, system:RTP);
+	map(vc_RTPEM:RTCP, system:RTCP);
+	connect(vc_RTPEM:CTRL, self:RTPEM_CTRL);
+	connect(vc_RTPEM:DATA, self:RTPEM_DATA);
+	vc_RTPEM.start(RTP_Emulation.f_main());
+
+	/* Step 1: configure the RTP parameters */
+	var integer payload_len := 0;
+	var octetstring hdr := ''O;
+
+	select (g_pars.chan_mode) {
+	case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1)) /* TCH/FS */
+		{ payload_len := 33; hdr := 'D0'O; }
+	case (tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1)) /* TCH/HS */
+		{ payload_len := 15; hdr := '00'O; }
+	case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2)) /* TCH/EFS */
+		{ payload_len := 31; hdr := 'C0'O; }
+	case else { /* FIXME: also handle TCH/AFS and TCH/AHS */
+		setverdict(fail, "Unhandled RSL channel mode := ", g_pars.chan_mode);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+		}
+	}
+
+	/* Pad the payload to conform the expected length */
+	payload := f_pad_oct(hdr & payload, payload_len, '00'O);
+	cfg.tx_fixed_payload := payload;
+	f_rtpem_configure(RTPEM_CTRL, cfg);
+
+	/* Step 2: bind the RTP emulation to the configured address */
+	var PortNumber rtpem_bind_port := mp_rtpem_bind_port;
+	f_rtpem_bind(RTPEM_CTRL, mp_rtpem_bind_ip, rtpem_bind_port);
+
+	/* Step 3: send CRCX with the configured address/port to the IUT */
+	var RSL_Message rsl_pdu := f_rsl_transceive_ret(
+		ts_RSL_IPA_CRCX(g_chan_nr, f_inet_addr(mp_rtpem_bind_ip), rtpem_bind_port),
+		tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
+		"IPA CRCX ACK");
+
+	/* Step 4: connect to the IUT's address/port parsed from CRCX ACK */
+	var HostName local_addr := f_inet_ntoa(rsl_pdu.ies[2].body.ipa_local_ip);
+	var PortNumber local_port := rsl_pdu.ies[3].body.ipa_local_port;
+	f_rtpem_connect(RTPEM_CTRL, local_addr, local_port);
+
+	/* Step 5: set the given RTP emulation mode */
+	f_rtpem_mode(RTPEM_CTRL, mode);
+}
+
 /* establish DChan, verify existance + contents of measurement reports */
 private function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr {
 	f_l1_tune(L1CTL);
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index cd8e379..c8c2b98 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -32,6 +32,10 @@
 FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
 gen_links $DIR $FILES
 
+DIR=$BASEDIR/titan.ProtocolModules.RTP/src
+FILES="RTP_EncDec.cc RTP_Types.ttcn"
+gen_links $DIR $FILES
+
 DIR=../library
 FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_VTY_Functions.ttcn GSM_SystemInformation.ttcn GSM_RestOctets.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
@@ -40,6 +44,8 @@
 FILES+="L3_Templates.ttcn L3_Common.ttcn "
 FILES+="Native_Functions.ttcn Native_FunctionDefs.cc "
 FILES+="TRXC_Types.ttcn TRXC_CodecPort.ttcn TRXC_CodecPort_CtrlFunct.ttcn TRXC_CodecPort_CtrlFunctDef.cc "
+FILES+="RTP_CodecPort.ttcn RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_Emulation.ttcn IuUP_EncDec.cc "
+FILES+="RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc "
 FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn "
 FILES+="IPA_Testing.ttcn"
 gen_links $DIR $FILES
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 8771500..42ad0f3 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc TELNETasp_PT.cc"
+FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc TELNETasp_PT.cc IuUP_EncDec.cc RTP_EncDec.cc RTP_CodecPort_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL -DIPA_EMULATION_OML -DIPA_EMULATION_CTRL -DIPA_EMULATION_OSMO_PCU"
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24842
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: Icb04cb73d8d55eb75edc2af2f18bb99d2c3f24a5
Gerrit-Change-Number: 24842
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210716/f3ebe995/attachment.htm>


More information about the gerrit-log mailing list