Change in osmo-ttcn3-hacks[master]: stp: wait until IPA handshake is done in f_connect_ipa

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

laforge gerrit-no-reply at lists.osmocom.org
Sat Oct 3 08:16:56 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20261 )

Change subject: stp: wait until IPA handshake is done in f_connect_ipa
......................................................................

stp: wait until IPA handshake is done in f_connect_ipa

Otherwise when trying to send stuff to an IPA ASP in some test, it may
fail because the ASP is till not active in the STP (because IPA
handshake was yet not finished, race condition).

Change-Id: I8ea11fe331baf2b65ce0b7b3c1a2b480332faa2a
---
M stp/STP_Tests_IPA.ttcn
1 file changed, 16 insertions(+), 24 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/stp/STP_Tests_IPA.ttcn b/stp/STP_Tests_IPA.ttcn
index 26abc80..10367ad 100644
--- a/stp/STP_Tests_IPA.ttcn
+++ b/stp/STP_Tests_IPA.ttcn
@@ -56,6 +56,7 @@
 	/* for IPA we use the IPA_Emulation and not directly IPA_CodecPort to avoid
 	 * having to re-invent IPA CCM handling here */
 	port MTP3asp_PT IPA[NR_IPA];
+	port IPA_SP_PT IPA_CTRL[NR_IPA];
 	var IPA_Emulation_CT vc_IPA[NR_IPA];
 	var IPA_CCM_Parameters g_ccm_pars[NR_IPA];
 }
@@ -103,12 +104,13 @@
 		vc_IPA[i] := IPA_Emulation_CT.create("IPA" & int2str(i));
 		map(vc_IPA[i]:IPA_PORT, system:IPA_CODEC_PT);
 		connect(self:IPA[i], vc_IPA[i]:MTP3_SP_PORT);
+		connect(self:IPA_CTRL[i], vc_IPA[i]:IPA_SP_PORT);
 		g_ccm_pars[i] := c_IPA_default_ccm_pars;
 		g_ccm_pars[i].name := mp_ipa_as_names[i];
 	}
 }
 
-friend function f_connect_ipa(integer idx, boolean use_unknown_asp_port := false) runs on IPA_CT {
+friend function f_connect_ipa(integer idx, boolean use_unknown_asp_port := false, boolean exp_act := true) runs on IPA_CT {
 	var integer port_offset := 0;
 	if (use_unknown_asp_port) {
 		/* Add 100 to the port since we know that port is not configured in any
@@ -117,6 +119,12 @@
 	}
 	vc_IPA[idx].start(IPA_Emulation.main_client(mp_stp_ipa_ip, mp_stp_ipa_port, mp_local_ipa_ip,
 			mp_local_ipa_port + idx + port_offset, g_ccm_pars[idx]));
+	IPA_CTRL[idx].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_UP));
+	alt {
+	[exp_act] IPA_CTRL[idx].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK));
+	[not exp_act] IPA_CTRL[idx].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN));
+	[] IPA_CTRL[idx].receive(tr_ASP_IPA_EV(?)) { repeat; }
+	}
 }
 
 
@@ -126,16 +134,12 @@
 	f_vty_config2(VTY, {"cs7 instance 0", "listen ipa 5000"},
 		      "accept-asp-connections pre-configured");
 	f_init_ipa();
-	f_connect_ipa(0, true);
-	f_sleep(1.0);
-	if (IPA[0].checkstate("Connected")) {
-		setverdict(fail, "Expected IPA port to be disconnected");
-	} else {
-		setverdict(pass);
-	}
+	f_connect_ipa(0, true, false);
+
 	/* switch back to default */
 	f_vty_config2(VTY, {"cs7 instance 0", "listen ipa 5000"},
 		      "accept-asp-connections dynamic-permitted");
+	setverdict(pass);
 }
 
 /* "accept-asp-connections pre-configured" and client from known source */
@@ -145,15 +149,11 @@
 		      "accept-asp-connections pre-configured");
 	f_init_ipa();
 	f_connect_ipa(0, false);
-	f_sleep(1.0);
-	if (not IPA[0].checkstate("Connected")) {
-		setverdict(fail, "Expected IPA port to be connected");
-	} else {
-		setverdict(pass);
-	}
+
 	/* switch back to default */
 	f_vty_config2(VTY, {"cs7 instance 0", "listen ipa 5000"},
 		      "accept-asp-connections dynamic-permitted");
+	setverdict(pass);
 }
 
 
@@ -162,12 +162,7 @@
 	f_init_common();
 	f_init_ipa();
 	f_connect_ipa(0, true);
-	f_sleep(1.0);
-	if (not IPA[0].checkstate("Connected")) {
-		setverdict(fail, "Expected IPA port to be connected");
-	} else {
-		setverdict(pass);
-	}
+	setverdict(pass);
 }
 
 private function f_tc_tmt_override(boolean unknwon_dynamic_asp)
@@ -178,17 +173,16 @@
 	f_connect_ipa(4, unknwon_dynamic_asp);
 	/* activate the first 'receiver' side ASP */
 	f_connect_ipa(5, unknwon_dynamic_asp);
-	f_sleep(1.0);
 
 	/* verify traffic is routed from sender to [sole] receiver */
 	f_test_traffic(4, 5);
 
 	/* activate the second 'receiver' side ASP */
 	f_connect_ipa(6, unknwon_dynamic_asp);
-	f_sleep(1.0);
 
 	/* verify traffic is routed from sender to new receiver */
 	f_test_traffic(4, 6);
+	setverdict(pass);
 }
 
 /* test "traffic-mode override" behavior */
@@ -218,7 +212,6 @@
 	f_connect_ipa(0, unknwon_dynamic_asp);
 	/* activate the first 'receiver' side ASP */
 	f_connect_ipa(1, unknwon_dynamic_asp);
-	f_sleep(1.0);
 
 	/* verify traffic is routed from sender to [sole] receiver */
 	for (i := 0; i < 10; i := i+1) {
@@ -227,7 +220,6 @@
 
 	/* activate the second 'receiver' side ASP */
 	f_connect_ipa(2, unknwon_dynamic_asp);
-	f_sleep(1.0);
 
 	/* verify traffic is routed from sender to new receiver */
 	const integer iter_per_asp := 5;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20261
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: I8ea11fe331baf2b65ce0b7b3c1a2b480332faa2a
Gerrit-Change-Number: 20261
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201003/c08c2e92/attachment.htm>


More information about the gerrit-log mailing list