bsc: f_create_chan_and_exp(): ensure that SCCP connection is up
This change fixes sporadic failures of TC_cm_serv_rej:
RAN Connection table not found by component TC_cm_serv_rej(2648)
BSC_Tests.ttcn:11106 BSC_Tests control part
BSC_Tests.ttcn:10550 TC_cm_serv_rej testcase
The reason is that sometimes a BSSAP/DTAP PDU (with CM Service Reject)
gets enqueued before the SUT has established an SCCP connection to the
virtual MSC. This causes a lookup error in the RAN connection table.
A simple solution would be to add a receive statement after calling
f_create_chan_and_exp(), like it's done everywhere else:
f_create_chan_and_exp();
BSSAP.receive(tr_BSSMAP_ComplL3); // <---
But a more general solution is to expect and receive this message in
f_create_chan_and_exp(), so we can reduce code duplication and make
the API more convinient. This is exactly what this change does.
Change-Id: Ic675168e29919e1234cb49440c4a630238ff5d70
Related: SYS#4878
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 481abc0..4aeb539 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -644,19 +644,42 @@
expect_tsc := omit
}
-function f_create_chan_and_exp() runs on MSC_ConnHdlr {
+function f_create_chan_and_exp(template (present) PDU_BSSAP exp_l3_compl := ?)
+runs on MSC_ConnHdlr {
var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info);
var template uint3_t tsc := ?;
+ timer T;
if (not istemplatekind(g_pars.expect_tsc, "omit")) {
tsc := g_pars.expect_tsc;
}
+ if (istemplatekind(exp_l3_compl, "?")) {
+ if (g_pars.aoip == false) {
+ exp_l3_compl := tr_BSSMAP_ComplL3(l3_enc, codec_list := omit);
+ } else {
+ exp_l3_compl := tr_BSSMAP_ComplL3(l3_enc, codec_list := ?);
+ }
+ }
+
f_create_bssmap_exp(l3_enc);
/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc);
+ /* wait for a COMPL_L3 from the BSC to ensure that the SCCP connection is up */
+ T.start(2.0);
+ alt {
+ [] BSSAP.receive(exp_l3_compl);
+ [] BSSAP.receive(tr_BSSMAP_ComplL3) {
+ setverdict(fail, "Received non-matching COMPLETE LAYER 3 INFORMATION");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ }
}
function f_rsl_send_l3(template PDU_ML3_MS_NW l3, template (omit) RslLinkId link_id := omit,
@@ -1214,25 +1237,6 @@
f_ass_patch_lcls(ass_tpl, exp_ass_cpl);
f_create_chan_and_exp();
- /* we should now have a COMPL_L3 at the MSC */
-
- var template PDU_BSSAP exp_l3_compl;
- exp_l3_compl := tr_BSSMAP_ComplL3()
- if (g_pars.aoip == false) {
- exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit;
- } else {
- exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?;
- }
- T.start;
- alt {
- [] BSSAP.receive(exp_l3_compl);
- [] BSSAP.receive(tr_BSSMAP_ComplL3) {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION");
- }
- [] T.timeout {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION");
- }
- }
/* start ciphering, if requested */
if (ispresent(g_pars.encr)) {