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());