[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-04 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?usp=email )

Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..

epdg: Introduce test TC_mt_ipv4_echo_req

Change-Id: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
---
M epdg/EPDG_Tests.ttcn
A epdg/ICMP_Types.ttcn
M epdg/gen_links.sh
M epdg/regen_makefile.sh
4 files changed, 68 insertions(+), 0 deletions(-)

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




diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index 0d1b10f..fb9f98b 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -6,6 +6,9 @@
 import from Osmocom_Types all;
 import from L3_Common all;
 import from DNS_Helpers all;
+import from IP_Types all;
+import from ICMP_Types all;
+import from ICMP_Templates all;

 import from IPA_Emulation all;
 import from PCO_Types all;
@@ -692,6 +695,31 @@
GTP2.send(ts_GTPU_PING(peer, seq := seq_nr));
GTP2.receive(tr_GTPU_PONG(peer));
 }
+private altstep as_GTPU_rx_icmp4(template (present) PDU_ICMP expected := ?) 
runs on EPDG_ConnHdlr {
+   var Gtp1uUnitdata rx_msg;
+   var template (value) Gtp1uPeer peer := 
ts_GtpPeerU(f_inet_addr(g_pars.bearer.gtpu_addr_remote));
+
+   [] GTP2.receive(tr_GTPU_GPDU(peer, g_pars.bearer.teid_local)) -> value 
rx_msg {
+   /*TODO: verify gtpu txseq:
+   if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == 
false) {
+   setverdict(fail);
+   stop;
+   }
+   */
+   var octetstring gpdu := 
rx_msg.gtpu.gtpu_IEs.g_PDU_IEs.data;
+   var IPv4_packet ip4 := f_IPv4_dec(gpdu);
+   if (ip4.header.ver != 4) {
+   repeat;
+   }
+   var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload);
+   if (not match(icmp4, expected)) {
+   repeat;
+   }
+   }
+   [] GTP2.receive(Gtp1uUnitdata:?) -> value rx_msg {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected GTP msg rx: ", rx_msg));
+   }
+}

 /* GSUP AuthInfo Req + Resp, triggers SWx MAR + MAA. */
 private function f_GSUP_AI_success() runs on EPDG_ConnHdlr {
@@ -942,6 +970,24 @@
setverdict(pass);
 }

+private function f_TC_mt_ipv4_echo_req(charstring id) runs on EPDG_ConnHdlr {
+   f_initial_attach();
+   /* Dispatch Echo Resp to this component: */
+   f_gtp2_register_teid(''O);
+   var octetstring echo_req := 
f_gen_icmpv4_echo(f_inet_addr(mp_upf_gtpu_local_ip), f_inet_addr(g_pars.ue_ip));
+   f_GTP1U_send(echo_req);
+   as_GTPU_rx_icmp4((tr_ICMPv4_ERP, tr_ICMPv4_DU));
+   f_GSUP_PurgeMS_success();
+}
+testcase TC_mt_ipv4_echo_req() runs on MTC_CT {
+   var EPDG_ConnHdlrPars pars := f_init_pars();
+   var EPDG_ConnHdlr vc_conn;
+   f_init();
+   vc_conn := f_start_handler(refers(f_TC_mt_ipv4_echo_req), pars);
+   vc_conn.done;
+   setverdict(pass);
+}
+
 control {
execute ( TC_authinfo_normal() );
execute ( TC_ho_lte_to_wifi() );
@@ -950,6 +996,7 @@
execute ( TC_concurrent_ues2() );
execute ( TC_concurrent_ues100() );
execute ( TC_upf_echo_req() );
+   execute ( TC_mt_ipv4_echo_req() );
 }

 }
diff --git a/epdg/ICMP_Types.ttcn b/epdg/ICMP_Types.ttcn
new file mode 12
index 000..361cad1
--- /dev/null
+++ b/epdg/ICMP_Types.ttcn
@@ -0,0 +1 @@
+../deps/titan.ProtocolModules.ICMP/src/ICMP_Types.ttcn
\ No newline at end of file
diff --git a/epdg/gen_links.sh b/epdg/gen_links.sh
index ed4209c..7a4e60d 100755
--- a/epdg/gen_links.sh
+++ b/epdg/gen_links.sh
@@ -17,6 +17,14 @@
 FILES="IPL4asp_Functions.ttcn  IPL4asp_PT.cc  IPL4asp_PT.hh 
IPL4asp_PortType.ttcn  IPL4asp_Types.ttcn  IPL4asp_discovery.cc 
IPL4asp_protocol_L234.hh"
 gen_links $DIR $FILES

+DIR=$BASEDIR/titan.ProtocolModules.IP/src
+FILES="IP_EncDec.cc IP_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.ICMP/src
+FILES="ICMP_EncDec.cc ICMP_Types.ttcn"
+gen_links $DIR $FILES
+
 DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
 FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
 gen_links $DIR $FILES
@@ -54,6 +62,7 @@
 FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn 
GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
 FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
 FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc 
GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn "
+FILES+="ICMP_Templates.ttcn "
 gen_links $DIR $FILES

 ignore_pp_results
diff --git a/epdg/regen_makefile.sh 

[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-04 Thread pespin
Attention is currently required from: osmith.

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

Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?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: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
Gerrit-Change-Number: 36137
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Attention: osmith 
Gerrit-Comment-Date: Mon, 04 Mar 2024 21:47:53 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-04 Thread pespin
Attention is currently required from: osmith.

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

Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..


Patch Set 1:

(1 comment)

File epdg/EPDG_Tests.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137/comment/f1bb22c0_d2d2de6c
PS1, Line 703:  /*TODO: verify gtpu txseq:
> do you want to keep this?
Yes, it's left for later. I'm actually still getting this test to work in 
docker setup right now, almost there hopefully. :)



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?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: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
Gerrit-Change-Number: 36137
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: osmith 
Gerrit-Comment-Date: Mon, 04 Mar 2024 10:29:01 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-04 Thread osmith
Attention is currently required from: pespin.

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

Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..


Patch Set 1: Code-Review+1

(1 comment)

File epdg/EPDG_Tests.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137/comment/7c25d403_239420ec
PS1, Line 703:  /*TODO: verify gtpu txseq:
do you want to keep this?



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?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: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
Gerrit-Change-Number: 36137
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 04 Mar 2024 10:27:50 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-02 Thread laforge
Attention is currently required from: pespin.

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

Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?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: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
Gerrit-Change-Number: 36137
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Sat, 02 Mar 2024 09:13:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-ttcn3-hacks[master]: epdg: Introduce test TC_mt_ipv4_echo_req

2024-03-01 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36137?usp=email )


Change subject: epdg: Introduce test TC_mt_ipv4_echo_req
..

epdg: Introduce test TC_mt_ipv4_echo_req

Change-Id: Ie5dc1bd995262f9253cc067c97a82c801b0080e1
---
M epdg/EPDG_Tests.ttcn
A epdg/ICMP_Types.ttcn
M epdg/gen_links.sh
M epdg/regen_makefile.sh
4 files changed, 68 insertions(+), 0 deletions(-)



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

diff --git a/epdg/EPDG_Tests.ttcn b/epdg/EPDG_Tests.ttcn
index 0d1b10f..fb9f98b 100644
--- a/epdg/EPDG_Tests.ttcn
+++ b/epdg/EPDG_Tests.ttcn
@@ -6,6 +6,9 @@
 import from Osmocom_Types all;
 import from L3_Common all;
 import from DNS_Helpers all;
+import from IP_Types all;
+import from ICMP_Types all;
+import from ICMP_Templates all;

 import from IPA_Emulation all;
 import from PCO_Types all;
@@ -692,6 +695,31 @@
GTP2.send(ts_GTPU_PING(peer, seq := seq_nr));
GTP2.receive(tr_GTPU_PONG(peer));
 }
+private altstep as_GTPU_rx_icmp4(template (present) PDU_ICMP expected := ?) 
runs on EPDG_ConnHdlr {
+   var Gtp1uUnitdata rx_msg;
+   var template (value) Gtp1uPeer peer := 
ts_GtpPeerU(f_inet_addr(g_pars.bearer.gtpu_addr_remote));
+
+   [] GTP2.receive(tr_GTPU_GPDU(peer, g_pars.bearer.teid_local)) -> value 
rx_msg {
+   /*TODO: verify gtpu txseq:
+   if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == 
false) {
+   setverdict(fail);
+   stop;
+   }
+   */
+   var octetstring gpdu := 
rx_msg.gtpu.gtpu_IEs.g_PDU_IEs.data;
+   var IPv4_packet ip4 := f_IPv4_dec(gpdu);
+   if (ip4.header.ver != 4) {
+   repeat;
+   }
+   var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload);
+   if (not match(icmp4, expected)) {
+   repeat;
+   }
+   }
+   [] GTP2.receive(Gtp1uUnitdata:?) -> value rx_msg {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, 
log2str("Unexpected GTP msg rx: ", rx_msg));
+   }
+}

 /* GSUP AuthInfo Req + Resp, triggers SWx MAR + MAA. */
 private function f_GSUP_AI_success() runs on EPDG_ConnHdlr {
@@ -942,6 +970,24 @@
setverdict(pass);
 }

+private function f_TC_mt_ipv4_echo_req(charstring id) runs on EPDG_ConnHdlr {
+   f_initial_attach();
+   /* Dispatch Echo Resp to this component: */
+   f_gtp2_register_teid(''O);
+   var octetstring echo_req := 
f_gen_icmpv4_echo(f_inet_addr(mp_upf_gtpu_local_ip), f_inet_addr(g_pars.ue_ip));
+   f_GTP1U_send(echo_req);
+   as_GTPU_rx_icmp4((tr_ICMPv4_ERP, tr_ICMPv4_DU));
+   f_GSUP_PurgeMS_success();
+}
+testcase TC_mt_ipv4_echo_req() runs on MTC_CT {
+   var EPDG_ConnHdlrPars pars := f_init_pars();
+   var EPDG_ConnHdlr vc_conn;
+   f_init();
+   vc_conn := f_start_handler(refers(f_TC_mt_ipv4_echo_req), pars);
+   vc_conn.done;
+   setverdict(pass);
+}
+
 control {
execute ( TC_authinfo_normal() );
execute ( TC_ho_lte_to_wifi() );
@@ -950,6 +996,7 @@
execute ( TC_concurrent_ues2() );
execute ( TC_concurrent_ues100() );
execute ( TC_upf_echo_req() );
+   execute ( TC_mt_ipv4_echo_req() );
 }

 }
diff --git a/epdg/ICMP_Types.ttcn b/epdg/ICMP_Types.ttcn
new file mode 12
index 000..361cad1
--- /dev/null
+++ b/epdg/ICMP_Types.ttcn
@@ -0,0 +1 @@
+../deps/titan.ProtocolModules.ICMP/src/ICMP_Types.ttcn
\ No newline at end of file
diff --git a/epdg/gen_links.sh b/epdg/gen_links.sh
index ed4209c..7a4e60d 100755
--- a/epdg/gen_links.sh
+++ b/epdg/gen_links.sh
@@ -17,6 +17,14 @@
 FILES="IPL4asp_Functions.ttcn  IPL4asp_PT.cc  IPL4asp_PT.hh 
IPL4asp_PortType.ttcn  IPL4asp_Types.ttcn  IPL4asp_discovery.cc 
IPL4asp_protocol_L234.hh"
 gen_links $DIR $FILES

+DIR=$BASEDIR/titan.ProtocolModules.IP/src
+FILES="IP_EncDec.cc IP_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.ICMP/src
+FILES="ICMP_EncDec.cc ICMP_Types.ttcn"
+gen_links $DIR $FILES
+
 DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
 FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
 gen_links $DIR $FILES
@@ -54,6 +62,7 @@
 FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn 
GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
 FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
 FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc 
GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn "
+FILES+="ICMP_Templates.ttcn "
 gen_links $DIR $FILES

 ignore_pp_results
diff --git a/epdg/regen_makefile.sh b/epdg/regen_makefile.sh
index eb5935e..9aa83b4 100755
--- a/epdg/regen_makefile.sh
+++