aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-12-24 13:50:26 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2022-01-05 11:27:16 +0100
commita6b9c4ced57a5300b4d550abb847537f3f1bd381 (patch)
tree6623abd23a446cdfb10dc1026b08cbb2aaa4a247
parent735ba7aa538dc4d8d3f31c0f6e6ce153a68089ab (diff)
mgw: Introduce test TC_two_crcx_mdcx_and_iuup
-rw-r--r--mgw/MGCP_Test.ttcn119
1 files changed, 119 insertions, 0 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 069eb95e..e1d713e1 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -2463,6 +2463,123 @@ module MGCP_Test {
setverdict(pass);
}
+ /* create two local RTP emulations and pass data in both directions */
+ function f_tc_two_crcx_mdcx_and_iuup(charstring local_ip_a, charstring remote_ip_a,
+ charstring local_ip_b, charstring remote_ip_b) runs on dummy_CT {
+ var RtpFlowData flow[2];
+ var RtpemStats stats[2];
+ var MgcpResponse resp;
+ var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
+ var MgcpCallId call_id := '1227'H;
+ var integer num_pkts_tx[2];
+ var integer temp;
+
+ f_init(ep);
+
+ /* Create the first connection in receive only mode (RNC side, IuUP-Init active) */
+ flow[0] := valueof(t_RtpFlow(local_ip_a, remote_ip_a, 96, "VND.3GPP.IUFP/16000"));
+ flow[0].em.portnr := 10000;
+ flow[0].rtp_cfg := c_RtpemDefaultCfg;
+ flow[0].rtp_cfg.tx_payload_type := flow[0].pt;
+ flow[0].rtp_cfg.iuup_mode := true;
+ flow[0].rtp_cfg.iuup_tx_init := true;
+ f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true);
+ f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY);
+
+ /* Create the second connection. This connection will be also
+ * in receive only mode (CN side, IuUP-Init passive) */
+ flow[1] := valueof(t_RtpFlow(local_ip_b, remote_ip_b, 96, "VND.3GPP.IUFP/16000"));
+ flow[1].em.portnr := 20000;
+ flow[1].rtp_cfg := c_RtpemDefaultCfg;
+ flow[1].rtp_cfg.tx_payload_type := flow[1].pt;
+ flow[1].rtp_cfg.iuup_mode := true;
+ flow[1].rtp_cfg.iuup_tx_init := false;
+ f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true);
+ f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY);
+
+ /* The first leg starts transmitting */
+ f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY);
+ f_sleep(0.5);
+ stats[0] := f_rtpem_stats_get(RTPEM[0]);
+ if (stats[0].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 0");
+ mtc.stop;
+ }
+ stats[1] := f_rtpem_stats_get(RTPEM[1]);
+ if (stats[1].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 1");
+ mtc.stop;
+ }
+
+ /* The second leg starts transmitting a little later */
+ f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY);
+ f_sleep(1.0);
+ stats[0] := f_rtpem_stats_get(RTPEM[0]);
+ if (stats[0].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 0");
+ mtc.stop;
+ }
+ stats[1] := f_rtpem_stats_get(RTPEM[1]);
+ if (stats[1].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 1");
+ mtc.stop;
+ }
+
+ /* The first leg will now be switched into bidirectional
+ * mode, but we do not expect any data coming back yet. */
+ f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR);
+ stats[1] := f_rtpem_stats_get(RTPEM[1]);
+ num_pkts_tx[1] := stats[1].num_pkts_tx;
+ f_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow[0]);
+ f_sleep(0.5);
+ stats[0] := f_rtpem_stats_get(RTPEM[0]);
+ if (stats[0].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 0");
+ mtc.stop;
+ }
+ stats[1] := f_rtpem_stats_get(RTPEM[1]);
+ if (stats[1].num_pkts_rx_err_disabled != 0) {
+ setverdict(fail, "received packets from MGW on recvonly connection 1");
+ mtc.stop;
+ }
+
+ /* When the second leg is switched into bidirectional mode
+ * as well, then the MGW will connect the two together and
+ * we should see RTP streams passing through from both ends. */
+ f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR);
+ stats[0] := f_rtpem_stats_get(RTPEM[0]);
+ num_pkts_tx[0] := stats[0].num_pkts_tx;
+ f_flow_modify(RTPEM[1], ep, call_id, "sendrecv", flow[1]);
+ f_sleep(2.0);
+
+ stats[0] := f_rtpem_stats_get(RTPEM[0]);
+ stats[1] := f_rtpem_stats_get(RTPEM[1]);
+
+ temp := stats[0].num_pkts_tx - num_pkts_tx[0] - stats[1].num_pkts_rx;
+ if (temp > 3 or temp < -3) {
+ setverdict(fail, "number of packets not within normal parameters:", temp);
+ mtc.stop;
+ }
+
+ temp := stats[1].num_pkts_tx - num_pkts_tx[1] - stats[0].num_pkts_rx;
+ if (temp > 3 or temp < -3) {
+ setverdict(fail, "number of packets not within normal parameters:", temp);
+ mtc.stop;
+ }
+
+ f_rtpem_stats_err_check(stats[0]);
+ f_rtpem_stats_err_check(stats[1]);
+
+ /* Tear down */
+ f_flow_delete(RTPEM[0]);
+ f_flow_delete(RTPEM[1], ep, call_id);
+ setverdict(pass);
+ }
+ testcase TC_two_crcx_mdcx_and_iuup() runs on dummy_CT {
+ f_tc_two_crcx_mdcx_and_iuup(mp_local_ipv4, mp_remote_ipv4,
+ mp_local_ipv4, mp_remote_ipv4);
+ }
+
control {
execute(TC_selftest());
execute(TC_crcx());
@@ -2537,6 +2654,8 @@ module MGCP_Test {
execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv4_ipv6());
execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4());
+ execute(TC_two_crcx_mdcx_and_iuup());
+
/* Note: This testcase will trigger an OSMO_ASSERT() bug in
* older versions of osmo-mgw. This eventually leads into
* a failure of all subsequent testcases, so it is important