pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35358?usp=email )
Change subject: library/GTPv2_Emulation: Patch SeqNr only on outbound initial messages ......................................................................
library/GTPv2_Emulation: Patch SeqNr only on outbound initial messages
Change-Id: I0f13074ccee2bf2d00d2dc2af491b9effc142f22 --- M library/GTPv2_Emulation.ttcn 1 file changed, 86 insertions(+), 8 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved daniel: Looks good to me, but someone else must approve
diff --git a/library/GTPv2_Emulation.ttcn b/library/GTPv2_Emulation.ttcn index 736dd03..0b2cb4f 100644 --- a/library/GTPv2_Emulation.ttcn +++ b/library/GTPv2_Emulation.ttcn @@ -340,6 +340,73 @@ return omit; }
+private function f_gtp2c_is_initial_msg(PDU_GTPCv2 msg) return boolean +{ + if (ischosen(msg.gtpcv2_pdu.echoRequest) or + ischosen(msg.gtpcv2_pdu.versionNotSupported) or + ischosen(msg.gtpcv2_pdu.createSessionRequest) or + ischosen(msg.gtpcv2_pdu.createBearerRequest) or + ischosen(msg.gtpcv2_pdu.bearerResourceCommand) or + ischosen(msg.gtpcv2_pdu.bearerResourceFailureIndication) or + ischosen(msg.gtpcv2_pdu.modifyBearerRequest) or + ischosen(msg.gtpcv2_pdu.deleteSessionRequest) or + ischosen(msg.gtpcv2_pdu.deleteBearerRequest) or + ischosen(msg.gtpcv2_pdu.downlinkDataNotification) or + ischosen(msg.gtpcv2_pdu.downlinkDataNotificationAcknowledgement) or + ischosen(msg.gtpcv2_pdu.downlinkDataNotificationFailureIndication) or + ischosen(msg.gtpcv2_pdu.deleteIndirectDataForwardingTunnelRequest) or + ischosen(msg.gtpcv2_pdu.modifyBearerCommand) or + ischosen(msg.gtpcv2_pdu.modifyBearerFailureIndication) or + ischosen(msg.gtpcv2_pdu.updateBearerRequest) or + ischosen(msg.gtpcv2_pdu.deleteBearerCommand) or + ischosen(msg.gtpcv2_pdu.createIndirectDataForwardingTunnelRequest) or + ischosen(msg.gtpcv2_pdu.releaseAccessBearersRequest) or + ischosen(msg.gtpcv2_pdu.stopPagingIndication) or + ischosen(msg.gtpcv2_pdu.modifyAccessBearersRequest) or + ischosen(msg.gtpcv2_pdu.remoteUEReportNotification) or + ischosen(msg.gtpcv2_pdu.remoteUEReportAcknowledge) or + ischosen(msg.gtpcv2_pdu.forwardRelocationRequest) or + ischosen(msg.gtpcv2_pdu.forwardRelocationCompleteNotification) or + ischosen(msg.gtpcv2_pdu.forwardRelocationCompleteAcknowledge) or + ischosen(msg.gtpcv2_pdu.contextRequest) or + ischosen(msg.gtpcv2_pdu.contextAcknowledge) or + ischosen(msg.gtpcv2_pdu.identificationRequest) or + ischosen(msg.gtpcv2_pdu.forwardAccessContextNotification) or + ischosen(msg.gtpcv2_pdu.forwardAccessContextAcknowledge) or + ischosen(msg.gtpcv2_pdu.detachNotification) or + ischosen(msg.gtpcv2_pdu.detachAcknowledge) or + ischosen(msg.gtpcv2_pdu.changeNotificationRequest) or + ischosen(msg.gtpcv2_pdu.relocationCancelRequest) or + ischosen(msg.gtpcv2_pdu.configurationTransferTunnel) or + ischosen(msg.gtpcv2_pdu.rAN_InformationRelay) or + ischosen(msg.gtpcv2_pdu.suspendNotification) or + ischosen(msg.gtpcv2_pdu.suspendAcknowledge) or + ischosen(msg.gtpcv2_pdu.resumeNotification) or + ischosen(msg.gtpcv2_pdu.resumeAcknowledge) or + ischosen(msg.gtpcv2_pdu.cSPagingIndication) or + ischosen(msg.gtpcv2_pdu.createForwardingTunnelRequest) or + ischosen(msg.gtpcv2_pdu.deletePDN_ConnectionSetRequest) or + ischosen(msg.gtpcv2_pdu.traceSessionActivation) or + ischosen(msg.gtpcv2_pdu.traceSessionDeactivation) or + ischosen(msg.gtpcv2_pdu.updatePDN_ConnectionSetRequest) or + ischosen(msg.gtpcv2_pdu.pGW_RestartNotification) or + ischosen(msg.gtpcv2_pdu.pGW_RestartNotificationAcknowledge) or + ischosen(msg.gtpcv2_pdu.pGW_DownlinkTriggeringNotification) or + ischosen(msg.gtpcv2_pdu.pGW_DownlinkTriggeringAcknowledge) or + ischosen(msg.gtpcv2_pdu.alertMMENotification) or + ischosen(msg.gtpcv2_pdu.alertMMEAcknowledge) or + ischosen(msg.gtpcv2_pdu.uEActivityNotification) or + ischosen(msg.gtpcv2_pdu.uEActivityAcknowledge) or + ischosen(msg.gtpcv2_pdu.mBMSSessionStartRequest) or + ischosen(msg.gtpcv2_pdu.mBMSSessionUpdateRequest) or + ischosen(msg.gtpcv2_pdu.mBMSSessionStopRequest) or + ischosen(msg.gtpcv2_pdu.iSR_StatusIndication) or + ischosen(msg.gtpcv2_pdu.uE_RegistrationQueryRequest)) { + return true; + } + return false; +} + private template (value) SctpTuple ts_SCTP(template (omit) integer ppid := omit) := { sinfo_stream := omit, sinfo_ppid := ppid, @@ -507,10 +574,11 @@ }
[] TEID0.receive(PDU_GTPCv2:?) -> value g2c sender vc_conn { - /* patch in the next sequence number */ - /* FIXME: do this only for outbound requests */ - g2c.sequenceNumber := int2oct(g_c_seq_nr, 3); - g_c_seq_nr := g_c_seq_nr + 1; + /* patch in the next sequence number on outbound Initial message */ + if (f_gtp2c_is_initial_msg(g2c)) { + g2c.sequenceNumber := int2oct(g_c_seq_nr, 3); + g_c_seq_nr := g_c_seq_nr + 1; + } /* build Gtp2cUnitdata */ g2c_ud := { peer := g_peer, gtpc := g2c }; GTP2C.send(g2c_ud); @@ -520,10 +588,11 @@ }
[] CLIENT.receive(PDU_GTPCv2:?) -> value g2c sender vc_conn { - /* patch in the next sequence number */ - /* FIXME: do this only for outbound requests */ - g2c.sequenceNumber := int2oct(g_c_seq_nr, 3); - g_c_seq_nr := g_c_seq_nr + 1; + /* patch in the next sequence number on outbound Initial message */ + if (f_gtp2c_is_initial_msg(g2c)) { + g2c.sequenceNumber := int2oct(g_c_seq_nr, 3); + g_c_seq_nr := g_c_seq_nr + 1; + } /* build Gtp2cUnitdata */ g2c_ud := { peer := g_peer, gtpc := g2c }; GTP2C.send(g2c_ud);