mgw: Test IPv6 RTP streams in osmo-mgw

Change-Id: I2a47926757af84ffa190a954aac0dcc5369528b3
This commit is contained in:
Pau Espin 2020-09-07 17:25:56 +02:00 committed by pespin
parent 24c0599541
commit 9e0141aa84
1 changed files with 83 additions and 17 deletions

View File

@ -65,8 +65,10 @@ module MGCP_Test {
modulepar {
PortNumber mp_local_udp_port := 2727;
charstring mp_local_ipv4 := "127.0.0.1";
charstring mp_local_ipv6 := "::1";
PortNumber mp_remote_udp_port := 2427;
charstring mp_remote_ipv4 := "127.0.0.1";
charstring mp_remote_ipv6 := "::1";
PortNumber mp_local_rtp_port_base := 10000;
PortNumber mp_local_osmux_port := 1985;
}
@ -1186,7 +1188,9 @@ module MGCP_Test {
return true;
}
function f_TC_two_crcx_and_rtp_osmux(boolean bidir) runs on dummy_CT {
function f_TC_two_crcx_and_rtp_osmux(boolean bidir,
charstring local_ip_rtp, charstring remote_ip_rtp,
charstring local_ip_osmux, charstring remote_ip_osmux) runs on dummy_CT {
var RtpFlowData flow[2];
var RtpemStats stats_rtp;
var OsmuxemStats stats_osmux;
@ -1198,7 +1202,7 @@ module MGCP_Test {
f_init(ep, true);
/* from us to MGW */
flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000"));
flow[0] := valueof(t_RtpFlow(local_ip_rtp, remote_ip_rtp, 112, "AMR/8000"));
flow[0].rtp_cfg := c_RtpemDefaultCfg
flow[0].rtp_cfg.tx_payload_type := flow[0].pt;
/* 0014 is the ToC (CMR=AMR4.75) in front of AMR Payload in RTP Payload */
@ -1209,7 +1213,7 @@ module MGCP_Test {
f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]);
/* from MGW back to us */
flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 110, "AMR/8000"));
flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000"));
flow[1].em.portnr := mp_local_osmux_port;
flow[1].osmux_cid := 2;
flow[1].osmux_cfg := c_OsmuxemDefaultCfg;
@ -1254,17 +1258,37 @@ module MGCP_Test {
/* create one RTP and one OSmux emulations; create two connections on MGW EP, exchange some data */
testcase TC_two_crcx_and_rtp_osmux() runs on dummy_CT {
f_TC_two_crcx_and_rtp_osmux(false);
f_TC_two_crcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv4, mp_remote_ipv4);
}
/* create one RTP and one OSmux emulations; create two connections on MGW EP,
* exchange some data in both directions */
testcase TC_two_crcx_and_rtp_osmux_bidir() runs on dummy_CT {
f_TC_two_crcx_and_rtp_osmux(true);
f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv4, mp_remote_ipv4);
}
/* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv6 */
testcase TC_two_crcx_and_rtp_osmux_bidir_ipv6() runs on dummy_CT {
f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv6, mp_remote_ipv6);
}
/* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv4 (RTP) and IPv6 (Osmux) */
testcase TC_two_crcx_and_rtp_osmux_bidir_ipv4_ipv6() runs on dummy_CT {
f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv6, mp_remote_ipv6);
}
/* Same as TC_two_crcx_and_rtp_osmux_bidir, but using IPv6 (RTP) and IPv4 (Osmux) */
testcase TC_two_crcx_and_rtp_osmux_bidir_ipv6_ipv4() runs on dummy_CT {
f_TC_two_crcx_and_rtp_osmux(true, mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv4, mp_remote_ipv4);
}
function f_two_crcx_mdcx_and_rtp_osmux(boolean crcx_osmux_wildcard) runs on dummy_CT {
function f_two_crcx_mdcx_and_rtp_osmux(boolean crcx_osmux_wildcard,
charstring local_ip_rtp, charstring remote_ip_rtp,
charstring local_ip_osmux, charstring remote_ip_osmux) runs on dummy_CT {
var RtpFlowData flow[2];
var RtpemStats stats_rtp;
var OsmuxemStats stats_osmux;
@ -1277,7 +1301,7 @@ module MGCP_Test {
f_init(ep, true);
/* Create the first connection in receive only mode */
flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 112, "AMR/8000"));
flow[0] := valueof(t_RtpFlow(local_ip_rtp, remote_ip_rtp, 112, "AMR/8000"));
flow[0].rtp_cfg := c_RtpemDefaultCfg
flow[0].rtp_cfg.tx_payload_type := flow[0].pt;
/* 0014 is the ToC (CMR=AMR4.75) in front of AMR Payload in RTP Payload */
@ -1285,12 +1309,12 @@ module MGCP_Test {
flow[0].rtp_cfg.tx_fixed_payload := flow[0].rtp_cfg.rx_fixed_payload;
/* bind local RTP emulation sockets */
flow[0].em.portnr := 10000;
f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], false);
f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true);
/* Create the second connection. This connection will be also
* in receive only mode */
flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 110, "AMR/8000"));
flow[1] := valueof(t_RtpFlow(local_ip_osmux, remote_ip_osmux, 110, "AMR/8000"));
flow[1].em.portnr := mp_local_osmux_port;
if (crcx_osmux_wildcard) {
flow[1].osmux_cid := -1;
@ -1298,7 +1322,7 @@ module MGCP_Test {
flow[1].osmux_cid := 2;
}
flow[1].osmux_cfg := c_OsmuxemDefaultCfg;
f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow[1], false);
f_flow_create_osmux(OsmuxEM, ep, call_id, "recvonly", flow[1], true);
/* The first leg starts transmitting */
@ -1393,14 +1417,32 @@ module MGCP_Test {
directions. Create CRCX with wildcard Osmux CID and set it later
during MDCX. This is similar to how MSC sets up the call in AoIP. */
testcase TC_two_crcx_mdcx_and_rtp_osmux_wildcard() runs on dummy_CT {
f_two_crcx_mdcx_and_rtp_osmux(true);
f_two_crcx_mdcx_and_rtp_osmux(true, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv4, mp_remote_ipv4);
}
/* create one RTP and one OSmux emulations and pass data in both
directions. Create CRCX with fixed Osmux CID and keep it during
MDCX. This is similar to how BSC sets up the call in AoIP. */
testcase TC_two_crcx_mdcx_and_rtp_osmux_fixed() runs on dummy_CT {
f_two_crcx_mdcx_and_rtp_osmux(false);
f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv4, mp_remote_ipv4);
}
/* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv6. */
testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv6() runs on dummy_CT {
f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv6, mp_remote_ipv6);
}
/* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv4 (RTP) and IPv6 (Osmux). */
testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv4_ipv6() runs on dummy_CT {
f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv6, mp_remote_ipv6);
}
/* Same as TC_two_crcx_mdcx_and_rtp_osmux_wildcard, but using IPv6 (RTP) and IPv4 (Osmux). */
testcase TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4() runs on dummy_CT {
f_two_crcx_mdcx_and_rtp_osmux(false, mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv4, mp_remote_ipv4);
}
function f_crcx_and_dlcx_ep_callid_connid(MgcpEndpoint ep, MgcpCallId call_id) runs on dummy_CT {
@ -1727,7 +1769,8 @@ module MGCP_Test {
}
/* create two local RTP emulations and pass data in both directions */
testcase TC_two_crcx_mdcx_and_rtp() runs on dummy_CT {
function f_tc_two_crcx_mdcx_and_rtp(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;
@ -1739,15 +1782,15 @@ module MGCP_Test {
f_init(ep);
/* Create the first connection in receive only mode */
flow[0] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 3, "GSM/8000/1"));
flow[0] := valueof(t_RtpFlow(local_ip_a, remote_ip_a, 3, "GSM/8000/1"));
flow[0].em.portnr := 10000;
f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], false);
f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true);
/* Create the second connection. This connection will be also
* in receive only mode */
flow[1] := valueof(t_RtpFlow(mp_local_ipv4, mp_remote_ipv4, 3, "GSM/8000/1"));
flow[1] := valueof(t_RtpFlow(local_ip_b, remote_ip_b, 3, "GSM/8000/1"));
flow[1].em.portnr := 20000;
f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], false);
f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true);
/* The first leg starts transmitting */
f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY);
@ -1828,6 +1871,21 @@ module MGCP_Test {
setverdict(pass);
}
testcase TC_two_crcx_mdcx_and_rtp() runs on dummy_CT {
f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv4, mp_remote_ipv4);
}
testcase TC_two_crcx_mdcx_and_rtp_ipv6() runs on dummy_CT {
f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv6, mp_remote_ipv6);
}
testcase TC_two_crcx_mdcx_and_rtp_ipv4_ipv6() runs on dummy_CT {
f_tc_two_crcx_mdcx_and_rtp(mp_local_ipv4, mp_remote_ipv4,
mp_local_ipv6, mp_remote_ipv6);
}
/* Test what happens when two RTP streams from different sources target
* a single connection. Is the unsolicited stream properly ignored? */
testcase TC_two_crcx_and_unsolicited_rtp() runs on dummy_CT {
@ -2358,5 +2416,13 @@ module MGCP_Test {
execute(TC_crcx_mdcx_ip4());
execute(TC_crcx_mdcx_ip6());
execute(TC_two_crcx_mdcx_and_rtp_ipv4_ipv6());
execute(TC_two_crcx_mdcx_and_rtp_ipv6());
execute(TC_two_crcx_and_rtp_osmux_bidir_ipv6());
execute(TC_two_crcx_and_rtp_osmux_bidir_ipv4_ipv6());
execute(TC_two_crcx_and_rtp_osmux_bidir_ipv6_ipv4());
execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6());
execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv4_ipv6());
execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4());
}
}