Change in osmo-ttcn3-hacks[master]: RAW_NS: rework NS connection to use NS_Provider

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Jan 11 02:05:27 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22090 )


Change subject: RAW_NS: rework NS connection to use NS_Provider
......................................................................

RAW_NS: rework NS connection to use NS_Provider

Previous RAW_NS only supported NS over UDP because
it handled the UDP connection on it's own.
Because of this there was no cleanup function for the tests
because no virtual component were started.
Using the new NS_Provider allows to use the same tests over
UDP and FR with no changes.

Change-Id: I8a3b6c72798a75f434f54229fdbfc802cd13967e
---
D library/RAW_NS.ttcn
A library/RAW_NS.ttcnpp
M pcu/PCU_Tests.cfg
M pcu/PCU_Tests_NS.ttcn
M pcu/PCU_Tests_SNS.cfg
M pcu/PCU_Tests_SNS.ttcn
M pcu/SGSN_Components.ttcn
M pcu/gen_links.sh
M sgsn/SGSN_Tests_NS.ttcn
M sgsn/gen_links.sh
10 files changed, 431 insertions(+), 311 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/22090/1

diff --git a/library/RAW_NS.ttcn b/library/RAW_NS.ttcn
deleted file mode 100644
index 7f7b6c4..0000000
--- a/library/RAW_NS.ttcn
+++ /dev/null
@@ -1,238 +0,0 @@
-module RAW_NS {
-
-/* Osmocom NS test suite for NS in TTCN-3
- * (C) 2018-2019 Harald Welte <laforge at gnumonks.org>
- * 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 General_Types all;
-import from Osmocom_Types all;
-import from Osmocom_Gb_Types all;
-import from NS_CodecPort all;
-import from NS_Types all;
-import from BSSGP_Types all;
-import from NS_CodecPort all;
-import from NS_CodecPort_CtrlFunct all;
-import from NS_Emulation all;
-import from Native_Functions all;
-import from IPL4asp_Types all;
-
-public type component RAW_NS_CT {
-	/* UDP port towards the bottom (IUT) */
-	port NS_CODEC_PT NSCP[4];
-	var ConnectionId g_ns_conn_id[4] := {-1, -1, -1, -1};
-	var NSConfiguration g_nsconfig[4];
-	timer g_T_guard;
-}
-
-public altstep as_Tguard() runs on RAW_NS_CT {
-	[] g_T_guard.timeout {
-		setverdict(fail, "Timeout of T_guard");
-		mtc.stop;
-		}
-}
-
-function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guard_secs := 60.0, integer tc_offset := 0) runs on RAW_NS_CT {
-	var Result res;
-
-	if (not g_T_guard.running) {
-		g_T_guard.start(guard_secs);
-		activate(as_Tguard());
-	}
-
-	if (not isbound(g_nsconfig) or not isbound(g_nsconfig[idx])) {
-		/* copy most parts from mp_nsconfig */
-		g_nsconfig[idx] := ns_config;
-		/* adjust those parts different for each NS-VC */
-		g_nsconfig[idx].nsvc[0].nsvci := ns_config.nsvc[0].nsvci + idx;
-		g_nsconfig[idx].nsvc[0].provider.ip.local_udp_port := ns_config.nsvc[0].provider.ip.local_udp_port + idx + tc_offset;
-	}
-
-	map(self:NSCP[idx], system:NSCP);
-	/* Connect the UDP socket */
-	var NSConfiguration nscfg := g_nsconfig[idx];
-	var NSVCConfiguration nsvc_cfg := nscfg.nsvc[0];
-	log("connecting NSCP[", idx, "] to ", nscfg);
-	res := f_IPL4_connect(NSCP[idx], nsvc_cfg.provider.ip.remote_ip, nsvc_cfg.provider.ip.remote_udp_port,
-				nsvc_cfg.provider.ip.local_ip, nsvc_cfg.provider.ip.local_udp_port, 0, { udp := {}});
-	if (not ispresent(res.connId)) {
-		setverdict(fail, "Could not connect NS UDP socket, check your configuration ", g_nsconfig[idx]);
-		mtc.stop;
-	}
-	g_ns_conn_id[idx] := res.connId;
-
-}
-
-public altstep ax_rx_fail_on_any_ns(integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom nrf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(?)) -> value nrf {
-		setverdict(fail, "Received unexpected NS: ", nrf);
-		mtc.stop;
-		}
-}
-
-function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT return PDU_NS {
-	var NS_RecvFrom nrf;
-	log("f_ns_exp() expecting ", exp_rx);
-	/* last activated altstep has the lowest priority */
-	var default d := activate(ax_rx_fail_on_any_ns());
-	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(exp_rx)) -> value nrf { }
-	}
-	deactivate(d);
-	return nrf.msg;
-}
-
-/* perform outbound NS-ALIVE procedure */
-function f_outgoing_ns_alive(integer idx := 0) runs on RAW_NS_CT {
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE));
-	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK));
-	[] NSCP[idx].receive { repeat; }
-	}
-}
-
-/* perform outbound NS-ALIVE procedure */
-function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
-	timer T := tout;
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE));
-	T.start;
-	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)) {
-		setverdict(fail, "Received unexpected NS-ALIVE ACK");
-		}
-	[] NSCP[idx].receive { repeat; }
-	[] T.timeout {
-		setverdict(pass);
-		}
-	}
-}
-
-function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
-	timer T := tout;
-	var template PDU_NS reset := ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig[idx].nsvc[0].nsvci, g_nsconfig[idx].nsei)
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], reset));
-	T.start;
-	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(ts_NS_RESET_ACK(g_nsconfig[idx].nsvc[0].nsvci, g_nsconfig[idx].nsei))) {
-		setverdict(pass);
-		}
-	[] NSCP[idx].receive { repeat; }
-	[] T.timeout {
-		setverdict(fail, "Failed to receive a RESET ACK");
-		}
-	}
-}
-
-/* perform outbound NS-BLOCK procedure */
-function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT {
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, g_nsconfig[idx].nsvc[0].nsvci)));
-	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_BLOCK_ACK(g_nsconfig[idx].nsvc[0].nsvci)));
-	[] NSCP[idx].receive { repeat; }
-	}
-}
-
-/* receive NS-ALIVE and ACK it */
-altstep as_rx_alive_tx_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	[] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE)) {
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE_ACK));
-		if (not oneshot) { repeat; }
-		}
-}
-
-/* Transmit BSSGP RESET for given BVCI and expect ACK */
-function f_tx_bvc_reset_rx_ack(BssgpBvci bvci, template (omit) BssgpCellId tx_cell_id, template BssgpCellId rx_cell_id,
-			       integer idx := 0, boolean exp_ack := true)
-runs on RAW_NS_CT {
-	var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS, bvci,
-						       tx_cell_id));
-	timer T := 5.0;
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx))));
-	T.start;
-	alt {
-	[exp_ack] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0,
-						  decmatch tr_BVC_RESET_ACK(bvci, rx_cell_id)))) {
-		setverdict(pass);
-		}
-	[exp_ack] T.timeout {
-		setverdict(fail, "No response to BVC-RESET");
-		}
-	[not exp_ack] T.timeout {
-		setverdict(pass);
-		}
-	[] NSCP[idx].receive { repeat; }
-	}
-}
-
-/* Receive a BSSGP RESET for given BVCI and ACK it */
-altstep as_rx_bvc_reset_tx_ack(BssgpBvci bvci, template BssgpCellId rx_cell_id, template (omit) BssgpCellId tx_cell_id,
-				boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom ns_rf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0,
-						  decmatch tr_BVC_RESET(?, bvci, rx_cell_id))))
-								-> value ns_rf {
-		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU);
-		var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET_ACK(bvci, tx_cell_id));
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx))));
-		if (not oneshot) { repeat; }
-		}
-}
-
-
-/* Receive a BSSGP UNBLOCK for given BVCI and ACK it */
-altstep as_rx_bvc_unblock_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom ns_rf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0,
-						  decmatch t_BVC_UNBLOCK(bvci))))
-								-> value ns_rf {
-		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU);
-		var PDU_BSSGP bssgp_tx := valueof(t_BVC_UNBLOCK_ACK(bvci));
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx))));
-		if (not oneshot) { repeat; }
-		}
-}
-
-/* Receive a BSSGP FLOW-CONTROL-BVC and ACK it */
-altstep as_rx_bvc_fc_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom ns_rf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, bvci,
-						  decmatch tr_BVC_FC_BVC)))
-								-> value ns_rf {
-		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU);
-		var OCT1 tag := bssgp_rx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value;
-		var PDU_BSSGP bssgp_tx := valueof(t_BVC_FC_BVC_ACK(tag));
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, bvci, enc_PDU_BSSGP(bssgp_tx))));
-		if (not oneshot) { repeat; }
-		}
-}
-
-/**********************************************************************************
- * Classic Gb/IP bring-up test cases using NS-{RESET,BLOCK,UNBLOCK} and no IP-SNS *
- **********************************************************************************/
-
-/* Receive a NS-RESET and ACK it */
-public altstep as_rx_ns_reset_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom ns_rf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig[idx].nsvc[0].nsvci,
-						  g_nsconfig[idx].nsei))) -> value ns_rf {
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_RESET_ACK(g_nsconfig[idx].nsvc[0].nsvci,
-									    g_nsconfig[idx].nsei)));
-		if (not oneshot) { repeat; }
-		}
-}
-/* Receive a NS-UNBLOCK and ACK it */
-public altstep as_rx_ns_unblock_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
-	var NS_RecvFrom ns_rf;
-	[] NSCP[idx].receive(t_NS_RecvFrom(t_NS_UNBLOCK)) -> value ns_rf {
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_UNBLOCK_ACK));
-		if (not oneshot) { repeat; }
-		}
-}
-
-}
diff --git a/library/RAW_NS.ttcnpp b/library/RAW_NS.ttcnpp
new file mode 100644
index 0000000..1d07086
--- /dev/null
+++ b/library/RAW_NS.ttcnpp
@@ -0,0 +1,263 @@
+module RAW_NS {
+
+/* Osmocom NS test suite for NS in TTCN-3
+ * (C) 2018-2019 Harald Welte <laforge at gnumonks.org>
+ * 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 Misc_Helpers all;
+import from General_Types all;
+import from Osmocom_Types all;
+import from Osmocom_Gb_Types all;
+import from NS_CodecPort all;
+import from NS_Emulation all;
+import from NS_Types all;
+import from BSSGP_Types all;
+import from NS_CodecPort all;
+import from NS_CodecPort_CtrlFunct all;
+import from NS_Emulation all;
+import from Native_Functions all;
+import from IPL4asp_Types all;
+import from NS_Provider_IPL4 all;
+#ifdef NS_EMULATION_FR
+import from NS_Provider_FR all;
+#endif
+
+public type component RAW_NS_CT {
+	/* UDP port towards the bottom (IUT) */
+	port NS_PROVIDER_PT NSCP[4];
+	var NS_Provider_IPL4_CT vc_NSP_IP[4];
+#ifdef NS_EMULATION_FR
+	var NS_Provider_FR_CT vc_NSP_FR[4];
+#endif
+	var NSConfiguration g_nsconfig;
+	timer g_T_guard;
+}
+
+public altstep as_Tguard() runs on RAW_NS_CT {
+	[] g_T_guard.timeout {
+		setverdict(fail, "Timeout of T_guard");
+		mtc.stop;
+		}
+}
+
+function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guard_secs := 60.0, charstring id := testcasename()) runs on RAW_NS_CT {
+	var Result res;
+
+	if (not g_T_guard.running) {
+		g_T_guard.start(guard_secs);
+		activate(as_Tguard());
+	}
+
+	if (not isbound(g_nsconfig)) {
+		g_nsconfig := ns_config;
+	}
+
+	if (ischosen(ns_config.nsvc[idx].provider.ip)) {
+		/* Connect the UDP socket */
+		vc_NSP_IP[idx] := NS_Provider_IPL4_CT.create(id & "-provIP");
+		connect(self:NSCP[idx], vc_NSP_IP[idx]:NSE);
+		vc_NSP_IP[idx].start(NS_Provider_IPL4.main(ns_config.nsvc[idx], ns_config, id));
+#ifdef NS_EMULATION_FR
+	} else if (ischosen(ns_config.nsvc[idx].provider.fr)) {
+		vc_NSP_FR[idx] := NS_Provider_FR_CT.create(id & "-provFR");
+		connect(self:NSCP[idx], vc_NSP_FR[idx]:NSE);
+		vc_NSP_FR[idx].start(NS_Provider_FR.main(ns_config.nsvc[idx], ns_config, id));
+#endif
+	} else {
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unsupported NS provider");
+	}
+
+	NSCP[idx].receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP});
+}
+
+function f_clean_ns_codec() runs on RAW_NS_CT {
+	for (var integer i := 0; i < lengthof(vc_NSP_IP); i := i + 1) {
+		vc_NSP_IP[i].stop;
+	}
+#ifdef NS_EMULATION_FR
+	for (var integer i := 0; i < lengthof(vc_NSP_FR); i := i + 1) {
+		vc_NSP_FR[i].stop;
+	}
+#endif NS_EMULATION_FR
+}
+
+public altstep ax_rx_fail_on_any_ns(integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS nrf;
+	[] NSCP[idx].receive(PDU_NS: ?) -> value nrf {
+		setverdict(fail, "Received unexpected NS: ", nrf);
+		mtc.stop;
+		}
+}
+
+function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT return PDU_NS {
+	var PDU_NS nrf;
+	log("f_ns_exp() expecting ", exp_rx);
+	/* last activated altstep has the lowest priority */
+	var default d := activate(ax_rx_fail_on_any_ns());
+	alt {
+	[] NSCP[idx].receive(PDU_NS: exp_rx) -> value nrf { }
+	}
+	deactivate(d);
+	return nrf;
+}
+
+/* perform outbound NS-ALIVE procedure */
+function f_outgoing_ns_alive(integer idx := 0) runs on RAW_NS_CT {
+	NSCP[idx].send(t_NS_ALIVE);
+	alt {
+	[] NSCP[idx].receive(t_NS_ALIVE_ACK);
+	[] NSCP[idx].receive { repeat; }
+	}
+}
+
+/* perform outbound NS-ALIVE procedure */
+function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
+	timer T := tout;
+	NSCP[idx].send(t_NS_ALIVE);
+	T.start;
+	alt {
+	[] NSCP[idx].receive(t_NS_ALIVE_ACK) {
+		setverdict(fail, "Received unexpected NS-ALIVE ACK");
+		}
+	[] NSCP[idx].receive { repeat; }
+	[] T.timeout {
+		setverdict(pass);
+		}
+	}
+}
+
+function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
+	timer T := tout;
+	var template PDU_NS reset := ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)
+	NSCP[idx].send(reset);
+	T.start;
+	alt {
+	[] NSCP[idx].receive(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)) {
+		setverdict(pass);
+		}
+	[] NSCP[idx].receive { repeat; }
+	[] T.timeout {
+		setverdict(fail, "Failed to receive a RESET ACK");
+		}
+	}
+}
+
+/* perform outbound NS-BLOCK procedure */
+function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT {
+	NSCP[idx].send(ts_NS_BLOCK(cause, g_nsconfig.nsvc[idx].nsvci));
+	alt {
+	[] NSCP[idx].receive(tr_NS_BLOCK_ACK(g_nsconfig.nsvc[idx].nsvci));
+	[] NSCP[idx].receive { repeat; }
+	}
+}
+
+/* perform outbound NS-UNBLOCK procedure */
+function f_outgoing_ns_unblock(integer idx := 0) runs on RAW_NS_CT {
+	NSCP[idx].send(t_NS_UNBLOCK);
+	alt {
+	[] NSCP[idx].receive(t_NS_UNBLOCK_ACK);
+	[] NSCP[idx].receive { repeat; }
+	}
+}
+
+/* receive NS-ALIVE and ACK it */
+altstep as_rx_alive_tx_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	[] NSCP[idx].receive(t_NS_ALIVE) {
+		NSCP[idx].send(t_NS_ALIVE_ACK);
+		if (not oneshot) { repeat; }
+		}
+}
+
+/* Transmit BSSGP RESET for given BVCI and expect ACK */
+function f_tx_bvc_reset_rx_ack(BssgpBvci bvci, template (omit) BssgpCellId tx_cell_id, template BssgpCellId rx_cell_id,
+			       integer idx := 0, boolean exp_ack := true)
+runs on RAW_NS_CT {
+	var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS, bvci,
+						       tx_cell_id));
+	timer T := 5.0;
+	NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
+	T.start;
+	alt {
+	[exp_ack] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0,
+						   decmatch tr_BVC_RESET_ACK(bvci, rx_cell_id))) {
+		setverdict(pass);
+		}
+	[exp_ack] T.timeout {
+		setverdict(fail, "No response to BVC-RESET");
+		}
+	[not exp_ack] T.timeout {
+		setverdict(pass);
+		}
+	[] NSCP[idx].receive { repeat; }
+	}
+}
+
+/* Receive a BSSGP RESET for given BVCI and ACK it */
+altstep as_rx_bvc_reset_tx_ack(BssgpBvci bvci, template BssgpCellId rx_cell_id, template (omit) BssgpCellId tx_cell_id,
+				boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS ns_rf;
+	[] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0,
+						  decmatch tr_BVC_RESET(?, bvci, rx_cell_id)))
+								-> value ns_rf {
+		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
+		var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET_ACK(bvci, tx_cell_id));
+		NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
+		if (not oneshot) { repeat; }
+		}
+}
+
+
+/* Receive a BSSGP UNBLOCK for given BVCI and ACK it */
+altstep as_rx_bvc_unblock_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS ns_rf;
+	[] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch t_BVC_UNBLOCK(bvci))) -> value ns_rf {
+		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
+		var PDU_BSSGP bssgp_tx := valueof(t_BVC_UNBLOCK_ACK(bvci));
+		NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
+		if (not oneshot) { repeat; }
+		}
+}
+
+/* Receive a BSSGP FLOW-CONTROL-BVC and ACK it */
+altstep as_rx_bvc_fc_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS ns_rf;
+	[] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, bvci,
+					    decmatch tr_BVC_FC_BVC))
+								-> value ns_rf {
+		var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
+		var OCT1 tag := bssgp_rx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value;
+		var PDU_BSSGP bssgp_tx := valueof(t_BVC_FC_BVC_ACK(tag));
+		NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, bvci, enc_PDU_BSSGP(bssgp_tx)));
+		if (not oneshot) { repeat; }
+		}
+}
+
+/**********************************************************************************
+ * Classic Gb/IP bring-up test cases using NS-{RESET,BLOCK,UNBLOCK} and no IP-SNS *
+ **********************************************************************************/
+
+/* Receive a NS-RESET and ACK it */
+public altstep as_rx_ns_reset_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS ns_rf;
+	[] NSCP[idx].receive(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig.nsvc[idx].nsvci,
+						  g_nsconfig.nsei)) -> value ns_rf {
+		NSCP[idx].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei));
+		if (not oneshot) { repeat; }
+		}
+}
+/* Receive a NS-UNBLOCK and ACK it */
+public altstep as_rx_ns_unblock_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
+	var PDU_NS ns_rf;
+	[] NSCP[idx].receive(t_NS_UNBLOCK) -> value ns_rf {
+		NSCP[idx].send(t_NS_UNBLOCK_ACK);
+		if (not oneshot) { repeat; }
+		}
+}
+
+}
diff --git a/pcu/PCU_Tests.cfg b/pcu/PCU_Tests.cfg
index dd6b111..13bedec 100644
--- a/pcu/PCU_Tests.cfg
+++ b/pcu/PCU_Tests.cfg
@@ -22,6 +22,30 @@
 				}
 			},
 			nsvci := 1234
+		},
+		{
+			provider := {
+				ip := {
+					address_family := AF_INET,
+					local_ip := "127.0.0.1",
+					local_udp_port := 23001,
+					remote_ip := "127.0.0.1",
+					remote_udp_port := 22000
+				}
+			},
+			nsvci := 1234
+		},
+		{
+			provider := {
+				ip := {
+					address_family := AF_INET,
+					local_ip := "127.0.0.1",
+					local_udp_port := 23002,
+					remote_ip := "127.0.0.1",
+					remote_udp_port := 22000
+				}
+			},
+			nsvci := 1234
 		}
 	}
 }
diff --git a/pcu/PCU_Tests_NS.ttcn b/pcu/PCU_Tests_NS.ttcn
index e782b6e..c4d46d1 100644
--- a/pcu/PCU_Tests_NS.ttcn
+++ b/pcu/PCU_Tests_NS.ttcn
@@ -70,7 +70,7 @@
 	timer T := tout;
 	T.start;
 	alt {
-	[] NSCP[idx].receive(t_NS_RecvFrom(ns)) {
+	[] NSCP[idx].receive(ns) {
 		setverdict(fail, "NS-ALIVE from unconfigured (possibly initial) endpoint");
 		}
 	[] T.timeout {
@@ -88,6 +88,7 @@
 	/* Expect inbound NS-RESET procedure */
 	as_rx_ns_reset_ack(oneshot := true);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* ensure NS-RESET are re-transmitted */
@@ -97,13 +98,14 @@
 
 	var integer i;
 	for (i := 0; i < 3; i := i+1) {
-		NSCP[0].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION,
-							g_nsconfig[0].nsvc[0].nsvci, g_nsconfig[0].nsei)));
+		NSCP[0].receive(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION,
+					    g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei));
 	}
 
 	/* Expect inbound NS-RESET procedure */
 	as_rx_ns_reset_ack(oneshot := true);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* test the inbound NS-ALIVE procedure after NS-RESET */
@@ -116,9 +118,10 @@
 
 	alt {
 	/* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
-	[] NSCP[0].receive(t_NS_RecvFrom(t_NS_ALIVE)) { setverdict(pass); };
-	[] NSCP[0].receive(t_NS_RecvFrom(t_NS_UNBLOCK)) { repeat; }
+	[] NSCP[0].receive(t_NS_ALIVE) { setverdict(pass); };
+	[] NSCP[0].receive(t_NS_UNBLOCK) { repeat; }
 	}
+	f_clean_ns_codec();
 }
 
 /* Test for NS-RESET after NS-ALIVE timeout */
@@ -132,15 +135,17 @@
 	/* wait for at least one NS-ALIVE */
 	alt {
 	[] as_rx_alive_tx_ack(oneshot := true) { };
-	[] NSCP[0].receive(t_NS_RecvFrom(t_NS_UNBLOCK)) { repeat; }
+	[] NSCP[0].receive(t_NS_UNBLOCK) { repeat; }
 	}
 
 	/* wait for NS-RESET to re-appear, ignoring any NS-ALIVE until then */
 	alt {
 	[] as_rx_ns_reset_ack(oneshot := true) { setverdict(pass); }
-	[] NSCP[0].receive(t_NS_RecvFrom(t_NS_ALIVE)) { repeat; }
-	[] NSCP[0].receive(t_NS_RecvFrom(t_NS_UNBLOCK)) { repeat; }
+	[] NSCP[0].receive(t_NS_ALIVE) { repeat; }
+	[] NSCP[0].receive(t_NS_UNBLOCK) { repeat; }
 	}
+
+	f_clean_ns_codec();
 }
 
 /* test for NS-RESET/NS-ALIVE/NS-UNBLOCK */
@@ -156,6 +161,7 @@
 
 	as_rx_ns_unblock_ack(oneshot := true);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* test for NS-UNBLOCK re-transmissions */
@@ -170,11 +176,12 @@
 	activate(as_rx_alive_tx_ack());
 
 	/* wait for first NS-UNBLOCK, don't respond */
-	NSCP[0].receive(t_NS_RecvFrom(t_NS_UNBLOCK));
+	NSCP[0].receive(t_NS_UNBLOCK);
 
 	/* wait for re-transmission of NS-UNBLOCK */
 	as_rx_ns_unblock_ack(oneshot := true);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* full bring-up of the Gb link for NS and BSSGP layer up to BVC-FC */
@@ -205,6 +212,7 @@
 	as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
 	activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci));
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* test outbound (SGSN-originated) NS-BLOCK procedure */
@@ -224,6 +232,7 @@
 
 	f_outgoing_ns_block(NS_CAUSE_EQUIPMENT_FAILURE);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 
diff --git a/pcu/PCU_Tests_SNS.cfg b/pcu/PCU_Tests_SNS.cfg
index e5a08fe..ab589c5 100644
--- a/pcu/PCU_Tests_SNS.cfg
+++ b/pcu/PCU_Tests_SNS.cfg
@@ -21,6 +21,30 @@
 				}
 			},
 			nsvci := 1234
+		},
+		{
+			provider := {
+				ip := {
+					address_family := AF_INET,
+					local_ip := "127.0.0.1",
+					local_udp_port := 23001,
+					remote_ip := "127.0.0.1",
+					remote_udp_port := 22000
+				}
+			},
+			nsvci := 1234
+		},
+		{
+			provider := {
+				ip := {
+					address_family := AF_INET,
+					local_ip := "127.0.0.1",
+					local_udp_port := 23002,
+					remote_ip := "127.0.0.1",
+					remote_udp_port := 22000
+				}
+			},
+			nsvci := 1234
 		}
 	}
 }
diff --git a/pcu/PCU_Tests_SNS.ttcn b/pcu/PCU_Tests_SNS.ttcn
index ea78761..ad1858b 100644
--- a/pcu/PCU_Tests_SNS.ttcn
+++ b/pcu/PCU_Tests_SNS.ttcn
@@ -28,18 +28,18 @@
 runs on RAW_NS_CT {
 	log("f_incoming_sns_size(idx=", idx, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
 
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		/* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */
-		rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
+		rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8,
 					   num_v4 := 4, num_v6 := omit), idx);
 	} else {
 		/* expect one single SNS-SIZE with RESET flag; no v4 EP; 4x v6 EP */
-		rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
+		rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8,
 					   num_v4 := omit, num_v6 := 4), idx);
 	}
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause)));
+	NSCP[idx].send(ts_SNS_SIZE_ACK(g_nsconfig.nsei, cause));
 }
 
 /* perform outbound SNS-SIZE procedure */
@@ -47,19 +47,19 @@
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_size(idx=", idx, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
 
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 1,
+		NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1,
 								num_v4 := 1, num_v6 := omit)
-					));
+					);
 	} else {
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 1,
+		NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1,
 								num_v4 := omit, num_v6 := 1)
-					));
+					);
 	}
 	/* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */
-	rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause), idx);
+	rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, cause), idx);
 }
 
 /* perform inbound SNS-CONFIG procedure */
@@ -67,18 +67,18 @@
 runs on RAW_NS_CT {
 	log("f_incoming_sns_config(idx=", idx, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
 
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip,
 								   nsvc_cfg.provider.ip.remote_udp_port) };
-		rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := v4_elem), idx);
+		rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v4 := v4_elem), idx);
 	} else {
 		var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip,
 								   nsvc_cfg.provider.ip.remote_udp_port) };
-		rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v6 := v6_elem), idx);
+		rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v6 := v6_elem), idx);
 	}
-	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause)));
+	NSCP[idx].send(ts_SNS_CONFIG_ACK(g_nsconfig.nsei, cause));
 }
 
 /* perform outbound SNS-CONFIG procedure */
@@ -86,18 +86,18 @@
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_config(idx=", idx, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
 
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port) }
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
 	} else {
 		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port) }
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
 	}
-	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
+	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
 }
 
 /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
@@ -107,19 +107,19 @@
 	var PDU_NS rx;
 
 	if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
-		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[0].nsvc[0].provider.ip.local_udp_port, 1, 0),
-							 ts_SNS_IPv4(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 0, 1) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
+		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[0].provider.ip.local_ip,
+								     g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0),
+							 ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip,
+								     g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) };
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
 	} else {
-		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[0].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[0].nsvc[0].provider.ip.local_udp_port, 1, 0),
-							 ts_SNS_IPv6(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 0, 1) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
+		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[0].provider.ip.local_ip,
+								     g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0),
+							 ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip,
+								     g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) };
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
 	}
-	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
+	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
 }
 
 /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
@@ -128,38 +128,38 @@
 	log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
 	var PDU_NS rx;
 	if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
-		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 1, 0),
-							 ts_SNS_IPv4(g_nsconfig[2].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[2].nsvc[0].provider.ip.local_udp_port, 0, 1) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
+		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip,
+								     g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0),
+							 ts_SNS_IPv4(g_nsconfig.nsvc[2].provider.ip.local_ip,
+								     g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) };
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
 	} else {
-		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 1, 0),
-							 ts_SNS_IPv6(g_nsconfig[2].nsvc[0].provider.ip.local_ip,
-								     g_nsconfig[2].nsvc[0].provider.ip.local_udp_port, 0, 1) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
+		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip,
+								     g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0),
+							 ts_SNS_IPv6(g_nsconfig.nsvc[2].provider.ip.local_ip,
+								     g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) };
+		NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
 	}
-	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
+	rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
 }
 
 function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0, template (omit) NsCause cause := omit)
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_add(idx_add=", idx_add, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx_add].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_add];
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_ADD(g_nsconfig[idx].nsei, 23, v4)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 23, cause, v4));
+		NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, v4));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, v4));
 	} else {
 		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_ADD(g_nsconfig[idx].nsei, 23, omit, v6)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 23, cause, omit, v6));
+		NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, omit, v6));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, omit, v6));
 	}
 }
 
@@ -167,19 +167,19 @@
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_del(idx_del=", idx_del, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx_del].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_del];
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_DEL(g_nsconfig[idx].nsei, 24, omit, v4)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, v4));
+		NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, v4));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, v4));
 	} else {
 		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_DEL(g_nsconfig[idx].nsei, 24, omit, omit, v6)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, omit, v6));
+		NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, omit, v6));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, omit, v6));
 	}
 }
 
@@ -187,19 +187,19 @@
 runs on RAW_NS_CT {
 	log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")");
 	var PDU_NS rx;
-	var NSVCConfiguration nsvc_cfg := g_nsconfig[idx_chg].nsvc[0];
+	var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_chg];
 	if (nsvc_cfg.provider.ip.address_family == AF_INET) {
 		var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, v4)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, v4));
+		NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, v4));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, v4));
 	} else {
 		var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
 								     nsvc_cfg.provider.ip.local_udp_port,
 								     w_sig, w_user) };
-		NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, omit, v6)));
-		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, omit, v6));
+		NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, omit, v6));
+		rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, omit, v6));
 	}
 }
 
@@ -214,6 +214,7 @@
 	f_incoming_sns_size();
 	f_sleep(1.0);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* PCU-originated SNS-SIZE: NACK from our side */
@@ -225,6 +226,7 @@
 	/* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
 	f_sleep(10.0);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* PCU-originated SNS-CONFIG: successful case */
@@ -235,6 +237,7 @@
 	f_incoming_sns_config();
 	f_sleep(1.0);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* PCU-originated SNS-CONFIG: successful case */
@@ -246,6 +249,7 @@
 	/* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
 	f_sleep(10.0);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 
@@ -272,6 +276,7 @@
 	as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
 	activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci));
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
@@ -327,6 +332,7 @@
 testcase TC_sns_1c1u() runs on RAW_Test_CT {
 	f_sns_bringup_1c1u();
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
@@ -387,6 +393,7 @@
 testcase TC_sns_1c1u_separate() runs on RAW_Test_CT {
 	f_sns_bringup_1c1u_separate();
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use
@@ -394,6 +401,7 @@
 testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT {
 	f_sns_bringup_1c1u_separate(sgsn_originated_reset := true);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */
@@ -420,6 +428,7 @@
 	/* Transmit BVC-RESET and expect no ACK*/
 	f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1, exp_ack := false);
 	f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id, idx := 1, exp_ack := false);
+	f_clean_ns_codec();
 }
 
 /* Test adding new IP endpoints at runtime */
@@ -437,6 +446,7 @@
 
 	f_outgoing_ns_alive(2);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* Test adding an already present IP endpoint at runtime */
@@ -445,6 +455,7 @@
 
 	f_outgoing_sns_add(idx_add := 0, w_sig := 0, w_user := 1, idx := 0, cause := NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* Test deleting IP endpoints at runtime */
@@ -454,6 +465,7 @@
 	f_outgoing_sns_del(idx_del := 1, w_sig := 0, w_user := 1, idx := 0);
 	/* FIXME: ensure we don't receive anything on just-deleted NS-VC anymore */
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 /* Test changing weights at runtime */
@@ -463,6 +475,7 @@
 	/* change w_user from 1 to 200 */
 	f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0);
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 import from PCUIF_Types all;
@@ -485,6 +498,7 @@
 			       tr_PCUIF_DATA_REQ(bts_nr:=0, trx_nr:=0, ts_nr:=0, block_nr:=?, fn:=?,
 						 sapi:=PCU_IF_SAPI_AGCH, data:=?)));
 	setverdict(pass);
+	f_clean_ns_codec();
 }
 
 
diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn
index 18f3992..08d9231 100644
--- a/pcu/SGSN_Components.ttcn
+++ b/pcu/SGSN_Components.ttcn
@@ -55,6 +55,30 @@
 					}
 				},
 				nsvci := 0
+			},
+			{
+				provider := {
+					ip := {
+						address_family := AF_INET,
+						local_udp_port := 23001,
+						local_ip := "127.0.0.1",
+						remote_udp_port := 21000,
+						remote_ip := "127.0.0.1"
+					}
+				},
+				nsvci := 0
+			},
+			{
+				provider := {
+					ip := {
+						address_family := AF_INET,
+						local_udp_port := 23002,
+						local_ip := "127.0.0.1",
+						remote_udp_port := 21000,
+						remote_ip := "127.0.0.1"
+					}
+				},
+				nsvci := 0
 			}
 		}
 	};
diff --git a/pcu/gen_links.sh b/pcu/gen_links.sh
index a33cb27..c2a8189 100755
--- a/pcu/gen_links.sh
+++ b/pcu/gen_links.sh
@@ -54,7 +54,7 @@
 FILES+="NS_Provider_IPL4.ttcn NS_Emulation.ttcnpp NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
 FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
-FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn RAW_NS.ttcn "
+FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn RAW_NS.ttcnpp "
 gen_links $DIR $FILES
 
 ignore_pp_results
diff --git a/sgsn/SGSN_Tests_NS.ttcn b/sgsn/SGSN_Tests_NS.ttcn
index cce32cc..1715404 100644
--- a/sgsn/SGSN_Tests_NS.ttcn
+++ b/sgsn/SGSN_Tests_NS.ttcn
@@ -23,31 +23,31 @@
 
 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_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
 	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();
+	f_clean_ns_codec();
 }
 
 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_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
 	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));
+	NSCP[0].send(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(t_NS_ALIVE_ACK);
+	[] NSCP[0].receive(tr_NS_STATUS(*)) { setverdict(fail); }
 	[] NSCP[0].receive { repeat; }
 	}
 
 	f_sleep(1.0);
-	f_cleanup();
+	f_clean_ns_codec();
 }
 
 control {
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index 47baa54..78cda26 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -92,7 +92,7 @@
 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 RAW_NS.ttcn "
+FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn IPCP_Types.ttcn RAW_NS.ttcnpp "
 gen_links $DIR $FILES
 
 ignore_pp_results

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22090
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8a3b6c72798a75f434f54229fdbfc802cd13967e
Gerrit-Change-Number: 22090
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210111/190a9ec9/attachment.htm>


More information about the gerrit-log mailing list