lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2025

  • 1 participants
  • 1378 discussions
[XS] Change in osmo-ttcn3-hacks[master]: library: fix coding style near f_rnd_int()
by fixeria 31 Mar '25

31 Mar '25
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39879?usp=email ) Change subject: library: fix coding style near f_rnd_int() ...................................................................... library: fix coding style near f_rnd_int() Change-Id: Ic9b97cd1626f35b3483f37fa250eea9dfd35ef51 --- M library/Osmocom_Types.ttcn 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn index 57912de..61b1e52 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -60,7 +60,7 @@ } /* return random integer 0 <= ret < max. According to ETSI ES 201 873 C.6.1, rnd() returns *less* than 1, so - * the returned int will always be ret < max, or ret <= (max-1). */ + * the returned int will always be ret < max, or ret <= (max-1). */ function f_rnd_int(integer max) return integer { return float2int(rnd()*int2float(max)); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39879?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: Ic9b97cd1626f35b3483f37fa250eea9dfd35ef51 Gerrit-Change-Number: 39879 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: library/s1ap: cosmetic: fix a typo
by fixeria 31 Mar '25

31 Mar '25
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39847?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: library/s1ap: cosmetic: fix a typo ...................................................................... library/s1ap: cosmetic: fix a typo Change-Id: I50aceea2653c426d1f60542dbb6721b8c75ed3fb Related: SYS#7288 --- M library/s1ap/S1AP_Templates.ttcn 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/s1ap/S1AP_Templates.ttcn b/library/s1ap/S1AP_Templates.ttcn index 32ebfae..2ba2b36 100644 --- a/library/s1ap/S1AP_Templates.ttcn +++ b/library/s1ap/S1AP_Templates.ttcn @@ -425,7 +425,7 @@ } -/* 9.1.7.3 UPNLINK NAS TRANSPORT */ +/* 9.1.7.3 UPLINK NAS TRANSPORT */ template (value) S1AP_PDU ts_S1AP_UlNasTransport(template (value) MME_UE_S1AP_ID mme_id, template (value) ENB_UE_S1AP_ID enb_id, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39847?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: I50aceea2653c426d1f60542dbb6721b8c75ed3fb Gerrit-Change-Number: 39847 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: s1gw: derive altsteps from f_ConnHdlr_rx_s1ap_from_{enb,mme}()
by fixeria 31 Mar '25

31 Mar '25
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39849?usp=email ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: s1gw: derive altsteps from f_ConnHdlr_rx_s1ap_from_{enb,mme}() ...................................................................... s1gw: derive altsteps from f_ConnHdlr_rx_s1ap_from_{enb,mme}() Change-Id: I8637a8abed0f0152abf2dce63ac28aa90f85bdc7 Related: SYS#7288 --- M s1gw/S1GW_ConnHdlr.ttcn 1 file changed, 22 insertions(+), 9 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index 3414315..d0dbc06 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -137,6 +137,12 @@ S1AP_CONN.send(pdu); } +altstep as_ConnHdlr_s1ap_from_enb(out S1AP_PDU pdu, + template (present) S1AP_PDU tr_pdu := ?) +runs on ConnHdlr { + [] S1AP_CONN.receive(tr_pdu) -> value pdu; +} + function f_ConnHdlr_rx_s1ap_from_enb(out S1AP_PDU pdu, template (present) S1AP_PDU tr_pdu := ?, float Tval := 3.0) @@ -145,11 +151,11 @@ T.start; alt { - [] S1AP_CONN.receive(tr_pdu) -> value pdu { + [] as_ConnHdlr_s1ap_from_enb(pdu, tr_pdu) { setverdict(pass); T.stop; } - [] S1AP_CONN.receive(S1AP_PDU:?) -> value pdu { + [] as_ConnHdlr_s1ap_from_enb(pdu) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Rx unexpected S1AP PDU from eNB: ", pdu)); } @@ -160,22 +166,29 @@ } } +altstep as_ConnHdlr_s1ap_from_mme(out S1AP_PDU pdu, + template (present) S1AP_PDU tr_pdu := ?) +runs on ConnHdlr { + var S1AP_RecvFrom recv; + + [] S1AP_ENB.receive(t_S1AP_RecvFrom(tr_pdu)) -> value recv { + pdu := recv.msg; + } +} + function f_ConnHdlr_rx_s1ap_from_mme(out S1AP_PDU pdu, template (present) S1AP_PDU tr_pdu := ?, float Tval := 3.0) runs on ConnHdlr { - var S1AP_RecvFrom recv; timer T := Tval; T.start; alt { - [] S1AP_ENB.receive(t_S1AP_RecvFrom(tr_pdu)) -> value recv { - pdu := recv.msg; + [] as_ConnHdlr_s1ap_from_mme(pdu, tr_pdu) { setverdict(pass); T.stop; } - [] S1AP_ENB.receive(t_S1AP_RecvFrom(?)) -> value recv { - pdu := recv.msg; + [] as_ConnHdlr_s1ap_from_mme(pdu) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Rx unexpected S1AP PDU from MME: ", pdu)); } @@ -204,7 +217,7 @@ T.start(Tval); alt { [] S1AP_CONN.receive(S1APSRV_Event:S1APSRV_EVENT_CONN_UP) { repeat; } - [] S1AP_CONN.receive(tr_S1AP_SetupReq) { + [] as_ConnHdlr_s1ap_from_enb(pdu, tr_S1AP_SetupReq) { var template (value) PLMNidentity plmn_id := '00f110'O; var template (value) MME_Group_ID mme_group_id := '0011'O; var template (value) MME_Code mme_code := '55'O; @@ -217,7 +230,7 @@ f_ConnHdlr_rx_s1ap_from_mme(pdu, tr_S1AP_SetupResp({ gummei }, 1)); T.stop; } - [] S1AP_CONN.receive(S1AP_PDU:?) -> value pdu { + [] as_ConnHdlr_s1ap_from_enb(pdu) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Rx unexpected S1AP PDU: ", pdu)); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39849?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: I8637a8abed0f0152abf2dce63ac28aa90f85bdc7 Gerrit-Change-Number: 39849 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: library/s1ap: split PDU specific API to S1AP_Functions.ttcn
by fixeria 31 Mar '25

31 Mar '25
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39848?usp=email ) Change subject: library/s1ap: split PDU specific API to S1AP_Functions.ttcn ...................................................................... library/s1ap: split PDU specific API to S1AP_Functions.ttcn Change-Id: Id3ba089140093490abd0307addeb5d7287dc5894 Related: SYS#7288 --- M library/S1AP_Emulation.ttcn A library/S1AP_Functions.ttcn M mme/MME_Tests.ttcn M mme/gen_links.sh 4 files changed, 170 insertions(+), 152 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/S1AP_Emulation.ttcn b/library/S1AP_Emulation.ttcn index f81441f..6ee1e6a 100644 --- a/library/S1AP_Emulation.ttcn +++ b/library/S1AP_Emulation.ttcn @@ -40,6 +40,7 @@ import from S1AP_PDU_Descriptions all; import from S1AP_IEs all; import from S1AP_Templates all; +import from S1AP_Functions all; import from SCTP_Templates all; import from NAS_EPS_Types all; @@ -710,155 +711,4 @@ return omit; } - -function f_S1AP_get_ENB_UE_S1AP_ID(S1AP_PDU s1ap) return template (omit) ENB_UE_S1AP_ID -{ - if (ischosen(s1ap.initiatingMessage)) { - var InitiatingMessage im := s1ap.initiatingMessage; - select (s1ap) { - case (tr_S1AP_InitialUE) { - return im.value_.InitialUEMessage.protocolIEs[0].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_DlNasTransport) { - return im.value_.DownlinkNASTransport.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_UlNasTransport) { - return im.value_.UplinkNASTransport.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_IntialCtxSetupReq) { - return im.value_.initialContextSetupRequest.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseReq) { - return im.value_.UEContextReleaseRequest.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseCmd) { - if (ispresent(im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair)) { - return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; - } else { - return omit; - } - } - case (tr_S1AP_ConnEstInd) { - return im.value_.ConnectionEstablishmentIndication.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - /* TODO */ - } - } else if (ischosen(s1ap.successfulOutcome)) { - var SuccessfulOutcome so := s1ap.successfulOutcome; - select (s1ap) { - case (tr_S1AP_InitialCtxSetupResp) { - return so.value_.initialContextSetupResponse.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseCompl) { - return so.value_.UEContextReleaseComplete.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - /* TODO */ - } - } else if (ischosen(s1ap.unsuccessfulOutcome)) { - var UnsuccessfulOutcome uo := s1ap.unsuccessfulOutcome; - select (s1ap) { - case (tr_S1AP_InitialCtxSetupFail) { - return uo.value_.initialContextSetupFailure.protocolIEs[1].value_.ENB_UE_S1AP_ID; - } - /* TODO */ - } - } - return omit; -} - -function f_S1AP_get_MME_UE_S1AP_ID(S1AP_PDU s1ap) return template (omit) MME_UE_S1AP_ID -{ - if (ischosen(s1ap.initiatingMessage)) { - var InitiatingMessage im := s1ap.initiatingMessage; - select (s1ap) { - case (tr_S1AP_DlNasTransport) { - return im.value_.DownlinkNASTransport.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - case (tr_S1AP_UlNasTransport) { - return im.value_.UplinkNASTransport.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - case (tr_S1AP_IntialCtxSetupReq) { - return im.value_.initialContextSetupRequest.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseReq) { - return im.value_.UEContextReleaseRequest.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseCmd) { - if (ispresent(im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair)) { - return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - } else { - return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.mME_UE_S1AP_ID; - } - } - case (tr_S1AP_ConnEstInd) { - return im.value_.ConnectionEstablishmentIndication.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - /* TODO */ - } - } else if (ischosen(s1ap.successfulOutcome)) { - var SuccessfulOutcome so := s1ap.successfulOutcome; - select (s1ap) { - case (tr_S1AP_InitialCtxSetupResp) { - return so.value_.initialContextSetupResponse.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - case (tr_S1AP_UeContextReleaseCompl) { - return so.value_.UEContextReleaseComplete.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - /* TODO */ - } - } else if (ischosen(s1ap.unsuccessfulOutcome)) { - var UnsuccessfulOutcome uo := s1ap.unsuccessfulOutcome; - select (s1ap) { - case (tr_S1AP_InitialCtxSetupFail) { - return uo.value_.initialContextSetupFailure.protocolIEs[0].value_.MME_UE_S1AP_ID; - } - /* TODO */ - } - } - return omit; -} - -function f_S1AP_get_NAS_PDU(S1AP_PDU s1ap) return template (omit) NAS_PDU -{ - var integer i, j; - - if (ischosen(s1ap.initiatingMessage)) { - var InitiatingMessage im := s1ap.initiatingMessage; - select (s1ap) { - case (tr_S1AP_DlNasTransport) { - var DownlinkNASTransport msg := im.value_.DownlinkNASTransport; - for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { - if (msg.protocolIEs[i].id == id_NAS_PDU) { - return msg.protocolIEs[i].value_.NAS_PDU; - } - } - } - case (tr_S1AP_UlNasTransport) { - var UplinkNASTransport msg := im.value_.UplinkNASTransport; - for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { - if (msg.protocolIEs[i].id == id_NAS_PDU) { - return msg.protocolIEs[i].value_.NAS_PDU; - } - } - } - case (tr_S1AP_IntialCtxSetupReq) { - var InitialContextSetupRequest msg := im.value_.initialContextSetupRequest; - for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { - if (msg.protocolIEs[i].id == id_E_RABToBeSetupListCtxtSUReq) { - var E_RABToBeSetupListCtxtSUReq rab_req := msg.protocolIEs[i].value_.E_RABToBeSetupListCtxtSUReq; - for (j := 0; j < lengthof(rab_req); j := j+1) { - var E_RABToBeSetupItemCtxtSUReq it := rab_req[j].value_.E_RABToBeSetupItemCtxtSUReq; - return it.nAS_PDU; - } - } - } - return omit; - } - } - } - return omit; -} - - - } diff --git a/library/S1AP_Functions.ttcn b/library/S1AP_Functions.ttcn new file mode 100644 index 0000000..63bdaa4 --- /dev/null +++ b/library/S1AP_Functions.ttcn @@ -0,0 +1,167 @@ +module S1AP_Functions { + +/* (C) 2019 by Harald Welte <laforge(a)gnumonks.org> + * All rights reserved. + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +import from S1AP_IEs all; +import from S1AP_Types all; +import from S1AP_Constants all; +import from S1AP_PDU_Contents all; +import from S1AP_PDU_Descriptions all; +import from S1AP_Templates all; + +function f_S1AP_get_ENB_UE_S1AP_ID(S1AP_PDU s1ap) return template (omit) ENB_UE_S1AP_ID +{ + if (ischosen(s1ap.initiatingMessage)) { + var InitiatingMessage im := s1ap.initiatingMessage; + select (s1ap) { + case (tr_S1AP_InitialUE) { + return im.value_.InitialUEMessage.protocolIEs[0].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_DlNasTransport) { + return im.value_.DownlinkNASTransport.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_UlNasTransport) { + return im.value_.UplinkNASTransport.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_IntialCtxSetupReq) { + return im.value_.initialContextSetupRequest.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseReq) { + return im.value_.UEContextReleaseRequest.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseCmd) { + if (ispresent(im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair)) { + return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; + } else { + return omit; + } + } + case (tr_S1AP_ConnEstInd) { + return im.value_.ConnectionEstablishmentIndication.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + /* TODO */ + } + } else if (ischosen(s1ap.successfulOutcome)) { + var SuccessfulOutcome so := s1ap.successfulOutcome; + select (s1ap) { + case (tr_S1AP_InitialCtxSetupResp) { + return so.value_.initialContextSetupResponse.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseCompl) { + return so.value_.UEContextReleaseComplete.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + /* TODO */ + } + } else if (ischosen(s1ap.unsuccessfulOutcome)) { + var UnsuccessfulOutcome uo := s1ap.unsuccessfulOutcome; + select (s1ap) { + case (tr_S1AP_InitialCtxSetupFail) { + return uo.value_.initialContextSetupFailure.protocolIEs[1].value_.ENB_UE_S1AP_ID; + } + /* TODO */ + } + } + return omit; +} + +function f_S1AP_get_MME_UE_S1AP_ID(S1AP_PDU s1ap) return template (omit) MME_UE_S1AP_ID +{ + if (ischosen(s1ap.initiatingMessage)) { + var InitiatingMessage im := s1ap.initiatingMessage; + select (s1ap) { + case (tr_S1AP_DlNasTransport) { + return im.value_.DownlinkNASTransport.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + case (tr_S1AP_UlNasTransport) { + return im.value_.UplinkNASTransport.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + case (tr_S1AP_IntialCtxSetupReq) { + return im.value_.initialContextSetupRequest.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseReq) { + return im.value_.UEContextReleaseRequest.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseCmd) { + if (ispresent(im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair)) { + return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.uE_S1AP_ID_pair.mME_UE_S1AP_ID; + } else { + return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_S1AP_IDs.mME_UE_S1AP_ID; + } + } + case (tr_S1AP_ConnEstInd) { + return im.value_.ConnectionEstablishmentIndication.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + /* TODO */ + } + } else if (ischosen(s1ap.successfulOutcome)) { + var SuccessfulOutcome so := s1ap.successfulOutcome; + select (s1ap) { + case (tr_S1AP_InitialCtxSetupResp) { + return so.value_.initialContextSetupResponse.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + case (tr_S1AP_UeContextReleaseCompl) { + return so.value_.UEContextReleaseComplete.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + /* TODO */ + } + } else if (ischosen(s1ap.unsuccessfulOutcome)) { + var UnsuccessfulOutcome uo := s1ap.unsuccessfulOutcome; + select (s1ap) { + case (tr_S1AP_InitialCtxSetupFail) { + return uo.value_.initialContextSetupFailure.protocolIEs[0].value_.MME_UE_S1AP_ID; + } + /* TODO */ + } + } + return omit; +} + +function f_S1AP_get_NAS_PDU(S1AP_PDU s1ap) return template (omit) NAS_PDU +{ + var integer i, j; + + if (ischosen(s1ap.initiatingMessage)) { + var InitiatingMessage im := s1ap.initiatingMessage; + select (s1ap) { + case (tr_S1AP_DlNasTransport) { + var DownlinkNASTransport msg := im.value_.DownlinkNASTransport; + for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { + if (msg.protocolIEs[i].id == id_NAS_PDU) { + return msg.protocolIEs[i].value_.NAS_PDU; + } + } + } + case (tr_S1AP_UlNasTransport) { + var UplinkNASTransport msg := im.value_.UplinkNASTransport; + for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { + if (msg.protocolIEs[i].id == id_NAS_PDU) { + return msg.protocolIEs[i].value_.NAS_PDU; + } + } + } + case (tr_S1AP_IntialCtxSetupReq) { + var InitialContextSetupRequest msg := im.value_.initialContextSetupRequest; + for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { + if (msg.protocolIEs[i].id == id_E_RABToBeSetupListCtxtSUReq) { + var E_RABToBeSetupListCtxtSUReq rab_req := msg.protocolIEs[i].value_.E_RABToBeSetupListCtxtSUReq; + for (j := 0; j < lengthof(rab_req); j := j+1) { + var E_RABToBeSetupItemCtxtSUReq it := rab_req[j].value_.E_RABToBeSetupItemCtxtSUReq; + return it.nAS_PDU; + } + } + } + return omit; + } + } + } + return omit; +} + +} diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn index 2192775..302d996 100644 --- a/mme/MME_Tests.ttcn +++ b/mme/MME_Tests.ttcn @@ -16,6 +16,7 @@ import from Misc_Helpers all; import from S1AP_Types all; import from S1AP_Templates all; +import from S1AP_Functions all; import from S1AP_Emulation all; import from S1AP_PDU_Descriptions all; import from S1AP_IEs all; diff --git a/mme/gen_links.sh b/mme/gen_links.sh index d2b17ce..61f6f73 100755 --- a/mme/gen_links.sh +++ b/mme/gen_links.sh @@ -73,7 +73,7 @@ FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn " FILES+="SGsAP_Templates.ttcn SGsAP_CodecPort.ttcn SGsAP_CodecPort_CtrlFunct.ttcn SGsAP_CodecPort_CtrlFunctDef.cc SGsAP_Emulation.ttcn DNS_Helpers.ttcn " FILES+="L3_Templates.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn " -FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn S1AP_Emulation.ttcn " +FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn S1AP_Functions.ttcn S1AP_Emulation.ttcn " FILES+="NAS_Templates.ttcn GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn " FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn " FILES+="DIAMETER_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn " -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39848?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: Id3ba089140093490abd0307addeb5d7287dc5894 Gerrit-Change-Number: 39848 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-CC: osmith <osmith(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: s1gw: add UE multiplex component
by fixeria 31 Mar '25

31 Mar '25
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39850?usp=email ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: s1gw: add UE multiplex component ...................................................................... s1gw: add UE multiplex component The UEMux is built upon the ConnHdlr component, allowing to simulate concurrent activity of multiple virtual UEs. This new component will be used in follow-up patches. Change-Id: I60e6f5d2b9882c27cecd06a2450bda4909c0532a Related: SYS#7288 --- A s1gw/S1GW_UEMux.ttcn M s1gw/gen_links.sh 2 files changed, 328 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/s1gw/S1GW_UEMux.ttcn b/s1gw/S1GW_UEMux.ttcn new file mode 100644 index 0000000..0768dea --- /dev/null +++ b/s1gw/S1GW_UEMux.ttcn @@ -0,0 +1,327 @@ +module S1GW_UEMux { + +/* UE Multiplexer, runs on top of ConnHdlr component, dispatches S1AP PDUs + * to/from the UE components. In order to receive S1AP PDUs, a UE component + * needs to subscribe for MME_UE_S1AP_ID and/or ENB_UE_S1AP_ID. + * + * (C) 2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> + * + * All rights reserved. + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +import from General_Types all; +import from Osmocom_Types all; + +import from S1AP_IEs all; +import from S1AP_Types all; +import from S1AP_PDU_Contents all; +import from S1AP_PDU_Descriptions all; +import from S1AP_Functions all; +import from S1GW_ConnHdlr all; + +private type enumerated S1AP_PDU_DIR { + S1AP_PDU_DIR_FROM_MME, + S1AP_PDU_DIR_FROM_ENB +}; + +private type record S1AP_dPDU { + S1AP_PDU_DIR dir, + S1AP_PDU pdu +}; + +private altstep as_s1ap_dpdu(out S1AP_PDU pdu, + template (present) S1AP_PDU_DIR dir := ?, + template (present) S1AP_PDU tr_pdu := ?) +runs on UEMuxUE { + var S1AP_dPDU dpdu; + + [] UEMUX_CONN.receive(S1AP_dPDU:{dir, tr_pdu}) -> value dpdu { + pdu := dpdu.pdu; + } +} + +type port UEMUX_CONN_PT message { + inout S1AP_dPDU; +} with { extension "internal" }; + +type component UEMuxUE { + port UEMUX_CONN_PT UEMUX_CONN; + port UEMUX_PROC_PT UEMUX_PROC; +}; + +type component UEMux_CT extends ConnHdlr, UEMuxUE { + /* registered UE components */ + var UE_ConnList g_uemux_list := { }; +}; + + +/* represents a single UE connection */ +private type record UE_ConnData { + UEMuxUE vc_conn, + MME_UE_S1AP_ID mme_ue_id optional, + ENB_UE_S1AP_ID enb_ue_id optional +}; +private type record of UE_ConnData UE_ConnList; + +/*********************************************************************************** + * UE connection management API + **********************************************************************************/ + +/* find a UE connection [index] by an MME_UE_S1AP_ID */ +private function f_UEMux_find_ue_by_mme_ue_id(MME_UE_S1AP_ID mme_ue_id) +runs on UEMux_CT return integer { + for (var integer i := 0; i < lengthof(g_uemux_list); i := i + 1) { + if (g_uemux_list[i].mme_ue_id == mme_ue_id) { + return i; + } + } + + return -1; +} + +/* find a UE connection [index] by an ENB_UE_S1AP_ID */ +private function f_UEMux_find_ue_by_enb_ue_id(ENB_UE_S1AP_ID enb_ue_id) +runs on UEMux_CT return integer { + for (var integer i := 0; i < lengthof(g_uemux_list); i := i + 1) { + if (g_uemux_list[i].enb_ue_id == enb_ue_id) { + return i; + } + } + + return -1; +} + +/* find a UE connection [index] for the given S1AP PDU */ +private function f_UEMux_find_ue_for_pdu(in S1AP_PDU pdu) +runs on UEMux_CT return integer { + var template (omit) MME_UE_S1AP_ID mme_ue_id; + var template (omit) ENB_UE_S1AP_ID enb_ue_id; + var integer idx; + + mme_ue_id := f_S1AP_get_MME_UE_S1AP_ID(pdu); + if (isvalue(mme_ue_id)) { + idx := f_UEMux_find_ue_by_mme_ue_id(valueof(mme_ue_id)); + if (idx != -1) { + return idx; + } + } + + enb_ue_id := f_S1AP_get_ENB_UE_S1AP_ID(pdu); + if (isvalue(enb_ue_id)) { + idx := f_UEMux_find_ue_by_enb_ue_id(valueof(enb_ue_id)); + if (idx != -1) { + return idx; + } + } + + return -1; +} + +/* find a UE connection [index] by component reference */ +private function f_UEMux_find_ue_by_vc_conn(UEMuxUE vc_conn) +runs on UEMux_CT return integer { + for (var integer i := 0; i < lengthof(g_uemux_list); i := i + 1) { + if (g_uemux_list[i].vc_conn == vc_conn) { + return i; + } + } + + return -1; +} + +private function f_UEMux_route_pdu(S1AP_dPDU dpdu) +runs on UEMux_CT { + var integer idx; + + idx := f_UEMux_find_ue_for_pdu(dpdu.pdu); + if (idx >= 0) { + UEMUX_CONN.send(dpdu) to g_uemux_list[idx].vc_conn; + } else { + log("S1AP PDU cannot be routed: ", dpdu.pdu); + } +} + +/* add a new UE connection, return its index */ +private function f_UEMux_ue_add(UEMuxUE vc_conn) +runs on UEMux_CT return integer { + var integer idx; + + idx := f_UEMux_find_ue_by_vc_conn(vc_conn); + if (idx != -1) { /* already registered */ + return idx; + } + + idx := lengthof(g_uemux_list); + g_uemux_list[idx] := { vc_conn, omit, omit }; + log("UE ", vc_conn, " is registered (idx=", idx, ")"); + + return idx; +} + +/* subscribe a UE component for S1AP PDUs with the given MME-UE-ID */ +private function f_UEMux_subscribe_for_mme_ue_id(UEMuxUE vc_conn, + MME_UE_S1AP_ID mme_ue_id) +runs on UEMux_CT { + var integer idx; + + if (f_UEMux_find_ue_by_mme_ue_id(mme_ue_id) != -1) { + setverdict(fail, "MME-UE-ID ", mme_ue_id," is already used"); + mtc.stop; + } + + idx := f_UEMux_ue_add(vc_conn); + g_uemux_list[idx].mme_ue_id := mme_ue_id; +} + +/* subscribe a UE component for S1AP PDUs with the given ENB-UE-ID */ +private function f_UEMux_subscribe_for_enb_ue_id(UEMuxUE vc_conn, + ENB_UE_S1AP_ID enb_ue_id) +runs on UEMux_CT { + var integer idx; + + if (f_UEMux_find_ue_by_enb_ue_id(enb_ue_id) != -1) { + setverdict(fail, "ENB-UE-ID ", enb_ue_id," is already used"); + mtc.stop; + } + + idx := f_UEMux_ue_add(vc_conn); + g_uemux_list[idx].enb_ue_id := enb_ue_id; +} + +/* unsubscribe a UE component */ +private function f_UEMux_unsubscribe(UEMuxUE vc_conn) +runs on UEMux_CT { + var UE_ConnList ue_list := { }; + + for (var integer i := 0; i < lengthof(g_uemux_list); i := i + 1) { + if (g_uemux_list[i].vc_conn != vc_conn) { + ue_list := ue_list & { g_uemux_list[i] }; + } + } + + if (lengthof(ue_list) == lengthof(g_uemux_list)) { + setverdict(fail, "UE ", vc_conn, " is not known"); + mtc.stop; + } + + g_uemux_list := ue_list; + log("UE ", vc_conn, " is unregistered"); +} + +signature UEMux_subscribe_for_mme_ue_id(in MME_UE_S1AP_ID mme_ue_id); +signature UEMux_subscribe_for_enb_ue_id(in ENB_UE_S1AP_ID enb_ue_id); +signature UEMux_unsubscribe(); + +type port UEMUX_PROC_PT procedure { + inout UEMux_subscribe_for_mme_ue_id; + inout UEMux_subscribe_for_enb_ue_id; + inout UEMux_unsubscribe; +} with { extension "internal" }; + +/*********************************************************************************** + * public API + **********************************************************************************/ + +function f_UEMuxUE_subscribe_for_mme_ue_id(MME_UE_S1AP_ID mme_ue_id) +runs on UEMuxUE { + UEMUX_PROC.call(UEMux_subscribe_for_mme_ue_id:{mme_ue_id}) { + [] UEMUX_PROC.getreply(UEMux_subscribe_for_mme_ue_id:{mme_ue_id}); + } +} + +function f_UEMuxUE_subscribe_for_enb_ue_id(ENB_UE_S1AP_ID enb_ue_id) +runs on UEMuxUE { + UEMUX_PROC.call(UEMux_subscribe_for_enb_ue_id:{enb_ue_id}) { + [] UEMUX_PROC.getreply(UEMux_subscribe_for_enb_ue_id:{enb_ue_id}); + } +} + +function f_UEMuxUE_unsubscribe() +runs on UEMuxUE { + UEMUX_PROC.call(UEMux_unsubscribe:{}) { + [] UEMUX_PROC.getreply(UEMux_unsubscribe:{}); + } +} + +function f_UEMuxUE_tx_s1ap_from_mme(template (value) S1AP_PDU pdu) +runs on UEMuxUE { + var S1AP_dPDU dpdu := { S1AP_PDU_DIR_FROM_MME, valueof(pdu) }; + UEMUX_CONN.send(dpdu); +} + +function f_UEMuxUE_tx_s1ap_from_enb(template (value) S1AP_PDU pdu) +runs on UEMuxUE { + var S1AP_dPDU dpdu := { S1AP_PDU_DIR_FROM_ENB, valueof(pdu) }; + UEMUX_CONN.send(dpdu); +} + +altstep as_UEMuxUE_s1ap_from_mme(out S1AP_PDU pdu, + template (present) S1AP_PDU tr_pdu := ?) +runs on UEMuxUE { + [] as_s1ap_dpdu(pdu, S1AP_PDU_DIR_FROM_MME, tr_pdu); +} + +altstep as_UEMuxUE_s1ap_from_enb(out S1AP_PDU pdu, + template (present) S1AP_PDU tr_pdu := ?) +runs on UEMuxUE { + [] as_s1ap_dpdu(pdu, S1AP_PDU_DIR_FROM_ENB, tr_pdu); +} + +type function void_fn2(charstring id) runs on UEMux_CT; + +function f_UEMux_init(void_fn2 fn, charstring id, ConnHdlrPars pars) +runs on UEMux_CT { + g_pars := pars; + fn.apply(id); +} + +function main() runs on UEMux_CT { + while (true) { + var MME_UE_S1AP_ID mme_ue_id; + var ENB_UE_S1AP_ID enb_ue_id; + var UEMuxUE vc_conn; + var S1AP_PDU pdu; + + alt { + /* MME originated S1AP PDU to S1GW */ + [] as_s1ap_dpdu(pdu, S1AP_PDU_DIR_FROM_MME) { + f_ConnHdlr_tx_s1ap_from_mme(pdu); + } + /* eNB originated S1AP PDU to S1GW */ + [] as_s1ap_dpdu(pdu, S1AP_PDU_DIR_FROM_ENB) { + f_ConnHdlr_tx_s1ap_from_enb(pdu); + } + + /* MME originated S1AP PDU from S1GW */ + [] as_ConnHdlr_s1ap_from_mme(pdu) { + f_UEMux_route_pdu({S1AP_PDU_DIR_FROM_MME, pdu}); + } + /* eNB originated S1AP PDU from S1GW */ + [] as_ConnHdlr_s1ap_from_enb(pdu) { + f_UEMux_route_pdu({S1AP_PDU_DIR_FROM_ENB, pdu}); + } + + /* UE subsciption procedures */ + [] UEMUX_PROC.getcall(UEMux_subscribe_for_mme_ue_id:{?}) -> param(mme_ue_id) sender vc_conn { + f_UEMux_subscribe_for_mme_ue_id(vc_conn, mme_ue_id); + UEMUX_PROC.reply(UEMux_subscribe_for_mme_ue_id:{mme_ue_id}) to vc_conn; + } + [] UEMUX_PROC.getcall(UEMux_subscribe_for_enb_ue_id:{?}) -> param(enb_ue_id) sender vc_conn { + f_UEMux_subscribe_for_enb_ue_id(vc_conn, enb_ue_id); + UEMUX_PROC.reply(UEMux_subscribe_for_enb_ue_id:{enb_ue_id}) to vc_conn; + } + [] UEMUX_PROC.getcall(UEMux_unsubscribe:{}) -> sender vc_conn { + f_UEMux_unsubscribe(vc_conn); + UEMUX_PROC.reply(UEMux_unsubscribe:{}) to vc_conn; + } + } + } +} + +} diff --git a/s1gw/gen_links.sh b/s1gw/gen_links.sh index 63c826e..875e028 100755 --- a/s1gw/gen_links.sh +++ b/s1gw/gen_links.sh @@ -30,7 +30,7 @@ DIR=../library FILES="Misc_Helpers.ttcn Mutex.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc " FILES+="PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn PFCP_Templates.ttcn " -FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn " +FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn S1AP_Functions.ttcn " FILES+="SCTP_Templates.ttcn " FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcnpp " gen_links $DIR $FILES -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39850?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: I60e6f5d2b9882c27cecd06a2450bda4909c0532a Gerrit-Change-Number: 39850 Gerrit-PatchSet: 5 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: library: add f_rnd_sleep()
by fixeria 31 Mar '25

31 Mar '25
Attention is currently required from: laforge, pespin. fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39880?usp=email ) Change subject: library: add f_rnd_sleep() ...................................................................... Patch Set 1: Code-Review+2 (1 comment) File library/Osmocom_Types.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39880/comment/6dbab9b6_7b68… : PS1, Line 117: f_sleep(rnd() * max_seconds); > not sure we need to document return value ranges of TTCN3 language built-in functions. Yeah, one can always check the TTCN-3 language spec. or read the comment near `f_rnd_int()`. -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39880?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I97474d0c39052d8a9dd294238530e0b6c31a19e0 Gerrit-Change-Number: 39880 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Mar 2025 15:19:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in pysim[master]: saip-tool: add ProfileElement class for application PE
by dexter 31 Mar '25

31 Mar '25
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/39883?usp=email ) Change subject: saip-tool: add ProfileElement class for application PE ...................................................................... saip-tool: add ProfileElement class for application PE The application profile element has no ProfileElement class yet, so let's create a ProfileElementApplication class and move the existing extract-apps code into a method of ProfileElementApplication. Change-Id: Iaa43036d388fbf1714c53cab1fc21092c4667a21 --- M contrib/saip-tool.py M pySim/esim/saip/__init__.py 2 files changed, 26 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/83/39883/1 diff --git a/contrib/saip-tool.py b/contrib/saip-tool.py index 64aba93..4747ab9 100755 --- a/contrib/saip-tool.py +++ b/contrib/saip-tool.py @@ -19,14 +19,12 @@ import sys import argparse import logging -import zipfile from pathlib import Path as PlPath from typing import List from osmocom.utils import h2b, b2h, swap_nibbles from pySim.esim.saip import * from pySim.esim.saip.validation import CheckBasicStructure -from pySim import javacard from pySim.pprint import HexBytesPrettyPrinter pp = HexBytesPrettyPrinter(indent=4,width=500) @@ -231,16 +229,9 @@ apps = pes.pe_by_type.get('application', []) for app_pe in apps: package_aid = b2h(app_pe.decoded['loadBlock']['loadPackageAID']) - fname = os.path.join(opts.output_dir, '%s-%s.%s' % (pes.iccid, package_aid, opts.format)) - load_block_obj = app_pe.decoded['loadBlock']['loadBlockObject'] print("Writing Load Package AID: %s to file %s" % (package_aid, fname)) - if opts.format == 'ijc': - with open(fname, 'wb') as f: - f.write(load_block_obj) - else: - with io.BytesIO(load_block_obj) as f, zipfile.ZipFile(fname, 'w') as z: - javacard.ijc_to_cap(f, z, package_aid) + app_pe.to_file(fname) def do_tree(pes:ProfileElementSequence, opts): pes.mf.print_tree() diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 64ea7cb..d6b41ba 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -22,6 +22,8 @@ from typing import Tuple, List, Optional, Dict, Union from collections import OrderedDict import asn1tools +import zipfile +from pySim import javacard from osmocom.utils import b2h, h2b, Hexstr from osmocom.tlv import BER_TLV_IE, bertlv_parse_tag, bertlv_parse_len from osmocom.construct import build_construct, parse_construct, GreedyInteger @@ -506,7 +508,7 @@ # TODO: cdmaParameter 'securityDomain': ProfileElementSD, 'rfm': ProfileElementRFM, - # TODO: application + 'application': ProfileElementApplication, # TODO: nonStandard 'end': ProfileElementEnd, 'mf': ProfileElementMF, @@ -1087,6 +1089,28 @@ 'uiccToolkitApplicationSpecificParametersField': h2b('01000001000000020112036C756500'), } +class ProfileElementApplication(ProfileElement): + """Class representing an application ProfileElement.""" + type = 'application' + + def __init__(self, decoded: Optional[dict] = None, **kwargs): + super().__init__(decoded, **kwargs) + + def to_file(self, filename:str): + """Write loadBlockObject contents of application ProfileElement to a .cap or .ijc file.""" + + load_package_aid = b2h(self.decoded['loadBlock']['loadPackageAID']) + load_block_object = self.decoded['loadBlock']['loadBlockObject'] + + if filename.lower().endswith('.cap'): + with io.BytesIO(load_block_object) as f, zipfile.ZipFile(filename, 'w') as z: + javacard.ijc_to_cap(f, z, load_package_aid) + elif filename.lower().endswith('.ijc'): + with open(filename, 'wb') as f: + f.write(load_block_object) + else: + raise ValueError('Invalid file type, file must either .cap or .ijc') + class ProfileElementRFM(ProfileElement): type = 'rfm' -- To view, visit https://gerrit.osmocom.org/c/pysim/+/39883?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Iaa43036d388fbf1714c53cab1fc21092c4667a21 Gerrit-Change-Number: 39883 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[S] Change in pysim[master]: saip-tool: add commandline option to edit mandatory services list
by dexter 31 Mar '25

31 Mar '25
Attention is currently required from: fixeria, laforge. Hello Jenkins Builder, fixeria, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/39863?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by laforge, Code-Review+2 by fixeria, Verified+1 by Jenkins Builder The change is no longer submittable: Code-Review and Verified are unsatisfied now. Change subject: saip-tool: add commandline option to edit mandatory services list ...................................................................... saip-tool: add commandline option to edit mandatory services list Change-Id: I120b98d4b0942c26674bc1365c5711101ec95235 --- M contrib/saip-tool.py 1 file changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/63/39863/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/39863?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I120b98d4b0942c26674bc1365c5711101ec95235 Gerrit-Change-Number: 39863 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: saip-tool: add features to add, remove and inspect application PEs
by dexter 31 Mar '25

31 Mar '25
Attention is currently required from: fixeria, laforge. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/39860?usp=email ) Change subject: saip-tool: add features to add, remove and inspect application PEs ...................................................................... Patch Set 2: (9 comments) File contrib/saip-tool.py: https://gerrit.osmocom.org/c/pysim/+/39860/comment/102e8d2a_e2431590?usp=em… : PS1, Line 22: import zipfile > Acknowledged Yes and no. I have split the patchset up now to make it easier to read. https://gerrit.osmocom.org/c/pysim/+/39860/comment/826493e5_ecb72e93?usp=em… : PS1, Line 250: if dictionary is None: > The type hint `:dict` suggests that it cannot be `None`, change to `Optional[dict]` then? Done https://gerrit.osmocom.org/c/pysim/+/39860/comment/f8c71f2c_c22570f8?usp=em… : PS1, Line 255: elif value is None: : > Looks like a no-op branch that can be removed without any consequences? Not really, but there is a bug. If value is none, then we must not try to hexdump value. I forgot a return statement. Maybe it is more clear now. https://gerrit.osmocom.org/c/pysim/+/39860/comment/40ee142e_85ccb2c8?usp=em… : PS1, Line 267: app_index = 0 > shouldn't we simply make this part of the 'info' command? We already display some basic information […] When I was using the list-apps sub-command I was happy to see only the application related output and not any additional information. So I think that it is a good idea to have a --apps parameter that only prints the application related output while hiding the basic info. This is also good when we add more PE specific info commands in the future. https://gerrit.osmocom.org/c/pysim/+/39860/comment/e35c7a25_1b717df5?usp=em… : PS1, Line 268: for app_pe in apps: > You can drop `app_index` above and use `enumerate()` instead: […] Thanks, I didn't know that before. https://gerrit.osmocom.org/c/pysim/+/39860/comment/3c7dc52e_830efa3b?usp=em… : PS1, Line 272: > I think this line should be removed, it's likely just a debug aid? Done https://gerrit.osmocom.org/c/pysim/+/39860/comment/8c97c1dd_cc6a4211?usp=em… : PS1, Line 283: for inst in app_pe.decoded.get('instanceList', []): > Likewise, use `enumerate()` here. Done https://gerrit.osmocom.org/c/pysim/+/39860/comment/e02a5c24_650ff460?usp=em… : PS1, Line 349: 0] > There can be multiple security domains. It's probably unusual, but legal AFAIR. […] Done https://gerrit.osmocom.org/c/pysim/+/39860/comment/f7ac1421_26b1e98c?usp=em… : PS1, Line 375: > yes, I think a method would be better style. Done -- To view, visit https://gerrit.osmocom.org/c/pysim/+/39860?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I41db96f2f0ccc29c1725a92215ce6b17d87b76ce Gerrit-Change-Number: 39860 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 31 Mar 2025 15:00:46 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in pysim[master]: saip-tool: add features to add, remove and inspect application PEs
by dexter 31 Mar '25

31 Mar '25
Attention is currently required from: fixeria, laforge. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/pysim/+/39860?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: saip-tool: add features to add, remove and inspect application PEs ...................................................................... saip-tool: add features to add, remove and inspect application PEs The PE-Application object is used to provision JAVA-card applications into an eUICC during profile installation. Let's extend the SAIP-tool so that we are able to add, remove and inspect applications. Change-Id: I41db96f2f0ccc29c1725a92215ce6b17d87b76ce --- M contrib/saip-tool.py A contrib/saip-tool_example_add-app.sh A contrib/saip-tool_example_extract-apps.sh A contrib/saip-tool_example_remove-app-inst.sh A contrib/saip-tool_example_remove-app.sh M docs/index.rst A docs/saip-tool.rst M pySim/esim/saip/__init__.py 8 files changed, 499 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/60/39860/2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/39860?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I41db96f2f0ccc29c1725a92215ce6b17d87b76ce Gerrit-Change-Number: 39860 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • ...
  • 138
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.