PCU: Add tests for our new IP Sub-Network-Service (SNS) Gb interface

The SNS-enabled Gb interface has no RESET/BLOCK/UNBLOCK procedures,
but introduces a bunch of new SNS procedures.  Most importantly the
SNS-SIZE and SNS-CONFIG procedures.

Change-Id: I0fe3d4579960bab0494c294ec7ab8032feed4fb2
Related: OS#3372
diff --git a/pcu/PCU_Tests_RAW_SNS.ttcn b/pcu/PCU_Tests_RAW_SNS.ttcn
new file mode 100644
index 0000000..fa906a8
--- /dev/null
+++ b/pcu/PCU_Tests_RAW_SNS.ttcn
@@ -0,0 +1,86 @@
+module PCU_Tests_RAW_SNS {
+
+import from Osmocom_Types all;
+import from PCU_Tests all;
+import from PCU_Tests_RAW all;
+
+/**********************************************************************************
+ * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS)
+ **********************************************************************************/
+
+/* PCU-originated SNS-SIZE: successful case */
+testcase TC_sns_po_size_success() runs on RAW_NS_CT {
+	f_init_ns_codec();
+	f_init_pcuif();
+	f_incoming_sns_size();
+	f_sleep(1.0);
+	setverdict(pass);
+}
+
+/* PCU-originated SNS-SIZE: NACK from our side */
+testcase TC_sns_po_size_nack() runs on RAW_NS_CT {
+	f_init_ns_codec();
+	f_init_pcuif();
+	f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
+	/* FIXME: ensure we don't get a SNS-CONFIG */
+	/* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
+	f_sleep(10.0);
+	setverdict(pass);
+}
+
+/* PCU-originated SNS-CONFIG: successful case */
+testcase TC_sns_po_config_success() runs on RAW_NS_CT {
+	f_init_ns_codec();
+	f_init_pcuif();
+	f_incoming_sns_size();
+	f_incoming_sns_config();
+	f_sleep(1.0);
+	setverdict(pass);
+}
+
+/* PCU-originated SNS-CONFIG: successful case */
+testcase TC_sns_po_config_nack() runs on RAW_NS_CT {
+	f_init_ns_codec();
+	f_init_pcuif();
+	f_incoming_sns_size();
+	f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
+	/* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
+	f_sleep(10.0);
+	setverdict(pass);
+}
+
+
+/* SGSN-originated SNS-SIZE: successful case */
+testcase TC_sns_so_config_success() runs on RAW_NS_CT {
+	f_init_ns_codec();
+	f_init_pcuif();
+	f_incoming_sns_size();
+	f_incoming_sns_config();
+	f_outgoing_sns_config();
+
+	/* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
+	as_rx_alive_tx_ack(oneshot := true);
+	activate(as_rx_alive_tx_ack());
+
+	f_outgoing_ns_alive();
+
+	/* Expect BVC-RESET for signaling (0) and ptp BVCI */
+	as_rx_bvc_reset_tx_ack(0, oneshot := true);
+	as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true);
+	as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true);
+
+	/* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
+	as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci, oneshot := true);
+	activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci));
+	setverdict(pass);
+}
+
+control {
+	execute( TC_sns_po_size_success() );
+	execute( TC_sns_po_size_nack() );
+	execute( TC_sns_po_config_success() );
+	execute( TC_sns_po_config_nack() );
+	execute( TC_sns_so_config_success() );
+}
+
+}