bsc: add test TC_si2_ncc_permitted

Related: SYS#6579
Change-Id: Ibff5c4392d8c19b5bce479b6fa5e33086cdb1272
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 7773153..f2844e1 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -3108,6 +3108,56 @@
 	f_shutdown_helper();
 }
 
+/* Verify NCC Permitted in System Information Type 2
+ * 3GPP TS 44.018 § 10.5.2.27 */
+testcase TC_si2_ncc_permitted() runs on test_CT {
+	var ASP_RSL_Unitdata rx_rsl_ud;
+	timer T := 5.0;
+	var BIT8 exp;
+
+	f_init_vty();
+
+	/* Set NCC Permitted to 6 7 8 */
+	f_vty_enter_cfg_bts(BSCVTY, 0);
+	f_vty_transceive(BSCVTY, "ncc-permitted 6 7 8");
+	f_vty_transceive(BSCVTY, "end");
+	exp := '11100000'B;
+
+	f_init(1);
+	T.start;
+
+	/* Check value in SI 2 */
+	alt {
+	[] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_2))) -> value rx_rsl_ud {
+		var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */
+		var SystemInformation si := dec_SystemInformation(ie.other.payload);
+
+		if (si.header.message_type != SYSTEM_INFORMATION_TYPE_2) {
+			setverdict(fail, "RSL FULL BCCH Information IE contains: ", si);
+			repeat;
+		}
+
+		if (si.payload.si2.ncc_permitted != exp) {
+			setverdict(fail, "NCC Permitted is ", si.payload.si2.ncc_permitted, " but expected ", exp);
+			break;
+		}
+
+		}
+	[] IPA_RSL[0][0].receive { repeat; }
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI2)");
+		}
+	}
+
+	/* Reset NCC Permitted to default (all permitted). This is already
+	 * getting tested in TC_si_default(). */
+	f_vty_enter_cfg_bts(BSCVTY, 0);
+	f_vty_transceive(BSCVTY, "ncc-permitted all");
+	f_vty_transceive(BSCVTY, "end");
+
+	f_shutdown_helper();
+}
+
 testcase TC_ctrl_msc_connection_status() runs on test_CT {
 	var charstring ctrl_resp;
 
@@ -12430,6 +12480,7 @@
 	execute( TC_si2quater_49_earfcns() );
 	execute( TC_si_acc_rotate() );
 	execute( TC_si_acc_ramp_rotate() );
+	execute( TC_si2_ncc_permitted() ); /* TODO: test in SI6 too */
 
 	/* RSL DCHAN Channel ACtivation / Deactivation */
 	execute( TC_chan_act_noreply() );