bsc: Introduce test TC_srvcc_eutran_to_geran_src_sai

Related: SYS#5838
Change-Id: I186b9b9436bf82bcd54ca348df1e5e4b6424ca6e
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 44916c4..c599498 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1663,6 +1663,7 @@
 }
 
 function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4",
+			    template (value) BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1),
 			    template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit,
 			    template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP {
 	var PDU_BSSAP ho_req;
@@ -1687,13 +1688,17 @@
 	if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) {
 		var BSSMAP_IE_AoIP_TransportLayerAddress tla :=
 			valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342));
-		ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs,
+		ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla,
+							    cell_id_source := cell_id_source,
+							    oldToNewBSSIEs := oldToNewBSSIEs,
 							    encryptionInformation := encryptionInformation,
 							    chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
 							    kC128 := kc128));
 	} else {
 		var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1));
-		ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs,
+		ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit,
+							    cell_id_source := cell_id_source,
+							    oldToNewBSSIEs := oldToNewBSSIEs,
 							    encryptionInformation := encryptionInformation,
 							    chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
 							    kC128 := kc128));
@@ -6003,6 +6008,7 @@
 
 	BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc,
 				     f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla,
+							cell_id_source := g_pars.cell_id_source,
 							oldToNewBSSIEs := oldToNewBSSIEs,
 							enc := g_pars.encr)));
 	BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND);
@@ -6186,6 +6192,19 @@
 	f_shutdown_helper();
 }
 
+/* Same as TC_srvcc_eutran_to_geran, but using SAI as serving Cell Identifier. SYS#5838 */
+testcase TC_srvcc_eutran_to_geran_src_sai() runs on test_CT {
+	var TestHdlrParams pars := f_gen_test_hdlr_pars();
+	pars.last_used_eutran_plmn := '323454'O;
+	pars.cell_id_source := valueof(ts_CellID_SAI('123456'O, 300, 444));
+	f_tc_ho_into_this_bsc_main(pars);
+
+	f_ctrs_bsc_and_bts_add(0, "srvcc:attempted");
+	f_ctrs_bsc_and_bts_add(0, "srvcc:completed");
+	f_ctrs_bsc_and_bts_verify();
+	f_shutdown_helper();
+}
+
 private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr {
 	var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs;
 	oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn));
@@ -11242,6 +11261,7 @@
 		execute( TC_ho_into_this_bsc_tla_v6() );
 	}
 	execute( TC_srvcc_eutran_to_geran() );
+	execute( TC_srvcc_eutran_to_geran_src_sai() );
 	execute( TC_srvcc_eutran_to_geran_ho_out() );
 	execute( TC_srvcc_eutran_to_geran_forbid_fast_return() );
 	execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() );
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index c2b49c8..e492ee0 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -669,7 +669,8 @@
 	OCT3		last_used_eutran_plmn optional,
 	boolean		exp_fast_return, /* RR Release expected to contain CellSelectInd ? */
 	boolean		expect_channel_mode_modify,
-	uint3_t		expect_tsc optional
+	uint3_t		expect_tsc optional,
+	BSSMAP_IE_CellIdentifier	cell_id_source
 };
 
 /* Note: Do not use valueof() to get a value of this template, use
@@ -708,7 +709,8 @@
 	last_used_eutran_plmn := omit,
 	exp_fast_return := false,
 	expect_channel_mode_modify := false,
-	expect_tsc := omit
+	expect_tsc := omit,
+	cell_id_source := valueof(ts_CellID_LAC_CI(1, 1))
 }
 
 function f_create_chan_and_exp(template (present) PDU_BSSAP exp_l3_compl := ?)
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index d497d25..0e34b35 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -321,6 +321,7 @@
 
 type uint16_t BssmapLAC;
 type uint16_t BssmapCI;
+type uint16_t BssmapSAC;
 
 template BSSMAP_IE_CellIdentifier ts_CellId_CGI(hexstring mcc, hexstring mnc, BssmapLAC lac, BssmapCI ci)
 modifies ts_BSSMAP_IE_CellID := {
@@ -329,7 +330,7 @@
 	}
 }
 
-template BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
+template (value) BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
 modifies ts_BSSMAP_IE_CellID := {
 	cellIdentification := {
 		cI_LAC_CI := {
@@ -353,6 +354,17 @@
 	}
 }
 
+template (value) BSSMAP_IE_CellIdentifier ts_CellID_SAI(OCT3 mcc_mnc, BssmapLAC lac, BssmapSAC sac)
+modifies ts_BSSMAP_IE_CellID := {
+	cellIdentification := {
+		cI_SAI := {
+			mcc_mnc := mcc_mnc,
+			lac := int2oct(lac, 2),
+			sac := int2oct(sac, 2)
+		}
+	}
+}
+
 
 template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := {
 	elementIdentifier := '17'O,