[S] Change in osmo-ttcn3-hacks[master]: epdg: Emulate PGW tx AAR and rx AAA in S6b interface

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

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

Change subject: epdg: Emulate PGW tx AAR and rx AAA in S6b interface
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34861?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: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
Gerrit-Change-Number: 34861
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: lynxis lazus 
Gerrit-Comment-Date: Tue, 24 Oct 2023 21:35:22 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in osmo-ttcn3-hacks[master]: epdg: Emulate PGW tx AAR and rx AAA in S6b interface

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

Change subject: epdg: Emulate PGW tx AAR and rx AAA in S6b interface
..

epdg: Emulate PGW tx AAR and rx AAA in S6b interface

Related: OS#6229
Change-Id: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
---
M epdg/EPDG_Tests.ttcn
1 file changed, 42 insertions(+), 7 deletions(-)

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




diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index 3a0c3a6..76fd45e 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -32,6 +32,8 @@
/* our emulated PGW (Diameter S6b) */
charstring mp_s6b_local_ip := "127.0.0.100";
integer mp_s6b_local_port := 3869;
+   charstring mp_s6b_remote_ip := "127.0.0.1";
+   integer mp_s6b_remote_port := 3869;

/* our emulated PGW (GTPv2C S2b) */
charstring mp_s2b_local_ip := "127.0.0.100";
@@ -212,14 +214,14 @@

/* S6b setup: */
pars := {
-   remote_ip := "",
-   remote_sctp_port := -1, /* server mode */
+   remote_ip := mp_s6b_remote_ip,
+   remote_sctp_port := mp_s6b_remote_port, /* client mode */
local_ip := mp_s6b_local_ip,
local_sctp_port := mp_s6b_local_port,
-   origin_host := "hss." & mp_diam_realm,
+   origin_host := "pgw." & mp_diam_realm,
origin_realm := mp_diam_realm,
-   auth_app_id := omit,
-   vendor_app_id := c_DIAMETER_3GPP_S6_AID
+   auth_app_id := c_DIAMETER_3GPP_S6b_AID,
+   vendor_app_id := c_DIAMETER_3GPP_S6b_AID
};
vc_S6b := DIAMETER_Emulation_CT.create(id);
map(vc_S6b:DIAMETER, system:DIAMETER_CODEC_PT);
@@ -228,8 +230,7 @@
vc_S6b.start(DIAMETER_Emulation.main(ops, pars, id));

f_diameter_wait_capability(SWx_UNIT);
-   // FIXME: osmo-epdg doesn't connect to S6b yet.
-   //f_diameter_wait_capability(S6b_UNIT);
+   f_diameter_wait_capability(S6b_UNIT);

/* Give some time for our emulation to get out of SUSPECT list of SUT 
(3 watchdog ping-pongs):
 * RFC6733 sec 5.1
@@ -362,6 +363,26 @@
}
 }

+/* Send AAR as PGW to AAA server, expect back AAA */
+private function f_S6b_AA_success() runs on EPDG_ConnHdlr {
+   var PDU_DIAMETER rx_dia;
+   var UINT32 hbh_id := f_rnd_octstring(4);
+   var UINT32 ete_id := f_rnd_octstring(4);
+
+   /* Unlike AAR, AAA contains no IMSI. Register ete_id in 
DIAMETER_Emulation,
+* so AIA is forwarded back to us in DIAMETER port instead of 
MTC_CT.DIAMETER_UNIT.
+*/
+   f_epdg_connhldr_S6b_expect_eteid(ete_id);
+
+   S6b.send(ts_DIA_S6b_AAR(g_pars.imsi, hbh_id := hbh_id, ete_id := 
ete_id));
+   alt {
+   [] S6b.receive(tr_DIA_S6b_AAA) -> value rx_dia {}
+   [] S6b.receive(PDU_DIAMETER:?) -> value rx_dia {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected Diameter S6b msg rx: ", rx_dia));
+   }
+   }
+}
+
 /* Diameter SWx SAR + SAA. */
 private altstep as_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
var PDU_GTPCv2 rx_msg;
@@ -375,11 +396,15 @@
g_pars.teic := f_gtp2_allocate_teid();
g_pars.teid := g_pars.teic;

+   /* Upon rx of CreateSession, emulate PGW asking the AAA server. 
*/
+   f_S6b_AA_success();
+
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);
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34861?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: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
Gerrit-Change-Number: 34861
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


[S] Change in osmo-ttcn3-hacks[master]: epdg: Emulate PGW tx AAR and rx AAA in S6b interface

2023-10-24 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/+/34861?usp=email )

Change subject: epdg: Emulate PGW tx AAR and rx AAA in S6b interface
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34861?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: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
Gerrit-Change-Number: 34861
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Attention: lynxis lazus 
Gerrit-Comment-Date: Tue, 24 Oct 2023 09:00:05 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in osmo-ttcn3-hacks[master]: epdg: Emulate PGW tx AAR and rx AAA in S6b interface

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


Change subject: epdg: Emulate PGW tx AAR and rx AAA in S6b interface
..

epdg: Emulate PGW tx AAR and rx AAA in S6b interface

Related: OS#6229
Change-Id: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
---
M epdg/EPDG_Tests.ttcn
1 file changed, 42 insertions(+), 7 deletions(-)



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

diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index 3a0c3a6..76fd45e 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -32,6 +32,8 @@
/* our emulated PGW (Diameter S6b) */
charstring mp_s6b_local_ip := "127.0.0.100";
integer mp_s6b_local_port := 3869;
+   charstring mp_s6b_remote_ip := "127.0.0.1";
+   integer mp_s6b_remote_port := 3869;

/* our emulated PGW (GTPv2C S2b) */
charstring mp_s2b_local_ip := "127.0.0.100";
@@ -212,14 +214,14 @@

/* S6b setup: */
pars := {
-   remote_ip := "",
-   remote_sctp_port := -1, /* server mode */
+   remote_ip := mp_s6b_remote_ip,
+   remote_sctp_port := mp_s6b_remote_port, /* client mode */
local_ip := mp_s6b_local_ip,
local_sctp_port := mp_s6b_local_port,
-   origin_host := "hss." & mp_diam_realm,
+   origin_host := "pgw." & mp_diam_realm,
origin_realm := mp_diam_realm,
-   auth_app_id := omit,
-   vendor_app_id := c_DIAMETER_3GPP_S6_AID
+   auth_app_id := c_DIAMETER_3GPP_S6b_AID,
+   vendor_app_id := c_DIAMETER_3GPP_S6b_AID
};
vc_S6b := DIAMETER_Emulation_CT.create(id);
map(vc_S6b:DIAMETER, system:DIAMETER_CODEC_PT);
@@ -228,8 +230,7 @@
vc_S6b.start(DIAMETER_Emulation.main(ops, pars, id));

f_diameter_wait_capability(SWx_UNIT);
-   // FIXME: osmo-epdg doesn't connect to S6b yet.
-   //f_diameter_wait_capability(S6b_UNIT);
+   f_diameter_wait_capability(S6b_UNIT);

/* Give some time for our emulation to get out of SUSPECT list of SUT 
(3 watchdog ping-pongs):
 * RFC6733 sec 5.1
@@ -362,6 +363,26 @@
}
 }

+/* Send AAR as PGW to AAA server, expect back AAA */
+private function f_S6b_AA_success() runs on EPDG_ConnHdlr {
+   var PDU_DIAMETER rx_dia;
+   var UINT32 hbh_id := f_rnd_octstring(4);
+   var UINT32 ete_id := f_rnd_octstring(4);
+
+   /* Unlike AAR, AAA contains no IMSI. Register ete_id in 
DIAMETER_Emulation,
+* so AIA is forwarded back to us in DIAMETER port instead of 
MTC_CT.DIAMETER_UNIT.
+*/
+   f_epdg_connhldr_S6b_expect_eteid(ete_id);
+
+   S6b.send(ts_DIA_S6b_AAR(g_pars.imsi, hbh_id := hbh_id, ete_id := 
ete_id));
+   alt {
+   [] S6b.receive(tr_DIA_S6b_AAA) -> value rx_dia {}
+   [] S6b.receive(PDU_DIAMETER:?) -> value rx_dia {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected Diameter S6b msg rx: ", rx_dia));
+   }
+   }
+}
+
 /* Diameter SWx SAR + SAA. */
 private altstep as_GTP2C_CreateSession_success() runs on EPDG_ConnHdlr {
var PDU_GTPCv2 rx_msg;
@@ -375,11 +396,15 @@
g_pars.teic := f_gtp2_allocate_teid();
g_pars.teid := g_pars.teic;

+   /* Upon rx of CreateSession, emulate PGW asking the AAA server. 
*/
+   f_S6b_AA_success();
+
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);
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34861?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: Ia50698a3f6f5ed8251486b84c09f84edfd6d3951
Gerrit-Change-Number: 34861
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange