Change in ...osmo-ttcn3-hacks[master]: RTP_Emulation: allow expecting connection refused

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/.

osmith gerrit-no-reply at lists.osmocom.org
Wed Jun 26 12:15:40 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14604


Change subject: RTP_Emulation: allow expecting connection refused
......................................................................

RTP_Emulation: allow expecting connection refused

Prepare for upcoming connection timeout test, where we want to run into
connection refused.

Change-Id: Id6365bc59e19368a87b951367742a0b7cc5e9574
---
M library/RTP_Emulation.ttcn
1 file changed, 43 insertions(+), 2 deletions(-)



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

diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index 31bf68a..6539da7 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -105,6 +105,9 @@
 	var uint32_t g_rx_last_ts;
 
 	var IuUP_Entity g_iuup_ent; // := valueof(t_IuUP_Entity(1));
+
+	var boolean g_conn_refuse_expect := false;
+	var boolean g_conn_refuse_received := false;
 }
 
 type enumerated RtpemMode {
@@ -175,9 +178,12 @@
 signature RTPEM_mode(in RtpemMode mode);
 signature RTPEM_configure(in RtpemConfig cfg);
 signature RTPEM_stats_get(out RtpemStats stats, in boolean rtcp);
+signature RTPEM_conn_refuse_expect(in boolean expect);
+signature RTPEM_conn_refuse_received(out boolean received);
 
 type port RTPEM_CTRL_PT procedure {
-	inout RTPEM_bind, RTPEM_connect, RTPEM_mode, RTPEM_configure, RTPEM_stats_get;
+	inout RTPEM_bind, RTPEM_connect, RTPEM_mode, RTPEM_configure, RTPEM_stats_get, RTPEM_conn_refuse_expect,
+	      RTPEM_conn_refuse_received;
 } with { extension "internal" };
 
 function f_rtpem_bind(RTPEM_CTRL_PT pt, in HostName local_host, inout PortNumber local_port) {
@@ -299,6 +305,21 @@
 	}
 }
 
+function f_rtpem_conn_refuse_expect(RTPEM_CTRL_PT pt) {
+	pt.call(RTPEM_conn_refuse_expect:{true}) {
+		[] pt.getreply(RTPEM_conn_refuse_expect:{true}) {};
+	}
+}
+
+function f_rtpem_conn_refuse_verify(RTPEM_CTRL_PT pt) {
+	pt.call(RTPEM_conn_refuse_received:{?}) {
+		[] pt.getreply(RTPEM_conn_refuse_received:{true}) {};
+		[] pt.getreply(RTPEM_conn_refuse_received:{false}) {
+			setverdict(fail, "Expected to receive connection refused");
+		};
+	}
+}
+
 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,
@@ -348,6 +369,11 @@
 	tr_rtp.msg := { rtp := ? };
 	tr_rtcp.msg := { rtcp := ? };
 
+	var template ASP_Event tr_conn_refuse := {result := { errorCode := ?,
+							      connId := ?,
+							      os_error_code := ?,
+							      os_error_text := "Connection refused"}};
+
 	g_iuup_ent := valueof(t_IuUP_Entity(g_cfg.iuup_tx_init));
 
 	while (true) {
@@ -448,7 +474,12 @@
 				CTRL.reply(RTPEM_stats_get:{g_stats_rtp, is_rtcp});
 			}
 		}
-
+		[] CTRL.getcall(RTPEM_conn_refuse_expect:{?}) -> param(g_conn_refuse_expect) {
+			CTRL.reply(RTPEM_conn_refuse_expect:{g_conn_refuse_expect});
+		}
+		[] CTRL.getcall(RTPEM_conn_refuse_received:{?}) {
+			CTRL.reply(RTPEM_conn_refuse_received:{g_conn_refuse_received});
+		}
 
 
 		/* simply ignore any RTTP/RTP if receiver not enabled */
@@ -491,6 +522,16 @@
 								lengthof(g_cfg.tx_fixed_payload);
 		}
 
+		/* connection refused */
+		[g_conn_refuse_expect] RTP.receive(tr_conn_refuse) {
+			log("Connection refused (expected)");
+			g_conn_refuse_received := true;
+		}
+		[not g_conn_refuse_expect] RTP.receive(tr_conn_refuse) {
+			setverdict(fail, "Connection refused (unexpected)");
+			mtc.stop;
+		}
+
 		/* fail on any unexpected messages */
 		[] RTP.receive {
 			setverdict(fail, "Received unexpected type from RTP");

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14604
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id6365bc59e19368a87b951367742a0b7cc5e9574
Gerrit-Change-Number: 14604
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190626/3bf0a0a0/attachment.htm>


More information about the gerrit-log mailing list