fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38034?usp=email )
Change subject: library/PFCP_Emulation: add (optional) COMMON port
......................................................................
library/PFCP_Emulation: add (optional) COMMON port
Change-Id: Id8e8564cd92aaf6c8f640fd94d7626db400c1e1d
---
M library/PFCP_Emulation.ttcn
1 file changed, 30 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/34/38034/1
diff --git a/library/PFCP_Emulation.ttcn b/library/PFCP_Emulation.ttcn
index c671095..98dad59 100644
--- a/library/PFCP_Emulation.ttcn
+++ b/library/PFCP_Emulation.ttcn
@@ -46,6 +46,9 @@
port PFCPEM_PT CLIENT;
port PFCPEM_PROC_PT CLIENT_PROC;
+ /* Common port for Node Related Procedures */
+ port PFCPEM_PT COMMON;
+
/* Configuration by the user */
var PFCP_Emulation_Cfg g_pfcp_cfg;
@@ -123,6 +126,23 @@
g_conns := g_conns & { conn };
}
+private function f_send_pdu(inout PDU_PFCP pdu) runs on PFCP_Emulation_CT {
+ if (pdu.sequence_number == 0) {
+ pdu.sequence_number := f_PFCPEM_next_sequence_nr();
+ }
+
+ var PFCP_Unitdata ud := {
+ peer := {
+ conn_id := g_pfcp_conn_id,
+ remote_name := g_pfcp_cfg.pfcp_remote_ip,
+ remote_port := g_pfcp_cfg.pfcp_remote_port
+ },
+ pdu := pdu
+ };
+
+ PFCP.send(ud);
+}
+
private function f_init(PFCP_Emulation_Cfg cfg) runs on PFCP_Emulation_CT {
var Result res;
@@ -161,31 +181,26 @@
if (vc_conn != null) {
log("found destination ", vc_conn);
CLIENT.send(ud.pdu) to vc_conn;
- } else {
+ } else if (ispresent(ud.pdu.seid)) {
log("sending to all conns: ", g_conns);
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
CLIENT.send(ud.pdu) to g_conns[i].vc_conn;
}
+ } else if (COMMON.checkstate("Connected")) {
+ log("sending via COMMON port");
+ COMMON.send(ud.pdu);
}
}
+ [] COMMON.receive(PDU_PFCP:?) -> value pdu {
+ log("PFCP_Emulation main() COMMON.receive: ", pdu);
+ f_send_pdu(pdu);
+ }
+
[] CLIENT.receive(PDU_PFCP:?) -> value pdu sender vc_conn {
log("PFCP_Emulation main() CLIENT.receive from ", vc_conn, ": ",
pdu);
- if (pdu.sequence_number == 0) {
- pdu.sequence_number := f_PFCPEM_next_sequence_nr();
- }
- ud := {
- peer := {
- conn_id := g_pfcp_conn_id,
- remote_name := g_pfcp_cfg.pfcp_remote_ip,
- remote_port := g_pfcp_cfg.pfcp_remote_port
- },
- pdu := pdu
- };
-
+ f_send_pdu(pdu); /* may update pdu.sequence_number */
f_PFCPEM_conn_add_or_update({vc_conn, pdu.seid, pdu.sequence_number});
-
- PFCP.send(ud);
}
[] CLIENT_PROC.getcall(PFCPEM_register:{}) -> sender vc_conn {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38034?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id8e8564cd92aaf6c8f640fd94d7626db400c1e1d
Gerrit-Change-Number: 38034
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>