Change in osmo-ttcn3-hacks[master]: MGCP_Test: check payload type of received RTP packets

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
Tue Jul 24 17:01:32 UTC 2018


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


Change subject: MGCP_Test: check payload type of received RTP packets
......................................................................

MGCP_Test: check payload type of received RTP packets

When an RTP packet is received, the payload type is not checked,
so we will not detect if the MGW emits packets with a wrong payload
type for some reason.

- Introduce a statistics counter that counts packets with wrong PT
- Update testcases so that they check for the statistics for wrong
  PT count.

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



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

diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index 71cd8db..2a358a9 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -116,6 +116,8 @@
 	integer num_pkts_rx_err_seq,
 	/* number of packets received wrong timestamp */
 	integer num_pkts_rx_err_ts,
+	/* number of packets received wrong payload type */
+	integer num_pkts_rx_err_pt,
 	/* number of packets received during Rx disable */
 	integer num_pkts_rx_err_disabled
 }
@@ -127,6 +129,7 @@
 	bytes_payload_rx := 0,
 	num_pkts_rx_err_seq := 0,
 	num_pkts_rx_err_ts := 0,
+	num_pkts_rx_err_pt := 0,
 	num_pkts_rx_err_disabled := 0
 }
 
@@ -399,7 +402,11 @@
 		/* process received RTCP/RTP if receiver enabled */
 		[g_rx_enabled] RTP.receive(tr_rtp) -> value rx_rtp {
 			//log("RX RTP: ", rx_rtp);
+
 			/* increment counters */
+			if (rx_rtp.msg.rtp.payload_type != g_cfg.tx_payload_type) {
+				g_stats_rtp.num_pkts_rx_err_pt := g_stats_rtp.num_pkts_rx_err_pt+1;
+			}
 			g_stats_rtp.num_pkts_rx := g_stats_rtp.num_pkts_rx+1;
 			g_stats_rtp.bytes_payload_rx := g_stats_rtp.bytes_payload_rx +
 								lengthof(rx_rtp.msg.rtp.data);
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 82ed608..264ac28 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -970,6 +970,9 @@
 		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);
 		}
@@ -1008,6 +1011,9 @@
 		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);
 		}
@@ -1062,6 +1068,11 @@
 			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;
+		}
+
 		setverdict(pass);
 	}
 
@@ -1163,12 +1174,20 @@
 			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;
+		}
 
 		/* Tear down */
 		f_flow_delete(RTPEM[0]);
@@ -1221,6 +1240,11 @@
 			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;
+		}
+
 		setverdict(pass);
 	}
 
@@ -1284,6 +1308,11 @@
 			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;
+		}
+
 		setverdict(pass);
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/10150
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: I83d4b04656a16ced624024245a2fcb7a0ad48a8a
Gerrit-Change-Number: 10150
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/20180724/81199762/attachment.htm>


More information about the gerrit-log mailing list