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

Change subject: smf: TC_pfcp_heartbeat_timeout: Expect Delete Bearer Request
......................................................................

smf: TC_pfcp_heartbeat_timeout: Expect Delete Bearer Request

This is expected to work once [1] is fixed with [2].

[1] https://github.com/open5gs/open5gs/issues/4860
[2] https://github.com/open5gs/open5gs/pull/4863
Change-Id: I5d55801923533b36ca2a1a573f1205281809f76d
---
M library/GTPv2_Templates.ttcn
M smf/SMF_Session_CT_4G.ttcn
M smf/SMF_Tests.ttcn
3 files changed, 85 insertions(+), 14 deletions(-)

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




diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn
index 31ec999..6f8b0cb 100644
--- a/library/GTPv2_Templates.ttcn
+++ b/library/GTPv2_Templates.ttcn
@@ -1355,6 +1355,27 @@
                privateExtension := omit
        }});

+template (present) PDU_GTPCv2
+tr_GTP2C_DeleteBearerReq(template (present) OCT4 d_teid := ?,
+                        template (present) OCT3 seq := ?,
+                        template EPS_BearerID_List bearer_id_list := *,
+                        template GTP2C_Cause cause := *) :=
+tr_PDU_GTP2C(d_teid, seq, {
+       deleteBearerRequest := {
+               epsBearerIdentity := bearer_id_list,
+               bearerContextGrouped := *,
+               procedureTransactionID := *,
+               protocolConfigOptions := *,
+               csid := *,
+               cause := tr_GTP2C_Cause(cause),
+               indicationFlags := *,
+               loadControlInformationGrouped := *,
+               overloadControlInformationGrouped := *,
+               nBIFOMContainer := *,
+               extendedProtocolConfigOptions := *,
+               privateExtension := *
+       }});
+
 template (value) PDU_GTPCv2
 ts_GTP2C_DeleteBearerReq(template (value) OCT4 d_teid,
                         template (value) integer proc_trans_id,
@@ -1401,6 +1422,31 @@
                privateExtension := *
        }});

+template (value) PDU_GTPCv2
+ts_GTP2C_DeleteBearerResp(template (value) OCT4 d_teid,
+                         template (value) OCT3 seq,
+                         template (value) uint4_t bearer_id,
+                         template (value) GTP2C_Cause cause) :=
+ts_PDU_GTP2C(d_teid, seq, '64'O, {
+       deleteBearerResponse := {
+               cause := ts_GTP2C_Cause(cause, '0'B),
+               linkedBearerIdentity := ts_GTP2C_EpsBearerId(bearer_id),
+               bearerContextGrouped := omit,
+               recovery := omit,
+               csid := omit,
+               protocolConfigOptions := omit,
+               uE_TimeZone := omit,
+               uLI := omit,
+               uLITimestamp := omit,
+               trustedWLANAccessNetworkIdentifier := omit,
+               tWANIdentifierTimestamp := omit,
+               overloadControlInformationGrouped := omit,
+               iP_Addr := omit,
+               portNumber := omit,
+               nBIFOMContainer := omit,
+               privateExtension := omit
+       }});
+
 /* 8.18 */
 template (value) ServingNetwork
 ts_GTP2C_ServingNetwork(template (value) hexstring mcc,
diff --git a/smf/SMF_Session_CT_4G.ttcn b/smf/SMF_Session_CT_4G.ttcn
index ba230cb..9ea12f8 100644
--- a/smf/SMF_Session_CT_4G.ttcn
+++ b/smf/SMF_Session_CT_4G.ttcn
@@ -145,7 +145,8 @@
        }
        [] DIAMETER[DIA_Gy].receive(PDU_DIAMETER:?) -> value g_rx_gy {
                Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
-                                       log2str("Received unexpected DIAMETER 
Gy", g_rx_gy));
+                                       log2str("Received unexpected DIAMETER 
Gy ", g_rx_gy,
+                                               " vs exp ", 
f_tr_DIA_Gy_CCR_sess(req_type := req_type)));
        }
 }

@@ -448,4 +449,34 @@
        f_delete_session(fteid_c_ie, tx_cause, exp_cause, expect_pfcp, 
expect_diameter);
 }

+altstep as_s5s8_delete_bearer_req(boolean expect_diameter := true) runs on 
SMF_Session_CT {
+       var PDU_GTPCv2 rx_pdu;
+       [] GTP2.receive(tr_GTP2C_DeleteBearerReq(d_teid := g_pars.teic_local,
+                                                seq := ?,
+                                                bearer_id_list := ?,
+                                                cause := 
Reactivation_Required)) -> value rx_pdu {
+               var template (value) PDU_GTPCv2 tx_pdu;
+               tx_pdu := ts_GTP2C_DeleteBearerResp(g_pars.teic_remote,
+                                                   rx_pdu.sequenceNumber,
+                                                   
rx_pdu.gtpcv2_pdu.deleteBearerRequest.epsBearerIdentity[0].ePS_Bearer_ID_Value, 
Request_accepted);
+               GTP2.send(tx_pdu);
+
+               if (is_s2b_iface() and 
DIAMETER[DIA_S6b].checkstate("Connected") and expect_diameter) {
+                       as_DIA_S6b_STR();
+               }
+
+               if (DIAMETER[DIA_Gx].checkstate("Connected") and 
expect_diameter) {
+                       as_DIA_Gx_CCR(TERMINATION_REQUEST);
+               }
+               if (DIAMETER[DIA_Gy].checkstate("Connected") and 
expect_diameter) {
+                       as_DIA_Gy_CCR(TERMINATION_REQUEST);
+               }
+               setverdict(pass);
+       }
+       [] GTP2.receive(PDU_GTPCv2:?) -> value rx_pdu {
+               Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+                                       log2str("Received unexpected GTPV2C ", 
rx_pdu));
+       }
+}
+
 }
diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn
index a3e5c14..6d7f020 100644
--- a/smf/SMF_Tests.ttcn
+++ b/smf/SMF_Tests.ttcn
@@ -595,13 +595,14 @@
        f_s5s8_create_session();
        f_prometheus_expect(valueof(t_Metrics_Expect(1, 1)), wait_converge := 
true);

-       /* Wait for IUT to detect peer went down after Heartbeat timeout, ie. 
wait for a 2nd ASSOC SETUP REQ
-        * after Heartbeat timeout:
-        * TODO: Handle tear down indication towards SGW-C (s5/s8c), PCRF (Gx) 
and OCS (Gy) */
+       /* Wait for IUT to detect peer went down after Heartbeat timeout, ie. 
wait for sessions
+        * being released and another ASSOC SETUP REQ to attempt 
re-association: */
+       as_s5s8_delete_bearer_req();
+
        PFCP.receive(tr_PFCP_Assoc_Setup_Req()) -> value m;
        deactivate(d);
        activate(as_pfcp_handle_heartbeat_req(rts, do_repeat := true));
-       f_prometheus_expect(valueof(t_Metrics_Expect(0, 1)), wait_converge := 
true);
+       f_prometheus_expect(valueof(t_Metrics_Expect(0, 0)), wait_converge := 
true);
        PFCP.send(ts_PFCP_Assoc_Setup_Resp(m.sequence_number,
                                           
ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local)),
                                           
ts_PFCP_Cause(PFCP_Cause_REQUEST_ACCEPTED),
@@ -610,15 +611,8 @@
                                                                                
                vtime := '1'B)));

        /* After we answer the ASSOC SETUP RESP, IUT detects peer up: */
-       /* FIXME: https://github.com/open5gs/open5gs/issues/4860
-        * Instead of the commented line below, since open5gs-smfd is not 
tearing down the session,
-        * then delete the session to avoid leaving it dandling and 
open5gs-smfd trying to restore it (PFCP Sess Est Req)
-        * on other tests executed afterwards and making them fail due to 
unexpected msg received:
-        */
-       // f_prometheus_expect(valueof(t_Metrics_Expect(1, 0)), wait_converge 
:= true);
-       // setverdict(pass);
-       f_s5s8_delete_session(omit, Request_accepted);
-       setverdict(fail, "https://github.com/open5gs/open5gs/issues/4860";);
+       f_prometheus_expect(valueof(t_Metrics_Expect(1, 0)), wait_converge := 
true);
+       setverdict(pass);
 }
 testcase TC_pfcp_heartbeat_timeout() runs on SMF_Test_CT {
        var SMF_Session_CT vc_conn;

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43886?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5d55801923533b36ca2a1a573f1205281809f76d
Gerrit-Change-Number: 43886
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to