WIP: ns: Add test for SNS Size Num. of NSVCs IE

Related: OS#5208
Change-Id: Ic69c461cdb854a1b7abd27c56d70c3cbe32e6eb7
diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index f57302f..2b703fc 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -640,6 +640,31 @@
 	f_clean_ns_codec();
 }
 
+testcase TC_sns_sgsn_sns_size_outgoing_invalid_num_of_nsvcs() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig);
+	/* Assumption: No connections to other NSEs for SUT and testcomponent */
+	const integer sgsn_ip4_endpoints := lengthof(mp_nsconfig.nsvc);
+	const integer ip4_endpoints := lengthof(mp_nsconfig.nsvc);
+	const integer num_of_nsvcs := sgsn_ip4_endpoints * ip4_endpoints;
+	const integer IDX := 0;
+	/* Template that would be accepted, only missing the number of IP endpoints
+	 * (since there are no ternary operators in TTCN-3...) */
+	var template (omit) PDU_NS ts_base_SNS_SIZE_configured :=
+		ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := num_of_nsvcs,
+			    num_v4 := omit, num_v6 := omit);
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[IDX];
+	ts_base_SNS_SIZE_configured.pDU_SNS_Size.nSEI_NS := ts_NS_IE_NSEI(g_nsconfig.nsei);
+	f_set_num_of_ip_endpoints(ts_base_SNS_SIZE_configured, g_nsconfig.nsvc[0].provider.ip.address_family);
+	/* Assumption: No connections to other NSEs for SUT and testcomponent and thus no other endpoints */
+	const integer required_max_num_of_nsvcs := num_of_nsvcs;
+	const uint16_t invalid_max_num_of_nsvcs := required_max_num_of_nsvcs - 1;
+	ts_base_SNS_SIZE_configured.pDU_SNS_Size.maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(invalid_max_num_of_nsvcs);
+	const NsCause cause := NS_CAUSE_INVALID_NR_OF_NSVCS;
+	f_send_expect(IDX, ts_base_SNS_SIZE_configured, cause);
+	f_clean_ns_codec();
+}
+
 testcase TC_sns_bss_config_success() runs on RAW_Test_CT {
 	f_init_vty();
 	f_init_ns_codec(mp_nsconfig);
@@ -1181,6 +1206,7 @@
 			execute( TC_sns_sgsn_size_after_success() );
 			execute( TC_sns_sgsn_sns_size_syntactically_wrong_NSEI() );
 			execute( TC_sns_sgsn_sns_size_invalid_num_of_ip_eps() );
+			execute( TC_sns_sgsn_sns_size_outgoing_invalid_num_of_nsvcs() );
 		}
 	}
 }