laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34286?usp=email )
Change subject: GTPv2_Emulation: improve accessibility of unit-data (TEID0)
......................................................................
GTPv2_Emulation: improve accessibility of unit-data (TEID0)
When GTPv2 unit-data is passed around, there is always the problem that
it is routed to the MTC_CT (TEID0). The reason for this is that GTPv2_Emulation
cannot determine a specific receiver component because unit-data does
not contain any addressing fields that would identifiy a specific vc_conn.
In GTPv2_Emulation there is already a mechanism implemented that detects
responses by their sequence number. Untfortunately this does only work
when the vc_conn has send a unit-data message before so that the
sequence number of the response can be guessed.
In case the first messages comes from the IUT, there is no way to
determine the receiving vc_conn, so this message is then routed to the
MCT_CT (TEID0). This can be a problem for testcases that run from inside
a ConnHdlr componet.
The solution that is proposed in this patch uses a mechanism that allows
to create an expectation for a specific messageType. When the GTPv2_Emulation
sees a unit-data message with the expected messageType, it will forward
it to all ConnHdlr (vc_conn) components that have registered for this
messageType previously.
Related: OS#5760
Change-Id: I02bb74d7bd547347168b5c64ee6512c71e8fd960
---
M library/GTPv2_Emulation.ttcn
1 file changed, 80 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/library/GTPv2_Emulation.ttcn b/library/GTPv2_Emulation.ttcn
index ff6a60a..571da4e 100644
--- a/library/GTPv2_Emulation.ttcn
+++ b/library/GTPv2_Emulation.ttcn
@@ -69,7 +69,9 @@
var TidTableRec TidTable[256];
var SeqTableRec SeqTable[256];
var ImsiTableRec ImsiTable[256];
+ var UdMsgTableRec UdMsgTable[256];
var PidTableRec PidTable[256];
+
var integer g_uecups_conn_id;
};
@@ -91,6 +93,12 @@
GTP2_ConnHdlr vc_conn
};
+/* Unit data message type <-> ConnHdlr mapping */
+type record UdMsgTableRec {
+ OCT1 messageType,
+ GTP2_ConnHdlr vc_conn
+};
+
/* pid <-> ConnHdlr mapping (for UECUPS process termination indication) */
type record PidTableRec {
/* process ID of the running process */
@@ -202,6 +210,18 @@
testcase.stop("No Space in IMSI Table for ", imsi);
}
+private function f_udmsg_tbl_add(OCT1 messageType, GTP2_ConnHdlr vc_conn) runs on GTPv2_Emulation_CT {
+ var integer i;
+ for (i := 0; i < sizeof(UdMsgTable); i := i+1) {
+ if (not isbound(UdMsgTable[i].messageType)) {
+ UdMsgTable[i].messageType := messageType;
+ UdMsgTable[i].vc_conn := vc_conn;
+ return;
+ }
+ }
+ testcase.stop("No Space in UdMsg Table for messateType ", messageType);
+}
+
private function f_pid_tbl_add(integer pid, GTP2_ConnHdlr vc_conn) runs on GTPv2_Emulation_CT {
var integer i;
for (i := 0; i < sizeof(PidTable); i := i+1) {
@@ -419,11 +439,27 @@
}
}
+private function SendToUdMsgTable(Gtp2cUnitdata g2c_ud) runs on GTPv2_Emulation_CT {
+ var GTP2_ConnHdlr vc_conn;
+
+ for (var integer i := 0; i < sizeof(UdMsgTable); i := i + 1) {
+ if (isbound(UdMsgTable[i].messageType)) {
+ if (UdMsgTable[i].messageType == g2c_ud.gtpc.messageType) {
+ vc_conn := UdMsgTable[i].vc_conn;
+ CLIENT.send(g2c_ud.gtpc) to vc_conn;
+ }
+ }
+ }
+
+ return;
+}
+
function main(Gtp2EmulationCfg cfg) runs on GTPv2_Emulation_CT {
var Gtp2cUnitdata g2c_ud;
var PDU_GTPCv2 g2c;
var GTP2_ConnHdlr vc_conn;
var hexstring imsi;
+ var OCT1 messageType;
var OCT4 teid;
var PDU_UECUPS rx_uecups;
var UECUPS_CreateTun gtc;
@@ -444,6 +480,7 @@
vc_conn := f_comp_by_seq(g2c_ud.gtpc.sequenceNumber);
CLIENT.send(g2c_ud.gtpc) to vc_conn;
} else {
+ SendToUdMsgTable(g2c_ud);
TEID0.send(g2c_ud.gtpc);
}
} else if (ispresent(g2c_ud.gtpc.tEID) and g2c_ud.gtpc.tEID != int2oct(0, 4)) {
@@ -499,6 +536,10 @@
f_imsi_tbl_add(imsi, vc_conn);
CLIENT_PROC.reply(GTP2EM_register_imsi:{imsi}) to vc_conn;
}
+ [] CLIENT_PROC.getcall(GTP2EM_register_udmsg:{?}) -> param(messageType) sender vc_conn {
+ f_udmsg_tbl_add(messageType, vc_conn);
+ CLIENT_PROC.reply(GTP2EM_register_udmsg:{messageType}) to vc_conn;
+ }
[] CLIENT_PROC.getcall(GTP2EM_register_teid:{?}) -> param(teid) sender vc_conn {
f_tid_tbl_add(teid, vc_conn);
@@ -539,6 +580,7 @@
} with { extension "internal" };
signature GTP2EM_register_imsi(hexstring imsi);
+signature GTP2EM_register_udmsg(OCT1 messageType);
signature GTP2EM_register_teid(OCT4 teid);
signature GTP2EM_allocate_teid() return OCT4;
signature GTP2EM_create_tunnel(UECUPS_CreateTun gtc);
@@ -546,7 +588,7 @@
signature GTP2EM_start_program(UECUPS_StartProgram sprog) return UECUPS_StartProgramRes;
type port GTP2EM_PROC_PT procedure {
- inout GTP2EM_register_imsi, GTP2EM_register_teid, GTP2EM_allocate_teid,
+ inout GTP2EM_register_imsi, GTP2EM_register_udmsg, GTP2EM_register_teid, GTP2EM_allocate_teid,
GTP2EM_create_tunnel, GTP2EM_destroy_tunnel, GTP2EM_start_program;
} with { extension "internal" };
@@ -565,6 +607,12 @@
}
}
+function f_gtp2_register_udmsg(OCT1 messageType) runs on GTP2_ConnHdlr {
+ GTP2_PROC.call(GTP2EM_register_udmsg:{messageType}) {
+ [] GTP2_PROC.getreply(GTP2EM_register_udmsg:{messageType});
+ }
+}
+
function f_gtp2_register_teid(OCT4 teid) runs on GTP2_ConnHdlr {
GTP2_PROC.call(GTP2EM_register_teid:{teid}) {
[] GTP2_PROC.getreply(GTP2EM_register_teid:{teid});
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34286?usp=email
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: I02bb74d7bd547347168b5c64ee6512c71e8fd960
Gerrit-Change-Number: 34286
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34267?usp=email )
Change subject: NAS_Templates: fix ts_NAS_GUTI
......................................................................
NAS_Templates: fix ts_NAS_GUTI
The template ts_NAS_GUTI permutates the MCC/MNC digits in a weird way,
which seems to map to a format that is not used anywhere else. Also the
template is not used anywhere yet.
Let's not permutate the MCC/MNC digit, instead let's put a comment that
makes clear which format has to be used.
Change-Id: I9546993987b873e8ae921664238b234608e37bba
Related: OS#5760
---
M library/NAS_Templates.ttcn
1 file changed, 23 insertions(+), 4 deletions(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/library/NAS_Templates.ttcn b/library/NAS_Templates.ttcn
index f819862..bbe7237 100644
--- a/library/NAS_Templates.ttcn
+++ b/library/NAS_Templates.ttcn
@@ -111,13 +111,15 @@
template (value) GUTI ts_NAS_GUTI(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := {
oddevenIndicator := '0'B,
spare := '1111'B,
- /* mcc_mnc specified in format 262f42 */
+ /* use the mcc_mnc format as specified in 3GPP TS 24.301, figure 9.9.3.12.1.
+ * Example: mcc=262, mnc=42 => 262f42.
+ * mcc=001, mnc=01 => 001f01. */
mccDigit1 := mcc_mnc[0],
mccDigit2 := mcc_mnc[1],
mccDigit3 := mcc_mnc[2],
- mncDigit3 := mcc_mnc[5],
- mncDigit1 := mcc_mnc[3],
- mncDigit2 := mcc_mnc[4],
+ mncDigit3 := mcc_mnc[3],
+ mncDigit1 := mcc_mnc[4],
+ mncDigit2 := mcc_mnc[5],
mMEGI := mmegi,
mMEC := mmec,
mTMSI := tmsi
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34267?usp=email
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: I9546993987b873e8ae921664238b234608e37bba
Gerrit-Change-Number: 34267
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34265?usp=email )
Change subject: GTPv2_Emulation: make sure g_uecups_conn_id is populated.
......................................................................
GTPv2_Emulation: make sure g_uecups_conn_id is populated.
In function f_init, we activate altstep as_uecups_ind at the end of the
function. In as_uecups we use the template generator function
tr_UECUPS_RecvFrom_R(). In this function we use g_uecups_conn_id, which
is only populated when use_gtpu_daemon is set to true. When
use_gtpu_daemon is false g_uecups_conn_id will be <unbound>, which leads
into an error.
Related: OS#5760
Change-Id: Ifc2e8d9de13d5d183d6f052b2092c356ab4973d1
---
M library/GTPv2_Emulation.ttcn
1 file changed, 19 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/library/GTPv2_Emulation.ttcn b/library/GTPv2_Emulation.ttcn
index 5bb3b1e..ff6a60a 100644
--- a/library/GTPv2_Emulation.ttcn
+++ b/library/GTPv2_Emulation.ttcn
@@ -389,6 +389,8 @@
remPort := g_gtp2_cfg.gtpc_remote_port
}
+ g_uecups_conn_id := res.connId;
+
if (g_gtp2_cfg.use_gtpu_daemon) {
map(self:UECUPS, system:UECUPS);
res := UECUPS_CodecPort_CtrlFunct.f_IPL4_connect(UECUPS, mp_uecups_host, mp_uecups_port, "", -1, -1, { sctp := valueof(ts_SCTP) });
@@ -396,7 +398,6 @@
setverdict(fail, "Could not connect UECUPS socket, check your configuration");
testcase.stop;
}
- g_uecups_conn_id := res.connId;
/* clear all tunnel state in the daemon at start */
f_uecups_xceive({reset_all_state := {}}, {reset_all_state_res:=?}, 30.0);
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34265?usp=email
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: Ifc2e8d9de13d5d183d6f052b2092c356ab4973d1
Gerrit-Change-Number: 34265
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged