laforge submitted this change.
s1gw: add multi-eNB variants of TC_e_rab_setup
The idea is to simulate multiple eNBs establishing one or more
E-RAB(s) simultaneously. In order to achieve that, use the new
Mutex API to ensure that only one ConnHdlr component is triggering
PFCP session establishment at any given time.
The problem is that there is no way for the PFCPEM component to
correlate which PFCP session belongs to which eNB when multiple
ConnHdlr instances establish E-RAB(s) in parallel. This can be
solved by making a part of the test scenario synchronous.
Change-Id: I9e2eb25a7ae78ff623b94802d881af4894d0cacd
---
M s1gw/S1GW_ConnHdlr.ttcn
M s1gw/S1GW_Tests.ttcn
M s1gw/expected-results.xml
M s1gw/gen_links.sh
4 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index e1e97e0..2833ce1 100644
--- a/s1gw/S1GW_ConnHdlr.ttcn
+++ b/s1gw/S1GW_ConnHdlr.ttcn
@@ -18,6 +18,7 @@
import from Native_Functions all;
import from IPL4asp_Types all;
import from Misc_Helpers all;
+import from Mutex all;
import from PFCP_Types all;
import from PFCP_Emulation all;
@@ -40,7 +41,7 @@
import from S1AP_Server all;
-type component ConnHdlr extends S1APSRV_ConnHdlr, PFCP_ConnHdlr, StatsD_ConnHdlr {
+type component ConnHdlr extends MutexCT, S1APSRV_ConnHdlr, PFCP_ConnHdlr, StatsD_ConnHdlr {
var ConnHdlrPars g_pars;
port S1AP_CODEC_PT S1AP_ENB;
var ConnectionId g_s1ap_conn_id := -1;
@@ -556,9 +557,16 @@
runs on ConnHdlr {
const OCT8 c_SEID0 := '0000000000000000'O;
- /* Subscribe for PFCP Session Establishment Request PDU(s), which are
- * expected to have SEID set to 0, as per 3GPP TS 29.244, section 7.2.2.4.2. */
+ /* This code block cannot be executed by more than one component at a time because
+ * the S1AP E-RAB SETUP REQUEST triggers the IUT to send PFCP Session Establishment
+ * Request PDU(s), with need to be routed to the respective ConnHdlr component (us).
+ * As per 3GPP TS 29.244, section 7.2.2.4.2, these PFCP PDUs shall all have SEID=0,
+ * so that the PFCPEM component cannot route them unambiguously. This is why we
+ * need to ensure that only one ConnHdlr is triggering PFCP session establishment
+ * at the given moment of time. */
+ f_Mutex_lock(__BFILE__, __LINE__);
f_PFCPEM_subscribe_seid(c_SEID0);
+
log("eNB <- [S1GW <- MME]: E-RAB SETUP REQUEST");
f_ConnHdlr_tx_erab_setup_req(erabs);
for (var integer i := 0; i < lengthof(erabs); i := i + 1) {
@@ -571,8 +579,13 @@
log("UPF -> S1GW: PFCP Session Establishment Response for E-RAB ID ", erabs[i].erab_id);
f_ConnHdlr_tx_session_establish_resp(erabs[i], pdu);
}
- /* We no longer expect to receive PFCP Session Establishment Request PDU(s). */
+
+ /* We're done establishing PFCP sessions, so at this point we no longer expect to
+ * receive Session Establishment Request PDUs with SEID=0. Unregister and unlock
+ * the mutex, enabling other components to establish PFCP sessions after us. */
f_PFCPEM_unsubscribe_seid(c_SEID0);
+ f_Mutex_unlock(__BFILE__, __LINE__);
+
log("[eNB <- S1GW] <- MME: E-RAB SETUP REQUEST");
f_ConnHdlr_rx_erab_setup_req(erabs);
}
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 40243ca..4120f2a 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -18,6 +18,7 @@
import from Native_Functions all;
import from IPL4asp_Types all;
import from Misc_Helpers all;
+import from Mutex all;
import from S1AP_CodecPort all;
import from S1AP_CodecPort_CtrlFunct all;
@@ -61,6 +62,7 @@
type component test_CT extends StatsD_Checker_CT {
timer g_Tguard;
+ var MutexDispCT vc_mutex_disp;
var S1AP_Server_CT vc_S1APSRV;
var PFCP_Emulation_CT vc_PFCP;
var StatsD_Checker_CT vc_STATSD;
@@ -78,6 +80,8 @@
g_Tguard.start(Tval);
activate(as_Tguard());
+ vc_mutex_disp := f_MutexDisp_start();
+
f_init_statsd("StatsDSRV", vc_STATSD, mp_local_statsd_ip, mp_local_statsd_port);
if (s1apsrv_start) {
@@ -178,6 +182,7 @@
connect(vc_conn:PFCP, vc_PFCP:CLIENT);
connect(vc_conn:PFCP_PROC, vc_PFCP:CLIENT_PROC);
}
+ f_MutexDisp_connect(vc_mutex_disp, vc_conn);
vc_conn.start(f_ConnHdlr_init(fn, id, pars));
return vc_conn;
@@ -301,25 +306,36 @@
f_ConnHdlr_s1ap_disconnect();
f_ConnHdlr_s1ap_unregister(g_pars.genb_id);
}
-/* 1 E-RAB at a time */
-testcase TC_e_rab_setup() runs on test_CT {
- var ConnHdlrPars pars := valueof(t_ConnHdlrPars(num_erabs := 1));
- var ConnHdlr vc_conn;
+private function f_TC_e_rab_setup_exec(integer num_enbs, integer num_erabs)
+runs on test_CT {
+ var ConnHdlrList vc_conns;
f_init();
- vc_conn := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
- vc_conn.done;
+ for (var integer i := 0; i < num_enbs; i := i + 1) {
+ var ConnHdlrPars pars := valueof(t_ConnHdlrPars(i, num_erabs));
+ vc_conns[i] := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
+ }
+
+ for (var integer i := 0; i < num_enbs; i := i + 1) {
+ vc_conns[i].done;
+ }
}
-/* 3 E-RABs at a time */
+/* 1 E-RAB at a time, single eNB */
+testcase TC_e_rab_setup() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := 1, num_erabs := 1);
+}
+/* 1 E-RAB at a time, multiple eNB connections */
+testcase TC_e_rab_setup_multi() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := mp_multi_enb_num, num_erabs := 1);
+}
+/* 3 E-RABs at a time, single eNB */
testcase TC_e_rab_setup3() runs on test_CT {
- var ConnHdlrPars pars := valueof(t_ConnHdlrPars(num_erabs := 3));
- var ConnHdlr vc_conn;
-
- f_init();
-
- vc_conn := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
- vc_conn.done;
+ f_TC_e_rab_setup_exec(num_enbs := 1, num_erabs := 3);
+}
+/* 3 E-RABs at a time, multiple eNB connections */
+testcase TC_e_rab_setup3_multi() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := mp_multi_enb_num, num_erabs := 3);
}
function f_TC_pfcp_heartbeat(charstring id) runs on ConnHdlr {
@@ -352,6 +368,8 @@
execute( TC_conn_term_mme_unavail() );
execute( TC_e_rab_setup() );
execute( TC_e_rab_setup3() );
+ execute( TC_e_rab_setup_multi() );
+ execute( TC_e_rab_setup3_multi() );
execute( TC_pfcp_heartbeat() );
}
diff --git a/s1gw/expected-results.xml b/s1gw/expected-results.xml
index f7b0c3b..99a75d5 100644
--- a/s1gw/expected-results.xml
+++ b/s1gw/expected-results.xml
@@ -1,10 +1,12 @@
<?xml version="1.0"?>
-<testsuite name='S1GW_Tests' tests='7' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'>
+<testsuite name='S1GW_Tests' tests='9' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'>
<testcase classname='S1GW_Tests' name='TC_setup' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_setup_multi' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_conn_term_by_mme' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_conn_term_mme_unavail' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_e_rab_setup' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_e_rab_setup3' time='MASKED'/>
+ <testcase classname='S1GW_Tests' name='TC_e_rab_setup_multi' time='MASKED'/>
+ <testcase classname='S1GW_Tests' name='TC_e_rab_setup3_multi' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_pfcp_heartbeat' time='MASKED'/>
</testsuite>
diff --git a/s1gw/gen_links.sh b/s1gw/gen_links.sh
index 919e7f8..f2fc81b 100755
--- a/s1gw/gen_links.sh
+++ b/s1gw/gen_links.sh
@@ -28,7 +28,7 @@
gen_links $DIR $FILES
DIR=../library
-FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
+FILES="Misc_Helpers.ttcn Mutex.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
FILES+="PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn PFCP_Templates.ttcn "
FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn "
FILES+="SCTP_Templates.ttcn "
To view, visit change 38213. To unsubscribe, or for help writing mail filters, visit settings.