[M] Change in osmo-ttcn3-hacks[master]: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

2023-10-23 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?usp=email )

 (

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req
..

epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

Change-Id: I8f18c927b1897806233cc9d049c25694c1e639d4
---
M epdg/EPDG_Tests.ttcn
1 file changed, 84 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve




diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index f93b77b..3a0c3a6 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -2,6 +2,7 @@

 import from Misc_Helpers all;
 import from General_Types all;
+import from Native_Functions all;
 import from Osmocom_Types all;
 import from L3_Common all;

@@ -13,6 +14,8 @@
 import from DIAMETER_Templates all;
 import from DIAMETER_Emulation all;

+import from GTPv2_Types all;
+import from GTPv2_Templates all;
 import from GTPv2_Emulation all;

 modulepar {
@@ -108,6 +111,17 @@

 type record EPDG_ConnHdlrPars {
hexstring imsi,
+   charstring ue_ip,
+
+   /* TEI (Data) local side */
+   OCT4 teid,
+   /* TEI (Control) local side */
+   OCT4 teic,
+   /* TEI (Data) remote side */
+   OCT4 teid_remote optional,
+   /* TEI (Control) remote side */
+   OCT4 teic_remote optional,
+
AuthVector vec optional
 };

@@ -122,11 +136,15 @@
}
 }

-
 private function f_init_pars(integer imsi_suffix := 1)
 runs on MTC_CT return EPDG_ConnHdlrPars {
var EPDG_ConnHdlrPars pars := {
imsi := f_gen_imsi(imsi_suffix),
+   ue_ip := "192.168.123.50",
+   teid := ''O,
+   teic := ''O,
+   teid_remote := omit,
+   teic_remote := omit,
vec := f_gen_auth_vec_3g()
};
return pars;
@@ -231,7 +249,7 @@
use_gtpu_daemon := false /* TODO: maybe use, set to true */
};

-   vc_GTP2 := GTPv2_Emulation_CT.create("GTP2_EM");
+   vc_GTP2 := GTPv2_Emulation_CT.create(id & "-GTPV2");
map(vc_GTP2:GTP2C, system:GTP2C);
connect(vc_GTP2:TEID0, self:TEID0);
vc_GTP2.start(GTPv2_Emulation.main(cfg));
@@ -255,6 +273,9 @@
/* tell GSUP dispatcher to send this IMSI to us */
f_create_gsup_expect(hex2str(g_pars.imsi));

+   /* tell GTPv2 dispatcher to send this IMSI to us */
+   f_gtp2_register_imsi(g_pars.imsi);
+
fn.apply(id);
 }

@@ -266,9 +287,14 @@

vc_conn := EPDG_ConnHdlr.create(id);

+   /* GSUP */
connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT);
connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC);

+   /* GTP2 */
+   connect(vc_conn:GTP2, vc_GTP2:CLIENT);
+   connect(vc_conn:GTP2_PROC, vc_GTP2:CLIENT_PROC);
+
/* SWx */
vc_conn_swx := DIAMETER_ConnHdlr_CT.create(id);
connect(vc_conn_swx:DIAMETER, vc_SWx:DIAMETER_CLIENT);
@@ -336,6 +362,36 @@
}
 }

+/* Diameter SWx SAR + SAA. */
+private altstep as_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
+   var PDU_GTPCv2 rx_msg;
+   var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
+   var template (value) PDN_AddressAllocation paa;
+
+   [] GTP2.receive(tr_GTP2C_CreateSessionReq(g_pars.imsi)) -> value rx_msg 
{
+   /* TODO: parse TEIC and TEID and store it in 
g_pars.remote_tei{c,d} */
+
+   /* allocate + register TEID-C on local side */
+   g_pars.teic := f_gtp2_allocate_teid();
+   g_pars.teid := g_pars.teic;
+
+   fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S2b_ePDG_GTPC, 
g_pars.teic, 0,
+   f_inet_addr(mp_s2b_local_ip), omit);
+   fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S2bU_ePDG_GTPU, 
g_pars.teid, 2,
+   f_inet_addr(mp_s2b_local_ip), omit);
+   paa := ts_GTP2C_PdnAddrAlloc_v4(f_inet_addr(g_pars.ue_ip));
+   GTP2.send(ts_GTP2C_CreateSessionResp({ fteid_c_ie }, paa));
+   setverdict(pass);
+   }
+   [] GTP2.receive(PDU_GTPCv2:?) -> value rx_msg {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected GTP2C msg rx: ", rx_msg));
+   }
+}
+private function f_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
+   f_gtp2_register_udmsg('20'O);
+   as_GTP2C_CreateSession_success();
+}
+
 /* GSUP AuthInfo Req + Resp, triggers SWx MAR + MAA. */
 private function f_GSUP_AI_success() runs on EPDG_ConnHdlr {
var GSUP_PDU rx_gsup;
@@ -363,7 +419,7 @@
var template octetstring destination_name := *;
GSUP.send(ts_GSUP_UL_REQ(g_pars.imsi));

[M] Change in osmo-ttcn3-hacks[master]: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

2023-10-20 Thread pespin
Attention is currently required from: lynxis lazus, pespin.

Hello Jenkins Builder, fixeria, lynxis lazus, osmith,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder

The change is no longer submittable: Verified is unsatisfied now.


Change subject: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req
..

epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

Change-Id: I8f18c927b1897806233cc9d049c25694c1e639d4
---
M epdg/EPDG_Tests.ttcn
1 file changed, 84 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/33/34833/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?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: I8f18c927b1897806233cc9d049c25694c1e639d4
Gerrit-Change-Number: 34833
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Attention: lynxis lazus 
Gerrit-MessageType: newpatchset


[M] Change in osmo-ttcn3-hacks[master]: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

2023-10-20 Thread fixeria
Attention is currently required from: lynxis lazus, pespin.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?usp=email )

Change subject: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?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: I8f18c927b1897806233cc9d049c25694c1e639d4
Gerrit-Change-Number: 34833
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Attention: lynxis lazus 
Gerrit-Comment-Date: Fri, 20 Oct 2023 08:29:08 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

2023-10-19 Thread osmith
Attention is currently required from: lynxis lazus, pespin.

osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?usp=email )

Change subject: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?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: I8f18c927b1897806233cc9d049c25694c1e639d4
Gerrit-Change-Number: 34833
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Attention: lynxis lazus 
Gerrit-Comment-Date: Thu, 19 Oct 2023 15:11:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

2023-10-19 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34833?usp=email )


Change subject: epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req
..

epdg: Test GTPv2C CreateSession triggerd by EPDG_Tunnel Req

Change-Id: I8f18c927b1897806233cc9d049c25694c1e639d4
---
M epdg/EPDG_Tests.ttcn
1 file changed, 84 insertions(+), 3 deletions(-)



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

diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index 2006632..24e924a 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -2,6 +2,7 @@

 import from Misc_Helpers all;
 import from General_Types all;
+import from Native_Functions all;
 import from Osmocom_Types all;
 import from L3_Common all;

@@ -13,6 +14,8 @@
 import from DIAMETER_Templates all;
 import from DIAMETER_Emulation all;

+import from GTPv2_Types all;
+import from GTPv2_Templates all;
 import from GTPv2_Emulation all;

 modulepar {
@@ -108,6 +111,17 @@

 type record EPDG_ConnHdlrPars {
hexstring imsi,
+   charstring ue_ip,
+
+   /* TEI (Data) local side */
+   OCT4 teid,
+   /* TEI (Control) local side */
+   OCT4 teic,
+   /* TEI (Data) remote side */
+   OCT4 teid_remote optional,
+   /* TEI (Control) remote side */
+   OCT4 teic_remote optional,
+
AuthVector vec optional
 };

@@ -122,11 +136,15 @@
}
 }

-
 private function f_init_pars(integer imsi_suffix := 1)
 runs on MTC_CT return EPDG_ConnHdlrPars {
var EPDG_ConnHdlrPars pars := {
imsi := f_gen_imsi(imsi_suffix),
+   ue_ip := "192.168.123.50",
+   teid := ''O,
+   teic := ''O,
+   teid_remote := omit,
+   teic_remote := omit,
vec := f_gen_auth_vec_3g()
};
return pars;
@@ -231,7 +249,7 @@
use_gtpu_daemon := false /* TODO: maybe use, set to true */
};

-   vc_GTP2 := GTPv2_Emulation_CT.create("GTP2_EM");
+   vc_GTP2 := GTPv2_Emulation_CT.create(id & "-GTPV2");
map(vc_GTP2:GTP2C, system:GTP2C);
connect(vc_GTP2:TEID0, self:TEID0);
vc_GTP2.start(GTPv2_Emulation.main(cfg));
@@ -255,6 +273,9 @@
/* tell GSUP dispatcher to send this IMSI to us */
f_create_gsup_expect(hex2str(g_pars.imsi));

+   /* tell GTPv2 dispatcher to send this IMSI to us */
+   f_gtp2_register_imsi(g_pars.imsi);
+
fn.apply(id);
 }

@@ -266,9 +287,14 @@

vc_conn := EPDG_ConnHdlr.create(id);

+   /* GSUP */
connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT);
connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC);

+   /* GTP2 */
+   connect(vc_conn:GTP2, vc_GTP2:CLIENT);
+   connect(vc_conn:GTP2_PROC, vc_GTP2:CLIENT_PROC);
+
/* SWx */
vc_conn_swx := DIAMETER_ConnHdlr_CT.create(id);
connect(vc_conn_swx:DIAMETER, vc_SWx:DIAMETER_CLIENT);
@@ -336,6 +362,36 @@
}
 }

+/* Diameter SWx SAR + SAA. */
+private altstep as_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
+   var PDU_GTPCv2 rx_msg;
+   var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
+   var template (value) PDN_AddressAllocation paa;
+
+   [] GTP2.receive(tr_GTP2C_CreateSessionReq(g_pars.imsi)) -> value rx_msg 
{
+   /* TODO: parse TEIC and TEID and store it in 
g_pars.remote_tei{c,d} */
+
+   /* allocate + register TEID-C on local side */
+   g_pars.teic := f_gtp2_allocate_teid();
+   g_pars.teid := g_pars.teic;
+
+   fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S2b_ePDG_GTPC, 
g_pars.teic, 0,
+   f_inet_addr(mp_s2b_local_ip), omit);
+   fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S2bU_ePDG_GTPU, 
g_pars.teid, 2,
+   f_inet_addr(mp_s2b_local_ip), omit);
+   paa := ts_GTP2C_PdnAddrAlloc_v4(f_inet_addr(g_pars.ue_ip));
+   GTP2.send(ts_GTP2C_CreateSessionResp({ fteid_c_ie }, paa));
+   setverdict(pass);
+   }
+   [] GTP2.receive(PDU_GTPCv2:?) -> value rx_msg {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected GTP2C msg rx: ", rx_msg));
+   }
+}
+private function f_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
+   f_gtp2_register_udmsg('20'O);
+   as_GTP2C_CreateSession_success();
+}
+
 /* GSUP AuthInfo Req + Resp, triggers SWx MAR + MAA. */
 private function f_GSUP_AI_success() runs on EPDG_ConnHdlr {
var GSUP_PDU rx_gsup;
@@ -363,7 +419,7 @@
var template octetstring destination_name := *;
GSUP.send(ts_GSUP_UL_REQ(g_pars.imsi));
as_DIA_SWx_SA_success();
-   /* Expect a positive response back to the translator; expect AIA */
+   /* Expect a positive response back to the translator */