bsc: Add LCLS related test cases

This is an early WIP, we actually will need to establish two calls/legs
before the BSC is able to locally correlate them.

Related: OS#1602
Change-Id: Ie6d0b9c38027abf65c7c564fc79b889d013fa6a7
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 16a0547..225e86b 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -356,6 +356,15 @@
 	enc_key := key
 }
 
+type record TestHdlrParamsLcls {
+	GlobalCallReferenceValue gcr optional,
+	/* LCLS Configuration */
+	BIT4 cfg optional,
+	/* LCLS Connection Status Control */
+	BIT4 csc optional,
+	BIT4 exp_sts optional
+}
+
 type record TestHdlrParams {
 	OCT1		ra,
 	GsmFrameNumber	fn,
@@ -363,7 +372,8 @@
 	RslLinkId	link_id,
 	integer		media_nr, /* determins MGCP EP, port numbers */
 	BSSMAP_IE_SpeechCodecList ass_codec_list optional,
-	TestHdlrEncrParams encr optional
+	TestHdlrEncrParams encr optional,
+	TestHdlrParamsLcls lcls
 };
 
 template (value) TestHdlrParams t_def_TestHdlrPars := {
@@ -373,7 +383,13 @@
 	link_id := valueof(ts_RslLinkID_DCCH(0)),
 	media_nr := 1,
 	ass_codec_list := omit,
-	encr := omit
+	encr := omit,
+	lcls := {
+		gcr := omit,
+		cfg := omit,
+		csc := omit,
+		exp_sts := omit
+	}
 }
 
 function f_create_chan_and_exp() runs on MSC_ConnHdlr {
@@ -711,11 +727,36 @@
 	}
 }
 
+/* patch an BSSMAP ASS REQ with LCLS related IEs, depending on g_params */
+function f_ass_patch_lcls(inout template (omit) PDU_BSSAP ass_tpl,
+			  inout template PDU_BSSAP ass_cpl) runs on MSC_ConnHdlr {
+	if (istemplatekind(ass_tpl, "omit")) {
+		return;
+	}
+	if (ispresent(g_pars.lcls.gcr)) {
+		ass_tpl.pdu.bssmap.assignmentRequest.globalCallReference := ts_BSSMAP_IE_GCR(g_pars.lcls.gcr);
+	}
+	if (ispresent(g_pars.lcls.cfg)) {
+		ass_tpl.pdu.bssmap.assignmentRequest.lCLS_Configuration := ts_BSSMAP_IE_LclsCfg(g_pars.lcls.cfg);
+	}
+	if (ispresent(g_pars.lcls.csc)) {
+		ass_tpl.pdu.bssmap.assignmentRequest.lCLS_ConnectionStatusControl := ts_BSSMAP_IE_LclsCsc(g_pars.lcls.csc);
+	}
+	if (ispresent(g_pars.lcls.exp_sts)) {
+		ass_cpl.pdu.bssmap.assignmentComplete.lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(g_pars.lcls.exp_sts);
+	} else {
+		ass_cpl.pdu.bssmap.assignmentComplete.lCLS_BSS_Status := omit;
+	}
+}
+
 /* establish a channel fully, expecting an assignment matching 'exp' */
 function f_establish_fully(template (omit) PDU_BSSAP ass_tpl, template PDU_BSSAP exp_ass_cpl)
 runs on MSC_ConnHdlr {
 	f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3");
 
+	/* patch in the LCLS related items, as needed */
+	f_ass_patch_lcls(ass_tpl, exp_ass_cpl);
+
 	f_create_chan_and_exp();
 	/* we should now have a COMPL_L3 at the MSC */
 	BSSAP.receive(tr_BSSMAP_ComplL3);