diff options
-rw-r--r-- | mgw/MGCP_Test.ttcn | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index b75fd690..7568ac9f 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -3168,6 +3168,107 @@ module MGCP_Test { mp_local_ipv4, mp_remote_ipv4); } + /* Set up Endpoint with 1 IuUP conn and 1 RTP-AMR conn, then MDCX the later to become IuUP. */ + function f_tc_two_crcx_mdcx_and_iuup_rtp_mdcx_to_iuup(charstring local_ip_a, charstring remote_ip_a, + IuUP_RabFlowCombinationList rfcl_a, + charstring local_ip_b, charstring remote_ip_b) runs on dummy_CT { + var RtpFlowData flow[2]; + var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; + var MgcpCallId call_id := '1227'H; + var RtpemStats stats[2][2]; + + 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_payloads[0].payload_type := flow[0].codec_descr[0].pt; + flow[0].rtp_cfg.rx_payloads[0].payload_type := flow[0].codec_descr[0].pt; + flow[0].rtp_cfg.tx_payloads[0].fixed_payload := '4f28959ffeb80181f5c4e83d176c897b4a4e333298333419a493ca63ded6e0'O; + /* flow[1].rtp_cfg.rx_payloads[0].fixed_payload converted AMR-BE-RTP->AMR-IUUP*/ + flow[0].rtp_cfg.rx_payloads[0].fixed_payload := '08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740'O; + flow[0].rtp_cfg.iuup_mode := true; + flow[0].rtp_cfg.iuup_cfg.active_init := true; + flow[0].rtp_cfg.iuup_cfg.rab_flow_combs := rfcl_a; + + /* Create the second connection. This connection will be also + * in receive only mode (CN side, regular RTP) */ + flow[1] := valueof(t_RtpFlow(local_ip_b, remote_ip_b, 112, "AMR/8000")); + flow[1].em.portnr := 20000; + flow[1].rtp_cfg := c_RtpemDefaultCfg; + flow[1].rtp_cfg.tx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + flow[1].rtp_cfg.rx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + flow[1].rtp_cfg.tx_payloads[0].fixed_payload := '0382155b65131c68682079fab4810911200003b360ae0446000025f11e539dd0'O; + /* flow[0].rtp_cfg.rx_payloads[0].fixed_payload converted AMR-IuUP->AMR-BE-RTP*/ + flow[1].rtp_cfg.rx_payloads[0].fixed_payload := 'f3d3ca2567ffae00607d713a0f45db225ed2938ccca60ccd066924f298f7b5b8'O; + flow[1].rtp_cfg.iuup_mode := false; + + f_two_crcx_mdcx_data_transfer(ep, call_id, flow[0], flow[1], false); + setverdict(pass); + + /* Stop sending further pkts to RTPEM[1], to avoid race conditions where RTP is sent while we + * reconfigure MGW (and our RTPEM) for IuUP: + */ + f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); + f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); + f_sleep(0.5); + + /* Modify the AMR side to also do IuUP */ + flow[1].codec_descr := {{ + pt := 96, + codec := "VND.3GPP.IUFP/16000", + fmtp := omit + }}; + flow[1].rtp_cfg.iuup_mode := true; + flow[1].rtp_cfg.iuup_cfg.active_init := false; + flow[1].rtp_cfg.iuup_cfg.rab_flow_combs := rfcl_a; + flow[1].rtp_cfg.tx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + /* Send whatever payload is expected by the other RTPEM, now without AMR-BE_RTP<->AMR-IUUP conversion: */ + flow[1].rtp_cfg.tx_payloads[0].fixed_payload := flow[0].rtp_cfg.rx_payloads[0].fixed_payload; + flow[1].rtp_cfg.rx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + /* Expect whatever payload is sent by the other RTPEM, now without AMR-BE_RTP<->AMR-IUUP conversion: */ + flow[1].rtp_cfg.rx_payloads[0].fixed_payload := flow[0].rtp_cfg.tx_payloads[0].fixed_payload; + f_flow_modify(RTPEM[1], ep, call_id, "sendrecv", flow[1]); + f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); + f_sleep(1.0); + f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); + + /* Now, if MGW would keep sending RTP instead of expected IuUP, then that would make the RTPEM[1] + * component to fail, since it would error trying to decode an RTP pkt as IuUP. + * We simply need to make sure some packets are being forwarded to it: + */ + stats[0][0] := f_rtpem_stats_get(RTPEM[0]); + stats[1][0] := f_rtpem_stats_get(RTPEM[1]); + f_sleep(1.0); + stats[0][1] := f_rtpem_stats_get(RTPEM[0]); + stats[1][1] := f_rtpem_stats_get(RTPEM[1]); + + f_rtpem_stats_err_check(stats[0][1]); + f_rtpem_stats_err_check(stats[1][1]); + if (stats[0][1].num_pkts_rx == stats[0][0].num_pkts_rx) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("No packets received in connection 0 after MDCX")); + } + if (stats[1][1].num_pkts_rx == stats[1][0].num_pkts_rx) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("No packets received in connection 1 after MDCX")); + } + + /* Tear down */ + f_flow_delete(RTPEM[0]); + f_flow_delete(RTPEM[1], ep, call_id); + setverdict(pass); + } + testcase TC_two_crcx_mdcx_and_iuup_rtp_mdcx_to_iuup() runs on dummy_CT { + var template (value) IuUP_RabFlowCombinationList rfcl := { + t_IuUP_RFC_AMR_12_2(0), + t_IuUP_RFC_AMR_SID(1), + t_IuUP_RFC_AMR_NO_DATA(2) + }; + f_tc_two_crcx_mdcx_and_iuup_rtp_mdcx_to_iuup(mp_local_ipv4, mp_remote_ipv4, valueof(rfcl), + mp_local_ipv4, mp_remote_ipv4); + } control { execute(TC_selftest()); execute(TC_auep_null()); @@ -3258,6 +3359,7 @@ module MGCP_Test { execute(TC_two_crcx_mdcx_and_iuup_rtp()); execute(TC_two_crcx_mdcx_and_iuup_rtp_rfci_unordered()); execute(TC_two_crcx_mdcx_and_iuup_rtp_mdcx_recvonly()); + execute(TC_two_crcx_mdcx_and_iuup_rtp_mdcx_to_iuup()); execute(TC_two_crcx_mdcx_and_rtp_clearmode()); |