bsc: verify TSC in RR HO Cmd of TC_ho_neighbor_config_*

Related: SYS#4895 OS#5244
Related: Iae20df4387c3d75752301bd5daeeea7508966393 (osmo-bsc)
Change-Id: I09cb07561a57527880b87147495619a3bbbceb3f
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 04e895a..cc387f6 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -6267,7 +6267,8 @@
 				      charstring log_descr,
 				      charstring handover_vty_cmd,
 				      boolean expect_handover,
-				      boolean is_inter_bsc_handover := false)
+				      boolean is_inter_bsc_handover := false,
+				      template uint3_t expect_target_tsc := ?)
 runs on MSC_ConnHdlr
 {
 	/* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target
@@ -6299,6 +6300,17 @@
 			log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn);
 			log(l3.msgs.rrm.handoverCommand);
 
+			/* Verify correct TSC in handoverCommand */
+			var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.handoverCommand.channelDescription2);
+			if (not match(got_tsc, expect_target_tsc)) {
+				setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ",
+					   expect_target_tsc, " got ", got_tsc);
+				mtc.stop;
+			} else {
+				log("handoverCommand: verified TSC = ", got_tsc, " (matches ",
+				    expect_target_tsc, ")");
+			}
+
 			/* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2.  It doesn't really
 			 * matter on which BTS it really is, we're not going to follow through an entire handover
 			 * anyway. */
@@ -6407,7 +6419,7 @@
 	f_bts_0_cfg(BSCVTY, {"no neighbors"});
 	f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)",
 			"handover any to arfcn 871 bsic 11",
-			true);
+			true, expect_target_tsc := BTS_TSC[1]);
 
 	f_probe_for_handover("1.b", "HO to unknown cell does not start",
 			"handover any to arfcn 13 bsic 39",
@@ -6419,7 +6431,7 @@
 
 	f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)",
 			"handover any to arfcn 871 bsic 11",
-			true);
+			true, expect_target_tsc := BTS_TSC[1]);
 }
 testcase TC_ho_neighbor_config_1() runs on test_CT {
 	var MSC_ConnHdlr vc_conn;
@@ -6475,7 +6487,7 @@
 
 	f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor",
 			"handover any to arfcn 871 bsic 11",
-			true);
+			true, expect_target_tsc := BTS_TSC[1]);
 
 	f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor",
 			"handover any to arfcn 871 bsic 12",
@@ -6528,7 +6540,7 @@
 			false);
 	f_probe_for_handover("3.b", "HO to bts 2 works, explicitly listed as neighbor; no ambiguity because bts 3 is not listed as neighbor",
 			"handover any to arfcn 871 bsic 12",
-			true);
+			true, expect_target_tsc := BTS_TSC[2]);
 }
 testcase TC_ho_neighbor_config_3() runs on test_CT {
 	var MSC_ConnHdlr vc_conn;
@@ -6714,7 +6726,7 @@
 
 	f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2",
 			"handover any to arfcn 871 bsic 12",
-			true);
+			true, expect_target_tsc := BTS_TSC[2]);
 	f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO",
 			"handover any to arfcn 123 bsic 45",
 			true, true);