mgw: Introduce test to validate Osmux<->RTP-AMR-BWE
Related: SYS#6161
Change-Id: I974e265938da15639acae7e2c9c589d5784ae5c5
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 5ff5247..3b49afc 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -1339,7 +1339,7 @@
return true;
}
- function f_TC_two_crcx_and_rtp_osmux(boolean bidir,
+ function f_TC_two_crcx_and_rtp_osmux(boolean bidir, boolean rtp_amr_oa,
charstring local_ip_rtp, charstring remote_ip_rtp,
charstring local_ip_osmux, charstring remote_ip_osmux) runs on dummy_CT {
var RtpFlowData flow[2];
@@ -1350,15 +1350,35 @@
var MgcpCallId call_id := '1226'H;
var integer tolerance := 0;
+ var octetstring amr_payload;
+ var charstring fmtp;
+
f_init(ep, true);
+ var AMRFT cmr := AMR_FT_0;
+ var AMRFT ft := AMR_FT_2;
+ if (rtp_amr_oa) {
+ fmtp := "octet-align=1";
+ var RTP_AMR_Hdr amr_oa_hdr := valueof(ts_RTP_AMR_Hdr(enum2int(cmr), enum2int(ft)));
+ amr_payload := enc_RTP_AMR_Hdr(amr_oa_hdr) &
+ f_osmux_gen_expected_rx_rtp_payload(enum2int(ft), c_OsmuxemDefaultCfg.tx_fixed_payload);
+ } else {
+ fmtp := "octet-align=0";
+ /* Convert OA to BWE: */
+ var RTP_AMR_BWE_Hdr amr_bwe_hdr := valueof(ts_RTP_AMR_BWE_Hdr(enum2int(cmr), enum2int(ft)));
+ var bitstring amr_bwe_hdr_bits := substr(oct2bit(enc_RTP_AMR_BWE_Hdr(amr_bwe_hdr)), 0 , 10);
+ var bitstring amr_data_bits := oct2bit(f_osmux_gen_expected_rx_rtp_payload(enum2int(ft), c_OsmuxemDefaultCfg.tx_fixed_payload));
+ var bitstring amr_payload_bits := amr_bwe_hdr_bits & substr(amr_data_bits, 0, f_amrft_payload_bits_len(enum2int(ft)));
+ amr_payload := bit2oct(f_pad_bit(amr_payload_bits, (lengthof(amr_payload_bits)+7)/8*8, '0'B));
+ };
+
/* from us to MGW */
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 */
- flow[0].rtp_cfg.rx_fixed_payload := '0014'O & f_osmux_gen_expected_rx_rtp_payload(2 /* AMR_FT_2, 5.90 */, c_OsmuxemDefaultCfg.tx_fixed_payload);
- flow[0].rtp_cfg.tx_fixed_payload := flow[0].rtp_cfg.rx_fixed_payload;
+ flow[0].rtp_cfg.rx_fixed_payload := amr_payload;
+ flow[0].rtp_cfg.tx_fixed_payload := amr_payload;
+ flow[0].fmtp := fmtp;
/* bind local RTP emulation sockets */
flow[0].em.portnr := 10000;
f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]);
@@ -1409,30 +1429,39 @@
/* 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, mp_local_ipv4, mp_remote_ipv4,
+ f_TC_two_crcx_and_rtp_osmux(false, true, 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, mp_local_ipv4, mp_remote_ipv4,
+ f_TC_two_crcx_and_rtp_osmux(true, true, 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. RTP side is configured to
+ * rx/rx AMR in bandwidth-efficient mode. */
+ testcase TC_two_crcx_and_rtp_osmux_bidir_amr_bwe() runs on dummy_CT {
+ f_TC_two_crcx_and_rtp_osmux(true, false, 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,
+ f_TC_two_crcx_and_rtp_osmux(true, 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,
+ f_TC_two_crcx_and_rtp_osmux(true, 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,
+ f_TC_two_crcx_and_rtp_osmux(true, true, mp_local_ipv6, mp_remote_ipv6,
mp_local_ipv4, mp_remote_ipv4);
}
@@ -2915,6 +2944,7 @@
execute(TC_one_crcx_loopback_osmux());
execute(TC_two_crcx_and_rtp_osmux());
execute(TC_two_crcx_and_rtp_osmux_bidir());
+ execute(TC_two_crcx_and_rtp_osmux_bidir_amr_bwe());
execute(TC_two_crcx_mdcx_and_rtp_osmux_wildcard());
execute(TC_two_crcx_mdcx_and_rtp_osmux_fixed());