aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-06-27 17:52:04 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2018-06-28 14:15:10 +0200
commit2321ef92a3d198e0fa923af828d6c5a3bb4785cd (patch)
tree40ac195f97e8d609edbdf426e48730643e5a5747 /library
parent887e8f1e9ee0a484e24a751844baf7dac8c0e15c (diff)
MGCP_Test: add tests to verify actual RTP flows
The test coverage of the RTP aspects of the MGW is currently very minima. Lets add a few more testcase to verify RTP behaves as expected in various situations. - Add testcase TC_one_crcx_receive_only_rtp: Test recvonly mode of the MGW. All packets must be absorbed by the MGW, no packets must come back. - Add testcase TC_one_crcx_loopback_rtp: Test loopback mode of the MGW. All packet sent to the MGW must come back. - Add testcase TC_two_crcx_and_rtp_bidir: We already test unidirectional transmissions. This test does the same as TC_two_crcx_and_rtp but for both directions. - Add testcase TC_two_crcx_mdcx_and_rtp: Simulate a typical behaviour of a normal call. First create two half open connections and complete the connections later using MDCX. - Add testcase TC_two_crcx_and_unsolicited_rtp: Test what happens when a RTP packets from rogue source are mixed into the RTP stream. - Add testcase TC_two_crcx_and_one_mdcx_rtp_ho: Test a typical handover situation. An existing connection is handovered to another source on one end but the old source will keep transmitting for a while. Change-Id: I556a6efff0e74aab897bd8165200eec36e46629f Closes: OS#2703
Diffstat (limited to 'library')
-rw-r--r--library/RTP_Emulation.ttcn49
1 files changed, 43 insertions, 6 deletions
diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index 20e4299c..475b4785 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -188,20 +188,57 @@ function f_rtpem_stats_get(RTPEM_CTRL_PT pt, boolean rtcp := false) return Rtpem
return stats;
}
-function f_rtpem_stats_compare(RtpemStats a, RtpemStats b) return boolean {
+function f_rtpem_stats_compare_value(integer a, integer b, integer tolerance := 0) return boolean {
+ var integer temp;
+
+ temp := (a - b)
+ if (temp < 0) {
+ temp := -temp;
+ }
+
+ if (temp > tolerance) {
+ return false;
+ }
+
+ return true;
+}
+
+/* Cross-compare two rtpem-statistics. The transmission statistics on the a side
+ * must match the reception statistics on the other side and vice versa. The
+ * user may also supply a tolerance value (number of packets) when deviations
+ * are acceptable */
+function f_rtpem_stats_compare(RtpemStats a, RtpemStats b, integer tolerance := 0) return boolean {
+ var integer plen;
+
log("stats A: ", a);
log("stats B: ", b);
+ log("tolerance: ", tolerance, " packets");
- if (a.num_pkts_tx != b.num_pkts_rx or
- a.num_pkts_rx != b.num_pkts_tx or
- a.bytes_payload_tx != b.bytes_payload_rx or
- a.bytes_payload_rx != b.bytes_payload_tx) {
+ if (f_rtpem_stats_compare_value(a.num_pkts_tx, b.num_pkts_rx, tolerance) == false) {
return false;
}
+
+ if (f_rtpem_stats_compare_value(a.num_pkts_rx, b.num_pkts_tx, tolerance) == false) {
+ return false;
+ }
+
+ if(a.num_pkts_tx > 0) {
+ plen := a.bytes_payload_tx / a.num_pkts_tx;
+ } else {
+ plen := 0;
+ }
+
+ if (f_rtpem_stats_compare_value(a.bytes_payload_tx, b.bytes_payload_rx, tolerance * plen) == false) {
+ return false;
+ }
+
+ if (f_rtpem_stats_compare_value(a.bytes_payload_rx, b.bytes_payload_tx, tolerance * plen) == false) {
+ return false;
+ }
+
return true;
}
-
template PDU_RTP ts_RTP(BIT32_BO_LAST ssrc, INT7b pt, LIN2_BO_LAST seq, uint32_t ts,
octetstring payload, BIT1 marker := '0'B) := {
version := 2,