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/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 22df0cb..3aaab85 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -3880,7 +3880,6 @@
/* this is like the beginning of f_establish_fully(), but only up to ciphering reject */
var BSSMAP_FIELD_CodecType codecType;
- timer T := 10.0;
codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType;
f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType);
@@ -3888,24 +3887,6 @@
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, expect Cipher Mode Reject */
f_cipher_mode(g_pars.encr, exp_fail := true);
}
@@ -5055,7 +5036,6 @@
f_create_chan_and_exp();
/* we should now have a COMPL_L3 at the MSC */
- BSSAP.receive(tr_BSSMAP_ComplL3);
BSSAP.send(ts_BSSMAP_ClassmarkRequest);
RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY));
@@ -5081,7 +5061,6 @@
f_create_chan_and_exp();
/* we should now have a COMPL_L3 at the MSC */
- BSSAP.receive(tr_BSSMAP_ComplL3);
/* Send CommonID */
BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi));
@@ -5105,7 +5084,6 @@
g_pars := f_gen_test_hdlr_pars();
f_create_chan_and_exp();
/* we should now have a COMPL_L3 at the MSC */
- BSSAP.receive(tr_BSSMAP_ComplL3);
/* send the single message we want to send */
f_rsl_send_l3(l3);
@@ -5176,7 +5154,6 @@
g_pars := f_gen_test_hdlr_pars();
f_create_chan_and_exp();
/* we should now have a COMPL_L3 at the MSC */
- BSSAP.receive(tr_BSSMAP_ComplL3);
/* send short message */
RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O));
@@ -10534,6 +10511,7 @@
private function f_TC_cm_serv_rej(charstring id) runs on MSC_ConnHdlr
{
f_create_chan_and_exp();
+ /* we should now have a COMPL_L3 at the MSC */
BSSAP.send(ts_PDU_DTAP_MT(ts_CM_SERV_REJ('02'O), '00'O));
f_sleep(1.0);
}
@@ -10575,24 +10553,6 @@
f_rslem_dchan_queue_enable();
/* 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 := ?;
- }
- timer T := 10.0;
- 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");
- }
- }
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
activate(as_Media_mgw());
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)) {