summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-23 18:39:30 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-09-23 20:35:21 +0200
commit853e6d5c71161bc5384d900aa5da95c0105dc22e (patch)
tree5d4625f31d4809d85903cf32c59823780f76ae1c
parentbefd3aaca496b74ea4e00a29ca9a3d6bc64f1d49 (diff)
stp: wait until IPA handshake is done in f_connect_ipapespin/stp
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
-rw-r--r--stp/STP_Tests_IPA.ttcn40
1 files changed, 16 insertions, 24 deletions
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 @@ type component IPA_CT extends Test_CT {
/* 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 @@ friend function f_init_ipa() runs on IPA_CT {
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 @@ friend function f_connect_ipa(integer idx, boolean use_unknown_asp_port := false
}
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 @@ testcase TC_unknown_client_nodynamic() runs on IPA_CT {
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 @@ testcase TC_known_client_nodynamic() runs on IPA_CT {
"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 @@ testcase TC_unknown_client_dynamic() runs on IPA_CT {
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 @@ runs on IPA_CT {
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 @@ runs on IPA_CT {
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 @@ runs on IPA_CT {
/* 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;