s1gw: f_ConnHdlr_connect(): wait for SCTP_COMM_UP event
Change-Id: I953e3527fd3abef9efc7365544296a3df0b8f59f
Related: SYS#6772
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 6b569eb..6237557 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -28,6 +28,7 @@
import from S1AP_PDU_Contents all;
import from S1AP_Constants all;
+import from SCTP_Templates all;
import from S1AP_Server all;
modulepar {
@@ -98,8 +99,11 @@
function f_ConnHdlr_connect() runs on ConnHdlr {
var Result res;
+ timer T;
map(self:S1AP_ENB, system:S1AP_CODEC_PT);
+
+ /* initiate SCTP connection establishment */
res := S1AP_CodecPort_CtrlFunct.f_IPL4_connect(S1AP_ENB,
mp_s1gw_ip, 36412,
"0.0.0.0", 0, -1,
@@ -110,7 +114,18 @@
}
g_s1ap_conn_id := res.connId;
- log("eNB connection established");
+ /* wait for the establishment confirmation */
+ T.start(2.0);
+ alt {
+ [] S1AP_ENB.receive(tr_SctpAssocChange(SCTP_COMM_UP, g_s1ap_conn_id)) {
+ log("eNB connection established");
+ }
+ [] S1AP_ENB.receive(PortEvent:{sctpEvent := ?}) { repeat; }
+ [] T.timeout {
+ setverdict(fail, "eNB connection establishment timeout");
+ self.stop;
+ }
+ }
}
function f_ConnHdlr_disconnect() runs on ConnHdlr {
diff --git a/s1gw/gen_links.sh b/s1gw/gen_links.sh
index 9587c59..fd54815 100755
--- a/s1gw/gen_links.sh
+++ b/s1gw/gen_links.sh
@@ -26,6 +26,7 @@
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn "
+FILES+="SCTP_Templates.ttcn "
gen_links $DIR $FILES
ignore_pp_results