diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-09-27 14:45:51 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2023-09-28 14:36:12 +0000 |
commit | 74d75b19cffbc9b8b4d13f70e9c2c39f9afd0e0a (patch) | |
tree | 54475f64c177504c37fb4f1bda7ea5000b7b82a9 | |
parent | 30da239be672b5aa61253a876dac8da6f716ba3f (diff) |
mgw: Factor out helper func to test data flows over endp with 2 conns
The logic can be reused by AMR<->IuUP and IuUP<->IuUP tests.
Change-Id: Ic4f3c5bb687373bdae6942e1952797e76bfa3ffb
-rw-r--r-- | mgw/MGCP_Test.ttcn | 162 |
1 files changed, 47 insertions, 115 deletions
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index 0cedb0ec..ad564c1a 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -2804,42 +2804,21 @@ module MGCP_Test { setverdict(pass); } - /* create two local RTP+IuUP emulations and pass data in both directions */ - function f_tc_two_crcx_mdcx_and_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]; + /* create two local emulations and pass data in both directions */ + function f_two_crcx_mdcx_data_transfer(MgcpEndpoint ep, MgcpCallId call_id, inout RtpFlowData flow_a, + inout RtpFlowData flow_b, boolean tear_down_rtp := true) runs on dummy_CT { 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.rx_payloads[0].payload_type := flow[0].codec_descr[0].pt; - flow[0].rtp_cfg.tx_payloads[0].payload_type := flow[0].codec_descr[0].pt; - 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; - f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true); + f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow_a, 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.rx_payloads[0].payload_type := flow[1].codec_descr[0].pt; - flow[1].rtp_cfg.tx_payloads[0].payload_type := flow[1].codec_descr[0].pt; - flow[1].rtp_cfg.iuup_mode := true; - flow[1].rtp_cfg.iuup_cfg.active_init := false; - f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true); + * in receive only mode (CN side, regular RTP) */ + f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow_b, true); f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); /* The first leg starts transmitting */ @@ -2875,7 +2854,7 @@ module MGCP_Test { 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_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow_a); f_sleep(0.5); stats[0] := f_rtpem_stats_get(RTPEM[0]); if (stats[0].num_pkts_rx_err_disabled != 0) { @@ -2894,7 +2873,7 @@ module MGCP_Test { 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_flow_modify(RTPEM[1], ep, call_id, "sendrecv", flow_b); f_sleep(2.0); stats[0] := f_rtpem_stats_get(RTPEM[0]); @@ -2916,8 +2895,44 @@ module MGCP_Test { f_rtpem_stats_err_check(stats[1]); /* Tear down */ - f_flow_delete(RTPEM[0]); - f_flow_delete(RTPEM[1], ep, call_id); + if (tear_down_rtp) { + f_flow_delete(RTPEM[0]); + f_flow_delete(RTPEM[1], ep, call_id); + } + setverdict(pass); + } + + /* create two local RTP+IuUP emulations and pass data in both directions */ + function f_tc_two_crcx_mdcx_and_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; + + 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.rx_payloads[0].payload_type := flow[0].codec_descr[0].pt; + flow[0].rtp_cfg.tx_payloads[0].payload_type := flow[0].codec_descr[0].pt; + 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, 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.rx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + flow[1].rtp_cfg.tx_payloads[0].payload_type := flow[1].codec_descr[0].pt; + flow[1].rtp_cfg.iuup_mode := true; + flow[1].rtp_cfg.iuup_cfg.active_init := false; + + f_two_crcx_mdcx_data_transfer(ep, call_id, flow[0], flow[1], true); setverdict(pass); } testcase TC_two_crcx_mdcx_and_iuup() runs on dummy_CT { @@ -2945,12 +2960,8 @@ module MGCP_Test { IuUP_RabFlowCombinationList rfcl_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); @@ -2966,8 +2977,6 @@ module MGCP_Test { 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; - 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, regular RTP) */ @@ -2980,85 +2989,8 @@ module MGCP_Test { /* 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_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); + f_two_crcx_mdcx_data_transfer(ep, call_id, flow[0], flow[1], true); setverdict(pass); } testcase TC_two_crcx_mdcx_and_iuup_rtp() runs on dummy_CT { |