aboutsummaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-07 04:26:20 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-09-25 01:31:44 +0200
commit8e1dfd0d0fb24de9d600fd9cbdf38b2efcbde225 (patch)
tree1160623c143d8e2fb19a15e98afbce6efd6398d0 /sgsn
parent904f50115d945fb51cf0af7d1c5375ded85fd188 (diff)
SGSN: introduce NS tests
Similiar to the PCU_Tests_NS introduce SGSN_Tests_NS. Change-Id: Ib2bffbb110961474928f35d212cb492d4b6fdee0
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.cfg1
-rw-r--r--sgsn/SGSN_Tests.ttcn3
-rw-r--r--sgsn/SGSN_Tests_NS.ttcn58
-rwxr-xr-xsgsn/gen_links.sh3
4 files changed, 62 insertions, 3 deletions
diff --git a/sgsn/SGSN_Tests.cfg b/sgsn/SGSN_Tests.cfg
index d6182eb7..d5c3a4cb 100644
--- a/sgsn/SGSN_Tests.cfg
+++ b/sgsn/SGSN_Tests.cfg
@@ -42,3 +42,4 @@ SGSN_Tests.mp_ggsn_ip := "127.0.0.103"
[EXECUTE]
SGSN_Tests.control
SGSN_Tests_Iu.control
+SGSN_Tests_NS.control
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index abbcb648..b42020d0 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -12,6 +12,7 @@ module SGSN_Tests {
*/
friend module SGSN_Tests_Iu;
+friend module SGSN_Tests_NS;
import from General_Types all;
import from Osmocom_Types all;
@@ -257,7 +258,7 @@ private function f_init_gtp(charstring id) runs on test_CT {
vc_GTP.start(GTP_Emulation.main(gtp_cfg));
}
-private function f_init_vty() runs on test_CT {
+friend function f_init_vty() runs on test_CT {
map(self:SGSNVTY, system:SGSNVTY);
f_vty_set_prompts(SGSNVTY);
f_vty_transceive(SGSNVTY, "enable");
diff --git a/sgsn/SGSN_Tests_NS.ttcn b/sgsn/SGSN_Tests_NS.ttcn
new file mode 100644
index 00000000..cce32cc1
--- /dev/null
+++ b/sgsn/SGSN_Tests_NS.ttcn
@@ -0,0 +1,58 @@
+module SGSN_Tests_NS {
+
+/* Osmocom SGSN test suite in TTCN-3
+ * (C) 2020 sysmocom - s.f.m.c. GmbH
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+import from Osmocom_Types all;
+import from Osmocom_Gb_Types all;
+import from Osmocom_VTY_Functions all;
+import from NS_CodecPort all;
+import from NS_Types all;
+import from RAW_NS all;
+import from SGSN_Tests all;
+
+type component RAW_Test_CT extends RAW_NS_CT, test_CT {
+}
+
+testcase TC_NS_connect_reset() runs on RAW_Test_CT {
+ f_init_vty();
+ f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0, tc_offset := 10);
+ f_vty_config(SGSNVTY, "ns", "encapsulation udp use-reset-block-unblock enabled");
+
+ /* Send a NS-ALIVE */
+ f_outgoing_ns_reset();
+
+ f_sleep(1.0);
+ f_cleanup();
+}
+
+testcase TC_NS_connect_alive() runs on RAW_Test_CT {
+ f_init_vty();
+ f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0, tc_offset := 20);
+ f_vty_config(SGSNVTY, "ns", "encapsulation udp use-reset-block-unblock disabled");
+
+ /* Send a NS-ALIVE */
+ NSCP[0].send(t_NS_Send(g_ns_conn_id[0], t_NS_ALIVE));
+ alt {
+ [] NSCP[0].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK));
+ [] NSCP[0].receive(t_NS_RecvFrom(tr_NS_STATUS(*))) { setverdict(fail); }
+ [] NSCP[0].receive { repeat; }
+ }
+
+ f_sleep(1.0);
+ f_cleanup();
+}
+
+control {
+ execute( TC_NS_connect_alive() );
+ execute( TC_NS_connect_reset() );
+}
+
+}
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index c9de23af..334df590 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -92,8 +92,7 @@ FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
FILES+="RAN_Emulation.ttcnpp RAN_Adapter.ttcnpp SCCP_Templates.ttcn "
# IPA_Emulation + dependencies
FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc GSUP_Types.ttcn GSUP_Emulation.ttcn "
-FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn
-GTP_Templates.ttcn IPCP_Types.ttcn "
+FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn IPCP_Types.ttcn RAW_NS.ttcn "
gen_links $DIR $FILES
ignore_pp_results