Change in osmo-ttcn3-hacks[master]: MGCP_Test: add function to check for RTP err counters

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Wed Jul 25 07:44:58 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/10154


Change subject: MGCP_Test: add function to check for RTP err counters
......................................................................

MGCP_Test: add function to check for RTP err counters

At the moment we check the error counters of the RTP statistics in
the testcases. However, in most situations we will do the check to
make sure that no errors occurred (all counters == 0). Rather than
having a long tail of if statements in the testcases we should have
a function for this. This also makes it much easier in case we add
more error countes lateron.

- add and use function f_rtpem_stats_err_check()

Change-Id: I69e5f80b0765284ec99056ce62c315461967d2a1
Related: OS#3384
---
M library/RTP_Emulation.ttcn
M mgw/MGCP_Test.ttcn
2 files changed, 44 insertions(+), 47 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/54/10154/1

diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index 2a358a9..c752c22 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -242,6 +242,36 @@
 	return true;
 }
 
+/* Check the statistics for general signs of errors. This is a basic general
+ * check that will fit most situations and  is intended to be executed by
+ * the testcases as as needed. */
+function f_rtpem_stats_err_check(RtpemStats s) {
+	log("stats: ", s);
+
+	/* Check if there was some activity at either on the RX or on the
+	 * TX side, but complete silence would indicate some problem */
+	if (s.num_pkts_tx < 1 and s.num_pkts_rx < 1) {
+		setverdict(fail, "no RTP packet activity detected (packets)");
+	}
+	if (s.bytes_payload_tx < 1 and s.bytes_payload_rx < 1) {
+		setverdict(fail, "no RTP packet activity detected (bytes)");
+	}
+
+	/* Check error counters */
+	if (s.num_pkts_rx_err_seq != 0) {
+		setverdict(fail, "RTP packet sequence number errors occurred");
+	}
+	if (s.num_pkts_rx_err_ts != 0) {
+		setverdict(fail, "RTP packet timestamp errors occurred");
+	}
+	if (s.num_pkts_rx_err_pt != 0) {
+		setverdict(fail, "RTP packet payload type errors occurred");
+	}
+	if (s.num_pkts_rx_err_disabled != 0) {
+		setverdict(fail, "RTP packets received while RX was disabled");
+	}
+}
+
 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,
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 264ac28..a6d3460 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -961,21 +961,8 @@
 		if (stats.bytes_payload_tx < 190) {
 			setverdict(fail);
 		}
-		if (stats.num_pkts_rx != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_seq != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_ts != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_pt != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_disabled != 0) {
-			setverdict(fail);
-		}
+
+		f_rtpem_stats_err_check(stats);
 
 		setverdict(pass);
 	}
@@ -1005,18 +992,8 @@
 		if (stats.bytes_payload_tx != stats.bytes_payload_rx) {
 			setverdict(fail);
 		}
-		if (stats.num_pkts_rx_err_seq != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_ts != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_pt != 0) {
-			setverdict(fail);
-		}
-		if (stats.num_pkts_rx_err_disabled != 0) {
-			setverdict(fail);
-		}
+
+		f_rtpem_stats_err_check(stats);
 
 		setverdict(pass);
 	}
@@ -1068,10 +1045,8 @@
 			mtc.stop;
 		}
 
-		if (stats[0].num_pkts_rx_err_pt > 0 or stats[1].num_pkts_rx_err_pt > 0) {
-			setverdict(fail, "RTP packets with wrong payload type received");
-			mtc.stop;
-		}
+		f_rtpem_stats_err_check(stats[0]);
+		f_rtpem_stats_err_check(stats[1]);
 
 		setverdict(pass);
 	}
@@ -1174,20 +1149,15 @@
 			setverdict(fail, "number of packets not within normal parameters");
 			mtc.stop;
 		}
-		if (stats[0].num_pkts_rx_err_pt > 0) {
-			setverdict(fail, "RTP packets with wrong payload type received");
-			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");
 			mtc.stop;
 		}
-		if (stats[0].num_pkts_rx_err_pt > 0) {
-			setverdict(fail, "RTP packets with wrong payload type received");
-			mtc.stop;
-		}
+
+		f_rtpem_stats_err_check(stats[0]);
+		f_rtpem_stats_err_check(stats[1]);
 
 		/* Tear down */
 		f_flow_delete(RTPEM[0]);
@@ -1240,10 +1210,8 @@
 			mtc.stop;
 		}
 
-		if (stats[0].num_pkts_rx_err_pt > 0 or stats[1].num_pkts_rx_err_pt > 0) {
-			setverdict(fail, "RTP packets with wrong payload type received");
-			mtc.stop;
-		}
+		f_rtpem_stats_err_check(stats[0]);
+		f_rtpem_stats_err_check(stats[0]);
 
 		setverdict(pass);
 	}
@@ -1308,10 +1276,9 @@
 			mtc.stop;
 		}
 
-		if (stats[0].num_pkts_rx_err_pt > 0 or stats[1].num_pkts_rx_err_pt > 0) {
-			setverdict(fail, "RTP packets with wrong payload type received");
-			mtc.stop;
-		}
+		f_rtpem_stats_err_check(stats[0]);
+		f_rtpem_stats_err_check(stats[1]);
+		f_rtpem_stats_err_check(stats[2]);
 
 		setverdict(pass);
 	}

-- 
To view, visit https://gerrit.osmocom.org/10154
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69e5f80b0765284ec99056ce62c315461967d2a1
Gerrit-Change-Number: 10154
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180725/b89edd38/attachment.htm>


More information about the gerrit-log mailing list