fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38032?usp=email )
Change subject: library/PFCP_Emulation: look up by SeqNr and SEID separately
......................................................................
library/PFCP_Emulation: look up by SeqNr and SEID separately
This allows routing of PFCP PDUs without SEID by SeqNr.
An example of such a PDU is the Heartbeat Request.
Change-Id: Ic7912d944e94852a587993708d51439ec90f08cd
---
M library/PFCP_Emulation.ttcn
1 file changed, 27 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/32/38032/1
diff --git a/library/PFCP_Emulation.ttcn b/library/PFCP_Emulation.ttcn
index 9cd9a86..74f4cdd 100644
--- a/library/PFCP_Emulation.ttcn
+++ b/library/PFCP_Emulation.ttcn
@@ -74,13 +74,20 @@
type record of PFCPEM_conn PFCPEM_conns;
-private function f_PFCPEM_conn_by_seid_or_seqnr(OCT8 seid, LIN3_BO_LAST seqnr) runs on
PFCP_Emulation_CT return PFCP_ConnHdlr {
- log("looking for seid ", seid, " seqnr ", seqnr, " in conns
", g_conns);
+private function f_PFCPEM_conn_by_seqnr(LIN3_BO_LAST seqnr)
+runs on PFCP_Emulation_CT return PFCP_ConnHdlr {
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
if (isbound(g_conns[i].pfcp_msg_sequence_number)
and seqnr == g_conns[i].pfcp_msg_sequence_number) {
return g_conns[i].vc_conn;
}
+ }
+ return null;
+};
+
+private function f_PFCPEM_conn_by_seid(OCT8 seid)
+runs on PFCP_Emulation_CT return PFCP_ConnHdlr {
+ for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
if (isbound(g_conns[i].seid)
and seid == g_conns[i].seid) {
return g_conns[i].vc_conn;
@@ -89,6 +96,23 @@
return null;
};
+private function f_PFCPEM_conn_for_pdu(in PDU_PFCP pdu)
+runs on PFCP_Emulation_CT return PFCP_ConnHdlr {
+ var PFCP_ConnHdlr vc_conn := null;
+
+ vc_conn := f_PFCPEM_conn_by_seqnr(pdu.sequence_number);
+ if (vc_conn != null) {
+ return vc_conn;
+ }
+
+ /* If there is a SEID, we can look it up */
+ if (pdu.s_flag == '1'B) {
+ vc_conn := f_PFCPEM_conn_by_seid(pdu.seid);
+ }
+
+ return vc_conn;
+};
+
private function f_PFCPEM_add_conn(PFCP_ConnHdlr vc_conn) runs on PFCP_Emulation_CT {
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
if (g_conns[i].vc_conn == vc_conn) {
@@ -134,11 +158,7 @@
[] PFCP.receive(tr_PFCP_UD(?)) -> value ud {
log("PFCP_Emulation main() PFCP.receive: ", ud);
- vc_conn := null;
- if (ud.pdu.s_flag == '1'B) {
- /* There is a SEID */
- vc_conn := f_PFCPEM_conn_by_seid_or_seqnr(ud.pdu.seid, ud.pdu.sequence_number);
- }
+ vc_conn := f_PFCPEM_conn_for_pdu(ud.pdu);
if (vc_conn != null) {
log("found destination ", vc_conn);
CLIENT.send(ud.pdu) to vc_conn;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38032?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: Ic7912d944e94852a587993708d51439ec90f08cd
Gerrit-Change-Number: 38032
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>