ns: test if SNS fails when all signalling NSVCs failes

As 3GPP TS 48.016 ยง 7.4b.1.1 specifies this behaviour.
1. do success SNS configuration
2. change sig weight of the seconds inactive bind
3. add second bind to SNS
4. stop reacting to NS_ALIVE on first NSVC (only NSVC with sig weight)
5. expect SNS SIZE

Related: OS#5039
Change-Id: Id06e34e7235d94a06152a0015487a507d6492a97
diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 8bbb43c..9fbd5ab 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -626,6 +626,41 @@
 	f_clean_ns_codec();
 }
 
+/* Test if SNS fails when all signalling NSVCs failes
+ * 3GPP TS 48.016 § 7.4b.1.1
+ * 1. do success SNS configuration
+ * 2. change sig weight of the seconds inactive bind
+ * 3. add second bind to SNS
+ * 4. stop reacting to NS_ALIVE on first NSVC (only NSVC with sig weight)
+ * 5. expect SNS SIZE
+ */
+testcase TC_sns_bss_all_signalling_nsvcs_failed() runs on RAW_Test_CT {
+	g_handle_rx_alive := true;
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig);
+	f_init_ns_codec(mp_nsconfig, 1);
+	f_incoming_sns_size();
+	f_incoming_sns_config();
+	f_outgoing_sns_config();
+	var default d := activate(as_rx_alive_tx_ack());
+
+	f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 0 data-weight 99");
+	f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2");
+	f_incoming_sns_add(idx_add := 1, w_sig := 0, w_user := 99);
+	as_rx_alive_tx_ack(oneshot := true, idx := 1);
+	activate(as_rx_alive_tx_ack(idx := 1));
+	/* 2x NSVCs up, stop first NSVC */
+	deactivate(d);
+	/* libosmocore will rotate the SNS binds on failure */
+	NSCP[0].receive(t_NS_ALIVE);
+	NSCP[0].receive(t_NS_ALIVE);
+	NSCP[0].receive(t_NS_ALIVE);
+	f_incoming_sns_size(idx := 1);
+
+	setverdict(pass);
+	f_clean_ns_codec();
+}
+
 control {
 	if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == NS2_DIALECT_IPACCESS) {
 		execute( TC_tx_reset() );
@@ -676,6 +711,7 @@
 		execute( TC_sns_bss_add() );
 		execute( TC_sns_bss_del() );
 		execute( TC_sns_bss_add_change_del() );
+		execute( TC_sns_bss_all_signalling_nsvcs_failed() );
 	}
 }