SGSN: Some initial SNS tests for IP-SNS in OsmoSGSN

Change-Id: I821d998704756fa30278f41d0371051db9d3fc58
diff --git a/sgsn/SGSN_Tests_NS.ttcn b/sgsn/SGSN_Tests_NS.ttcn
index dd68b05..e5d012f 100644
--- a/sgsn/SGSN_Tests_NS.ttcn
+++ b/sgsn/SGSN_Tests_NS.ttcn
@@ -47,9 +47,74 @@
 	f_clean_ns_codec();
 }
 
+/* perform outgoing SNS-SIZE procedure */
+testcase TC_SNS_size() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
+	g_handle_rx_alive := true;
+
+	f_outgoing_sns_size();
+	setverdict(pass);
+}
+
+/* outgoing SNS-SIZE procedure with more BSS side IPs than SGSN can handle */
+testcase TC_SNS_size_too_big() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
+	g_handle_rx_alive := true;
+
+	f_outgoing_sns_size(cause := NS_CAUSE_INVALID_NR_OF_NSVCS, num_ip := 100);
+	setverdict(pass);
+}
+
+/* perform outgoing SNS-CONFIG procedure (for BSS) */
+testcase TC_SNS_config_bss() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
+	g_handle_rx_alive := true;
+
+	f_outgoing_sns_size();
+	f_outgoing_sns_config();
+	setverdict(pass);
+}
+
+/* perform incoming SNS-CONFIG procedure (for SGSN) */
+testcase TC_SNS_config_sgsn() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
+	g_handle_rx_alive := true;
+
+	f_outgoing_sns_size();
+	f_outgoing_sns_config();
+	f_incoming_sns_config();
+	setverdict(pass);
+}
+
+/* perform full SNS handshake and then outbound NS-ALIVE */
+testcase TC_SNS_and_alive() runs on RAW_Test_CT {
+	f_init_vty();
+	f_init_ns_codec(mp_nsconfig[0], guard_secs := 120.0);
+	g_handle_rx_alive := true;
+
+	f_outgoing_sns_size();
+	f_outgoing_sns_config();
+	f_incoming_sns_config();
+	f_outgoing_ns_alive();
+	setverdict(pass);
+}
+
 control {
-	execute( TC_NS_connect_alive() );
-	execute( TC_NS_connect_reset() );
+
+	if (mp_nsconfig[0].handle_sns) {
+		execute( TC_SNS_size() );
+		execute( TC_SNS_size_too_big() );
+		execute( TC_SNS_config_bss() );
+		execute( TC_SNS_config_sgsn() );
+		execute( TC_SNS_and_alive() );
+	} else {
+		execute( TC_NS_connect_alive() );
+		execute( TC_NS_connect_reset() );
+	}
 }
 
 }