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

September 2026

  • 1 participants
  • 1894 discussions
[S] Change in osmo-ci[master]: scripts/repo-install-test: fix debian11 (EOL)
by osmith 07 Sep '26

07 Sep '26
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/43531?usp=email ) Change subject: scripts/repo-install-test: fix debian11 (EOL) ...................................................................... scripts/repo-install-test: fix debian11 (EOL) Fix that the repos-install-test jobs for debian11 fail at downloading packages from security.debian.org: Err:1 http://security.debian.org/debian-security bullseye-security/main amd64 gpgv amd64 2.2.27-2+deb11u3 404 Not Found [IP: 146.75.122.132 80] Change-Id: I3ef0930eecf95298dd7e809e204a0083745f1823 --- M scripts/repo-install-test.sh 1 file changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/31/43531/1 diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh index 8289ecf..a378502 100755 --- a/scripts/repo-install-test.sh +++ b/scripts/repo-install-test.sh @@ -154,6 +154,18 @@ -e s/security.debian.org/archive.debian.org/g \ /etc/apt/sources.list ;; + debian11) + # As of writing, the debian 11 security repository is not + # available on archive.debian.org while at the same time the + # non-archived version is broken. Run the test without the + # security repository. This is fine here, debian 11 is EOL + # anyway. + qemu_ssh sed \ + -i \ + -e s/deb.debian.org/archive.debian.org/g \ + -e '/.*security.debian.org.*/d' \ + /etc/apt/sources.list + ;; esac } -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43531?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I3ef0930eecf95298dd7e809e204a0083745f1823 Gerrit-Change-Number: 43531 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: library/euicc: add ESipa JSON encoder/decoder module
by dexter 07 Sep '26

07 Sep '26
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43144?usp=email ) Change subject: library/euicc: add ESipa JSON encoder/decoder module ...................................................................... library/euicc: add ESipa JSON encoder/decoder module In order to test an eIM (or IPAd), which uses the JSON ESipa bindings instead of the ASN.1 ESipa bindings a set of encoder/decoder functions is needed to generate/parse the JSON messages exchanged on the ESipa interface Change-Id: I8b6a87f39ca23658d980d19cf257b8994ea1cecb Related: SYS#8100 --- M eim/eIM_Tests.cfg M eim/eIM_Tests.ttcn M eim/gen_links.sh M library/euicc/RSPDefinitions_Types.ttcn M library/euicc/SGP32Definitions_Types.ttcn A library/euicc/esipa_Types_JSON.ttcn 6 files changed, 700 insertions(+), 43 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve dexter: Looks good to me, approved diff --git a/eim/eIM_Tests.cfg b/eim/eIM_Tests.cfg index f100c41..00e7187 100644 --- a/eim/eIM_Tests.cfg +++ b/eim/eIM_Tests.cfg @@ -14,6 +14,7 @@ [MODULE_PARAMETERS] eIM_Tests.mp_restop_path := "./restop.py" +eIM_Tests.mp_esipa_json := false; [MAIN_CONTROLLER] diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn index 0a1db80..035a028 100644 --- a/eim/eIM_Tests.ttcn +++ b/eim/eIM_Tests.ttcn @@ -37,6 +37,7 @@ import from HTTP_Adapter all; import from es9p_Types_JSON all; +import from esipa_Types_JSON all; import from REST_Types_JSON all; /* the PIPEasp port allows us to interact with restop.py via stdin/stdout */ @@ -81,6 +82,7 @@ charstring mp_esipa_ip := "127.0.0.1"; integer mp_esipa_port := 8000; boolean mp_esipa_disable_ssl := false; + boolean mp_esipa_json := false; /* REST API tool */ charstring mp_restop_path; @@ -344,52 +346,67 @@ /* ************* ESipa/HTTP-client ************* */ /* ********************************************* */ -private function f_enc_http_req(in RemoteProfileProvisioningResponse es9p_res, out HTTPMessage http_res) { - var charstring json_body; - var HTTPResponse resp_body; - - enc_RemoteProfileProvisioningResponse_to_JSON(es9p_res, json_body); - resp_body := { - client_id := omit, - version_major := 1, - version_minor := 1, - statuscode := 200, - statustext := "OK", - /* See also SGP.32, section 6.1.1 */ - header := { - { - header_name := "X-Admin-Protocol", - header_value := "gsma/rsp/v1.0.0" - }, - { - header_name := "Content-Type", - header_value := "application/x-gsma-rsp-asn1" - }, - { - header_name := "Content-Length", - header_value := int2str(lengthof(json_body)) - } - }, - body := json_body - }; - - http_res := { response := resp_body }; -} with { extension "prototype(fast)" } - -template (value) HeaderLines ts_esipa_HTTP_Header := { - { header_name := "User-Agent", header_value := "TTCN3 eIM testsuite" }, +template (value) HeaderLines ts_esipa_HTTP_Header_asn1 := { + { header_name := "User-Agent", header_value := "TTCN3 eIM testsuite (ASN.1)" }, { header_name := "X-Admin-Protocol", header_value := "gsma/rsp/v2.1.0" }, { header_name := "Content-Type", header_value := "application/x-gsma-rsp-asn1" } }; +template (value) HeaderLines ts_esipa_HTTP_Header_json := { + { header_name := "User-Agent", header_value := "TTCN3 eIM testsuite (JSON)" }, + { header_name := "X-Admin-Protocol", header_value := "gsma/rsp/v2.1.0" }, + { header_name := "Content-Type", header_value := "application/json;charset=UTF-8" } +}; + /* Send ESipa HTTP request */ private function f_esipa_send(EsipaMessageFromIpaToEim esipa_req) runs on eIM_ConnHdlr { + if (mp_esipa_json == true) { + f_esipa_send_json(esipa_req); + } else { + f_esipa_send_asn(esipa_req); + } +} +private function f_esipa_send_asn(EsipaMessageFromIpaToEim esipa_req) runs on eIM_ConnHdlr { var octetstring esipa_req_enc; esipa_req_enc := enc_EsipaMessageFromIpaToEim(esipa_req); + f_http_tx_request(url := "/gsma/rsp2/asn1", method := "POST", - binary_body:= esipa_req_enc, - custom_hdr := valueof(ts_esipa_HTTP_Header), + binary_body := esipa_req_enc, + custom_hdr := valueof(ts_esipa_HTTP_Header_asn1), + client_id := g_http_client_id); +} +private function f_esipa_send_json(EsipaMessageFromIpaToEim esipa_req) runs on eIM_ConnHdlr { + var charstring esipa_req_enc; + var charstring url; + enc_EsipaMessageFromIpaToEim_to_JSON(esipa_req, esipa_req_enc); + + /* Determine the HTTP URL, see also GSMA SGP.32, section 6.4.1 and + * SGP32Definitions.asn:EsipaMessageFromIpaToEim */ + if (ispresent(esipa_req.initiateAuthenticationRequestEsipa)) { + url := "/gsma/rsp2/esipa/initiateAuthentication"; + } else if (ispresent(esipa_req.authenticateClientRequestEsipa)) { + url := "/gsma/rsp2/esipa/authenticateClient"; + } else if (ispresent(esipa_req.getBoundProfilePackageRequestEsipa)) { + url := "/gsma/rsp2/esipa/getBoundProfilePackage"; + } else if (ispresent(esipa_req.cancelSessionRequestEsipa)) { + url := "/gsma/rsp2/esipa/cancelSession"; + } else if (ispresent(esipa_req.handleNotificationEsipa)) { + url := "/gsma/rsp2/esipa/handleNotification"; + } else if (ispresent(esipa_req.transferEimPackageResponse)) { + url := "/gsma/rsp2/esipa/transferEimPackage"; + } else if (ispresent(esipa_req.getEimPackageRequest)) { + url := "/gsma/rsp2/esipa/getEimPackage"; + } else if (ispresent(esipa_req.provideEimPackageResult)) { + url := "/gsma/rsp2/esipa/provideEimPackageResult"; + } else { + setverdict(fail, "unknown ASN.1 choice member, check specification and upgrade lookup table."); + } + + f_http_tx_request(url := url, + method := "POST", + body := esipa_req_enc, + custom_hdr := valueof(ts_esipa_HTTP_Header_json), client_id := g_http_client_id); } @@ -397,6 +414,7 @@ private function f_esipa_receive(template EsipaMessageFromEimToIpa expected_esipa_res := omit) runs on eIM_ConnHdlr return template EsipaMessageFromEimToIpa { var template EsipaMessageFromEimToIpa esipa_res; + var DecodedEimToIpaMessage_Wrap esipa_res_wrap; /* JSON */ var HTTPMessage response_http; response_http := f_http_rx_response(exp := ?, client_id := g_http_client_id, @@ -413,16 +431,35 @@ } if (ispresent(response_http.response_binary)) { - esipa_res := dec_EsipaMessageFromEimToIpa(response_http.response_binary.body); - if (not istemplatekind(expected_esipa_res, "omit")) { - if (not match(valueof(esipa_res), expected_esipa_res)) { - setverdict(fail, "unexpected response from eIM on ESipa"); + if (mp_esipa_json == false) { + esipa_res := dec_EsipaMessageFromEimToIpa(response_http.response_binary.body); + if (not istemplatekind(expected_esipa_res, "omit")) { + if (not match(valueof(esipa_res), expected_esipa_res)) { + setverdict(fail, "unexpected response from eIM on ESipa"); + } } + return esipa_res; + } else { + setverdict(fail, "unexpected response from eIM on ESipa (response is JSON instead of ASN.1?)"); + return omit; } - return esipa_res; + } else if (ispresent(response_http.response)) { + if (mp_esipa_json == true) { + dec_EsipaMessageFromEimToIpa_from_JSON(response_http.response.body, esipa_res_wrap); + esipa_res := esipa_res_wrap.asn1_pdu; + if (not istemplatekind(expected_esipa_res, "omit")) { + if (not match(valueof(esipa_res), expected_esipa_res)) { + setverdict(fail, "unexpected response from eIM on ESipa"); + } + } + return esipa_res; + } else { + setverdict(fail, "unexpected response from eIM on ESipa (response is ASN.1 instead of JSON?)"); + return omit; + } } else { setverdict(fail, - "unexpected ESipa response, the HTTP body did either contain no or a non binary response"); + "unexpected ESipa response, the HTTP body did not contain any response"); return omit; } } diff --git a/eim/gen_links.sh b/eim/gen_links.sh index a8f91dd..91a67ea 100755 --- a/eim/gen_links.sh +++ b/eim/gen_links.sh @@ -34,7 +34,7 @@ FILES="PEDefinitions.asn PKIX1Explicit88.asn PKIX1Implicit88.asn RSPDefinitions.asn SGP32Definitions.asn " FILES+="PKIX1Explicit88_Templates.ttcn PKIX1Explicit88_Types.ttcn PKIX1Implicit88_Templates.ttcn " FILES+="PKIX1Implicit88_Types.ttcn RSPDefinitions_Templates.ttcn RSPDefinitions_Types.ttcn " -FILES+="SGP32Definitions_Templates.ttcn SGP32Definitions_Types.ttcn " +FILES+="SGP32Definitions_Templates.ttcn SGP32Definitions_Types.ttcn esipa_Types_JSON.ttcn " FILES+="es9p_Types_JSON.ttcn esx_header_Types_JSON.ttcn" gen_links $DIR $FILES diff --git a/library/euicc/RSPDefinitions_Types.ttcn b/library/euicc/RSPDefinitions_Types.ttcn index b355e95..e4aca98 100644 --- a/library/euicc/RSPDefinitions_Types.ttcn +++ b/library/euicc/RSPDefinitions_Types.ttcn @@ -128,4 +128,9 @@ external function enc_NotificationMetadata(in NotificationMetadata msg) return octetstring with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; +external function dec_CtxParams1(in octetstring stream) return CtxParams1 +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_CtxParams1(in CtxParams1 msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + } diff --git a/library/euicc/SGP32Definitions_Types.ttcn b/library/euicc/SGP32Definitions_Types.ttcn index fb6b51b..021c60f 100644 --- a/library/euicc/SGP32Definitions_Types.ttcn +++ b/library/euicc/SGP32Definitions_Types.ttcn @@ -98,6 +98,36 @@ external function enc_GetConnectivityParametersResponse(in GetConnectivityParametersResponse msg) return octetstring with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; +external function dec_SGP32_CancelSessionResponse(in octetstring stream) return SGP32_CancelSessionResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_CancelSessionResponse(in SGP32_CancelSessionResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_PrepareDownloadResponse(in octetstring stream) return SGP32_PrepareDownloadResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_PrepareDownloadResponse(in SGP32_PrepareDownloadResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_AuthenticateServerResponse(in octetstring stream) return SGP32_AuthenticateServerResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_AuthenticateServerResponse(in SGP32_AuthenticateServerResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_PendingNotification(in octetstring stream) return SGP32_PendingNotification +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_PendingNotification(in SGP32_PendingNotification msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_ProvideEimPackageResult(in octetstring stream) return ProvideEimPackageResult +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_ProvideEimPackageResult(in ProvideEimPackageResult msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_StoreMetadataRequest(in octetstring stream) return SGP32_StoreMetadataRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_StoreMetadataRequest(in SGP32_StoreMetadataRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + external function dec_EuiccPackageRequest(in octetstring stream) return EuiccPackageRequest with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; external function enc_EuiccPackageRequest(in EuiccPackageRequest msg) return octetstring @@ -108,4 +138,24 @@ external function enc_SGP32_RetrieveNotificationsListResponse(in SGP32_RetrieveNotificationsListResponse msg) return octetstring with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; +external function dec_IpaEuiccDataRequest(in octetstring stream) return IpaEuiccDataRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_IpaEuiccDataRequest(in IpaEuiccDataRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_ProfileDownloadTriggerRequest(in octetstring stream) return ProfileDownloadTriggerRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_ProfileDownloadTriggerRequest(in ProfileDownloadTriggerRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_EimPackageResult(in octetstring stream) return EimPackageResult +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_EimPackageResult(in EimPackageResult msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_EimAcknowledgements(in octetstring stream) return EimAcknowledgements +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_EimAcknowledgements(in EimAcknowledgements msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + } diff --git a/library/euicc/esipa_Types_JSON.ttcn b/library/euicc/esipa_Types_JSON.ttcn new file mode 100644 index 0000000..132aaa8 --- /dev/null +++ b/library/euicc/esipa_Types_JSON.ttcn @@ -0,0 +1,564 @@ +/* JSON message definitions for ES9+ + * + * Author: Philipp Maier <pmaier(a)sysmocom.de> / sysmocom - s.f.m.c. GmbH + * + * 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 + */ + +module esipa_Types_JSON { + +import from esx_header_Types_JSON all; + +import from SGP32Definitions all; +import from SGP32Definitions_Types all; +import from SGP32Definitions_Templates all; + +import from RSPDefinitions all; +import from RSPDefinitions_Types all; +import from RSPDefinitions_Templates all; + +import from PKIX1Explicit88 all; +import from PKIX1Explicit88_Templates all; +import from PKIX1Explicit88_Types all; + +import from PKIX1Implicit88 all; +import from PKIX1Implicit88_Templates all; +import from PKIX1Implicit88_Types all; + +/* GSMA SGP.32, section 6.4.1.1 */ +type record JSON_ESipa_InitiateAuthenticationRequest { + JSON_ESx_RequestHeader header, + charstring euiccChallenge, + charstring euiccInfo1 optional, + charstring smdpAddress optional, + charstring eimTransactionId optional +}; +type record JSON_ESipa_InitiateAuthenticationResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId, + charstring serverSigned1, + charstring serverSignature1, + charstring euiccCiPKIdentifierToBeUsed, + charstring serverCertificate, + universal charstring matchingId optional, + charstring ctxParams1 optional +}; + +/* GSMA SGP.32, section 6.4.1.2 */ +type record JSON_ESipa_AuthenticateClientRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring authenticateServerResponse +}; +type record JSON_ESipa_AuthenticateClientResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId optional, + charstring profileMetadata optional, + charstring smdpSigned2, + charstring smdpSignature2, + charstring smdpCertificate, + charstring hashCc optional +}; + +/* GSMA SGP.32, section 6.4.1.3 */ +type record JSON_ESipa_GetBoundProfilePackageRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring prepareDownloadResponse +}; +type record JSON_ESipa_GetBoundProfilePackageResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId optional, + charstring boundProfilePackage +}; + +/* GSMA SGP.32, section 6.4.1.5 */ +type record JSON_ESipa_GetEimPackageRequest { + JSON_ESx_RequestHeader header, + charstring eidValue, + boolean notifyStateChange optional, + integer stateChangeCause optional, + charstring rPlmn optional +}; +type record JSON_ESipa_GetEimPackageResponse_euiccPkgReq { + JSON_ESx_ResponseHeader header, + charstring euiccPackageRequest +}; +type record JSON_ESipa_GetEimPackageResponse_euiccDataReq { + JSON_ESx_ResponseHeader header, + charstring ipaEuiccDataRequest +}; +type record JSON_ESipa_GetEimPackageResponse_dnlTrigReq { + JSON_ESx_ResponseHeader header, + charstring profileDownloadTriggerRequest +}; +type record JSON_ESipa_GetEimPackageResponse_eimPkgErr { + JSON_ESx_ResponseHeader header, + integer eimPackageError +}; +type union JSON_ESipa_GetEimPackageResponse { + JSON_ESipa_GetEimPackageResponse_euiccPkgReq getEimPackageResponse_euiccPkgReq, + JSON_ESipa_GetEimPackageResponse_euiccDataReq getEimPackageResponse_euiccDataReq, + JSON_ESipa_GetEimPackageResponse_dnlTrigReq getEimPackageResponse_dnlTrigReq, + JSON_ESipa_GetEimPackageResponse_eimPkgErr getEimPackageResponse_eimPkgErr +} with { + variant "JSON : as value" +} + +/* GSMA SGP.32, section 6.4.1.6 */ +type record JSON_ESipa_ProvideEimPackageResultRequest { + JSON_ESx_RequestHeader header, + charstring eidValue optional, + charstring eimPackageResult +}; +type record JSON_ESipa_ProvideEimPackageResultResponse { + JSON_ESx_ResponseHeader header, + charstring eimAcknowledgements optional +}; + +/* GSMA SGP.32, section 6.4.1.7 */ +type record JSON_ESipa_HandleNotification_pendingNotif { + JSON_ESx_RequestHeader header, + charstring pendingNotification +}; +type record JSON_ESipa_HandleNotification_prvdeEimPkgRslt { + JSON_ESx_RequestHeader header, + charstring provideEimPackageResult +}; +type union JSON_ESipa_HandleNotification { + JSON_ESipa_HandleNotification_pendingNotif handleNotification_pendingNotif, + JSON_ESipa_HandleNotification_prvdeEimPkgRslt handleNotification_prvdeEimPkgRslt +} with { + variant "JSON : as value" +} + +/* GSMA SGP.32, section 6.4.1.8 */ +type record JSON_ESipa_CancelSessionRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring cancelSessionResponse +}; + +/* An empty response that is used when the response only consists of a JSON header */ +type record JSON_ESipa_EmptyResponse { + JSON_ESx_ResponseHeader header +}; + +/* Definition for JSON ESipa requests */ +type union JSON_ESipa_EsipaMessageFromIpaToEim { + JSON_ESipa_InitiateAuthenticationRequest initiateAuthenticationRequest, + JSON_ESipa_AuthenticateClientRequest authenticateClientRequest, + JSON_ESipa_GetBoundProfilePackageRequest getBoundProfilePackageRequest, + JSON_ESipa_GetEimPackageRequest getEimPackageRequest, + JSON_ESipa_ProvideEimPackageResultRequest provideEimPackageResultRequest, + JSON_ESipa_HandleNotification handleNotification, + JSON_ESipa_CancelSessionRequest cancelSessionRequest +} with { + variant "JSON : as value" +} + +external function enc_JSON_ESipa_EsipaMessageFromIpaToEim(in JSON_ESipa_EsipaMessageFromIpaToEim msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ESipa_EsipaMessageFromIpaToEim(in octetstring stream) return JSON_ESipa_EsipaMessageFromIpaToEim +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +/* Definition for JSON ESipa responses */ +type union JSON_ESipa_EsipaMessageFromEimToIpa +{ + JSON_ESipa_InitiateAuthenticationResponse initiateAuthenticationResponse, + JSON_ESipa_AuthenticateClientResponse authenticateClientResponse, + JSON_ESipa_GetBoundProfilePackageResponse getBoundProfilePackageResponse, + JSON_ESipa_GetEimPackageResponse getEimPackageResponse, + JSON_ESipa_ProvideEimPackageResultResponse provideEimPackageResultResponse, + JSON_ESipa_EmptyResponse emptyResponse +} with { + variant "JSON : as value" +} + +external function enc_JSON_ESipa_EsipaMessageFromEimToIpa(in JSON_ESipa_EsipaMessageFromEimToIpa msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ESipa_EsipaMessageFromEimToIpa(in octetstring stream) return JSON_ESipa_EsipaMessageFromEimToIpa +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +/* Converter function to decode a JSON formatted ESipa request to its ASN.1 ESipa record representation */ +function dec_EsipaMessageFromIpaToEim_from_JSON(in charstring json_pdu_enc, out EsipaMessageFromIpaToEim asn1_pdu_dec) { + var JSON_ESipa_EsipaMessageFromIpaToEim json_pdu; + json_pdu := dec_JSON_ESipa_EsipaMessageFromIpaToEim(char2oct(json_pdu_enc)); + + if (ispresent(json_pdu.initiateAuthenticationRequest)) { + var template charstring smdpAddress := omit; + var template EUICCInfo1 euiccInfo1 := omit; + var template octetstring eimTransactionId := omit; + if (ispresent(json_pdu.initiateAuthenticationRequest.smdpAddress)) { + smdpAddress := json_pdu.initiateAuthenticationRequest.smdpAddress; + } + if (ispresent(json_pdu.initiateAuthenticationRequest.euiccInfo1)) { + euiccInfo1 := dec_EUICCInfo1(decode_base64(json_pdu.initiateAuthenticationRequest.euiccInfo1)); + } + if (ispresent(json_pdu.initiateAuthenticationRequest.eimTransactionId)) { + eimTransactionId := str2oct(json_pdu.initiateAuthenticationRequest.eimTransactionId); + } + asn1_pdu_dec := valueof(ts_initiateAuthenticationRequestEsipa( + decode_base64(json_pdu.initiateAuthenticationRequest.euiccChallenge), + smdpAddress, euiccInfo1, eimTransactionId)); + } else if (ispresent(json_pdu.authenticateClientRequest)) { + asn1_pdu_dec := valueof(ts_authenticateClientRequestEsipa( + str2oct(json_pdu.authenticateClientRequest.transactionId), + dec_SGP32_AuthenticateServerResponse(decode_base64(json_pdu.authenticateClientRequest.authenticateServerResponse)))); + } else if (ispresent(json_pdu.getBoundProfilePackageRequest)) { + asn1_pdu_dec := valueof(ts_getBoundProfilePackageRequestEsipa( + str2oct(json_pdu.getBoundProfilePackageRequest.transactionId), + dec_SGP32_PrepareDownloadResponse(decode_base64(json_pdu.getBoundProfilePackageRequest.prepareDownloadResponse)))); + } else if (ispresent(json_pdu.getEimPackageRequest)) { + var template AsnNull notifyStateChange := omit; + var template integer stateChangeCause := omit; + var template octetstring rPlmn := omit; + if (ispresent(json_pdu.getEimPackageRequest.notifyStateChange) and json_pdu.getEimPackageRequest.notifyStateChange == true) { + notifyStateChange := NULL; + } + if (ispresent(json_pdu.getEimPackageRequest.stateChangeCause)) { + stateChangeCause := json_pdu.getEimPackageRequest.stateChangeCause + } + if (ispresent(json_pdu.getEimPackageRequest.rPlmn)) { + rPlmn := str2oct(json_pdu.getEimPackageRequest.rPlmn); + } + asn1_pdu_dec := valueof(ts_getEimPackageRequest( + str2oct(json_pdu.getEimPackageRequest.eidValue), + notifyStateChange, stateChangeCause, rPlmn)); + } else if (ispresent(json_pdu.provideEimPackageResultRequest)) { + var template octetstring eidValue := omit; + if (ispresent(json_pdu.provideEimPackageResultRequest.eidValue)) { + eidValue := str2oct(json_pdu.provideEimPackageResultRequest.eidValue); + } + asn1_pdu_dec := valueof(ts_provideEimPackageResult(eidValue, + dec_EimPackageResult(decode_base64(json_pdu.provideEimPackageResultRequest.eimPackageResult)))); + } else if (ispresent(json_pdu.handleNotification)) { + if (ispresent(json_pdu.handleNotification.handleNotification_pendingNotif)) { + asn1_pdu_dec := valueof(ts_handleNotificationEsipa_pendingNotif( + dec_SGP32_PendingNotification(decode_base64(json_pdu.handleNotification.handleNotification_pendingNotif.pendingNotification)))); + } else if (ispresent(json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt)) { + asn1_pdu_dec := valueof(ts_handleNotificationEsipa_prvdeEimPkgRslt( + dec_ProvideEimPackageResult(decode_base64(json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt.provideEimPackageResult)))); + } + } else if (ispresent(json_pdu.cancelSessionRequest)) { + asn1_pdu_dec := valueof(ts_cancelSessionRequestEsipa( + str2oct(json_pdu.cancelSessionRequest.transactionId), + dec_SGP32_CancelSessionResponse(decode_base64(json_pdu.cancelSessionRequest.cancelSessionResponse)))); + } else { + setverdict(fail, "decoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +/* Converter function to encode an ASN.1 ESipa request record to its JSON formatted ESipa representation */ +function enc_EsipaMessageFromIpaToEim_to_JSON(in EsipaMessageFromIpaToEim asn1_pdu_dec, out charstring json_pdu_enc) { + var JSON_ESipa_EsipaMessageFromIpaToEim json_pdu; + + var charstring functionRequesterIdentifier := "TTCN3"; + var charstring functionCallIdentifier := "testsuite"; + + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa)) { + json_pdu.initiateAuthenticationRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.initiateAuthenticationRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.initiateAuthenticationRequest.euiccChallenge := encode_base64(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccChallenge); + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.smdpAddress)) { + json_pdu.initiateAuthenticationRequest.smdpAddress := unichar2char(asn1_pdu_dec.initiateAuthenticationRequestEsipa.smdpAddress); + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccInfo1)) { + json_pdu.initiateAuthenticationRequest.euiccInfo1 := encode_base64(enc_EUICCInfo1(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccInfo1)); + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.eimTransactionId)) { + json_pdu.initiateAuthenticationRequest.eimTransactionId := oct2str(asn1_pdu_dec.initiateAuthenticationRequestEsipa.eimTransactionId); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientRequestEsipa)) { + json_pdu.authenticateClientRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.authenticateClientRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.authenticateClientRequest.transactionId := oct2str(asn1_pdu_dec.authenticateClientRequestEsipa.transactionId); + json_pdu.authenticateClientRequest.authenticateServerResponse := + encode_base64(enc_SGP32_AuthenticateServerResponse(asn1_pdu_dec.authenticateClientRequestEsipa.authenticateServerResponse)) + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getBoundProfilePackageRequestEsipa)) { + json_pdu.getBoundProfilePackageRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.getBoundProfilePackageRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.getBoundProfilePackageRequest.transactionId := oct2str(asn1_pdu_dec.getBoundProfilePackageRequestEsipa.transactionId); + json_pdu.getBoundProfilePackageRequest.prepareDownloadResponse := + encode_base64(enc_SGP32_PrepareDownloadResponse(asn1_pdu_dec.getBoundProfilePackageRequestEsipa.prepareDownloadResponse)); + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getEimPackageRequest)) { + json_pdu.getEimPackageRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.getEimPackageRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.getEimPackageRequest.eidValue := oct2str(asn1_pdu_dec.getEimPackageRequest.eidValue); + if (ispresent(asn1_pdu_dec.getEimPackageRequest.notifyStateChange) and asn1_pdu_dec.getEimPackageRequest.notifyStateChange == NULL) { + json_pdu.getEimPackageRequest.notifyStateChange := true; + } else { + json_pdu.getEimPackageRequest.notifyStateChange := false; + } + if (ispresent(asn1_pdu_dec.getEimPackageRequest.stateChangeCause)) { + json_pdu.getEimPackageRequest.stateChangeCause := asn1_pdu_dec.getEimPackageRequest.stateChangeCause; + } + if (ispresent(asn1_pdu_dec.getEimPackageRequest.rPLMN)) { + json_pdu.getEimPackageRequest.rPlmn := oct2str(asn1_pdu_dec.getEimPackageRequest.rPLMN); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.provideEimPackageResult)) { + json_pdu.provideEimPackageResultRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.provideEimPackageResultRequest.header.functionCallIdentifier := functionCallIdentifier; + if (ispresent(asn1_pdu_dec.provideEimPackageResult.eidValue)) { + json_pdu.provideEimPackageResultRequest.eidValue := oct2str(asn1_pdu_dec.provideEimPackageResult.eidValue); + } + json_pdu.provideEimPackageResultRequest.eimPackageResult := + encode_base64(enc_EimPackageResult(asn1_pdu_dec.provideEimPackageResult.eimPackageResult)); + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.handleNotificationEsipa)) { + json_pdu.handleNotification.handleNotification_pendingNotif.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.handleNotification.handleNotification_pendingNotif.header.functionCallIdentifier := functionCallIdentifier; + if (ispresent(asn1_pdu_dec.handleNotificationEsipa.pendingNotification)) { + json_pdu.handleNotification.handleNotification_pendingNotif.pendingNotification := + encode_base64(enc_SGP32_PendingNotification(asn1_pdu_dec.handleNotificationEsipa.pendingNotification)) + } else if (ispresent(asn1_pdu_dec.handleNotificationEsipa.provideEimPackageResult)) { + json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt.provideEimPackageResult := + encode_base64(enc_ProvideEimPackageResult(asn1_pdu_dec.handleNotificationEsipa.provideEimPackageResult)) + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.cancelSessionRequestEsipa)) { + json_pdu.cancelSessionRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.cancelSessionRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.cancelSessionRequest.transactionId := oct2str(asn1_pdu_dec.cancelSessionRequestEsipa.transactionId); + json_pdu.cancelSessionRequest.cancelSessionResponse := + encode_base64(enc_SGP32_CancelSessionResponse(asn1_pdu_dec.cancelSessionRequestEsipa.cancelSessionResponse)) + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else { + setverdict(fail, "encoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +type record DecodedEimToIpaMessage_Wrap { + EsipaMessageFromEimToIpa asn1_pdu optional, + JSON_ESx_FunctionExecutionStatusCodeData err optional +} + +/* Converter function to decode a JSON formatted ESipa response to its ASN.1 ESipa record representation */ +function dec_EsipaMessageFromEimToIpa_from_JSON(in charstring json_pdu_enc, out DecodedEimToIpaMessage_Wrap wrapped_resp) { + var JSON_ESipa_EsipaMessageFromEimToIpa json_pdu; + json_pdu := dec_JSON_ESipa_EsipaMessageFromEimToIpa(char2oct(json_pdu_enc)); + + if (ispresent(json_pdu.initiateAuthenticationResponse)) { + var template octetstring transactionId := omit; + var template universal charstring matchingId := omit; + var template CtxParams1 ctxParams1 := omit; + if (not match(json_pdu.initiateAuthenticationResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.initiateAuthenticationResponse.transactionId)) { + transactionId := str2oct(json_pdu.initiateAuthenticationResponse.transactionId); + } + if (ispresent(json_pdu.initiateAuthenticationResponse.matchingId)) { + matchingId := json_pdu.initiateAuthenticationResponse.matchingId; + } + if (ispresent(json_pdu.initiateAuthenticationResponse.ctxParams1)) { + ctxParams1 := dec_CtxParams1(decode_base64(json_pdu.initiateAuthenticationResponse.ctxParams1)); + } + wrapped_resp.asn1_pdu := valueof(ts_initiateAuthenticationResponseEsipa( + transactionId, + dec_ServerSigned1(decode_base64(json_pdu.initiateAuthenticationResponse.serverSigned1)), + decode_base64(json_pdu.initiateAuthenticationResponse.serverSignature1), + dec_SubjectKeyIdentifier(decode_base64(json_pdu.initiateAuthenticationResponse.euiccCiPKIdentifierToBeUsed)), + dec_Certificate(decode_base64(json_pdu.initiateAuthenticationResponse.serverCertificate)), + matchingId, + ctxParams1)); + } else if (ispresent(json_pdu.authenticateClientResponse)) { + var template octetstring transactionId := omit; + var template SGP32_StoreMetadataRequest profileMetaData := omit; + var template octetstring hashCc := omit; + if (not match(json_pdu.authenticateClientResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.authenticateClientResponse.transactionId)) { + transactionId := str2oct(json_pdu.authenticateClientResponse.transactionId); + } + if (ispresent(json_pdu.authenticateClientResponse.profileMetadata)) { + profileMetaData := dec_SGP32_StoreMetadataRequest(decode_base64(json_pdu.authenticateClientResponse.profileMetadata)) + } + if (ispresent(json_pdu.authenticateClientResponse.hashCc)) { + hashCc := decode_base64(json_pdu.authenticateClientResponse.hashCc); + } + wrapped_resp.asn1_pdu := valueof(ts_authenticateClientResponseEsipa_dpe(transactionId, profileMetaData, + dec_SmdpSigned2(decode_base64(json_pdu.authenticateClientResponse.smdpSigned2)), + decode_base64(json_pdu.authenticateClientResponse.smdpSignature2), + dec_Certificate(decode_base64(json_pdu.authenticateClientResponse.smdpCertificate)), + hashCc)); + } else if (ispresent(json_pdu.getBoundProfilePackageResponse)) { + var template octetstring transactionId := omit; + if (not match(json_pdu.getBoundProfilePackageResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.getBoundProfilePackageResponse.transactionId)) { + transactionId := str2oct(json_pdu.getBoundProfilePackageResponse.transactionId); + } + wrapped_resp.asn1_pdu := valueof(ts_getBoundProfilePackageResponseEsipa(transactionId, + dec_BoundProfilePackage(decode_base64(json_pdu.getBoundProfilePackageResponse.boundProfilePackage)))); + } else if (ispresent(json_pdu.getEimPackageResponse)) { + if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_euiccPkgReq( + dec_EuiccPackageRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.euiccPackageRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_euiccDataReq( + dec_IpaEuiccDataRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.ipaEuiccDataRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq)) { + + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_dnlTrigReq( + dec_ProfileDownloadTriggerRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.profileDownloadTriggerRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_eimPkgErr( + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.eimPackageError)); + } + } else if (ispresent(json_pdu.provideEimPackageResultResponse)) { + /* TODO: Map JSON error to an provideEimPackageResultError of the ASN.1 output, check if similar + * is possible for the other structs? */ + if (not match(json_pdu.provideEimPackageResultResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.provideEimPackageResultResponse.eimAcknowledgements)) { + wrapped_resp.asn1_pdu := valueof(ts_provideEimPackageResultResponse_eimAck( + dec_EimAcknowledgements(decode_base64(json_pdu.provideEimPackageResultResponse.eimAcknowledgements)))); + } else { + wrapped_resp.asn1_pdu := valueof(ts_provideEimPackageResultResponse_empty) + } + } else if (ispresent(json_pdu.emptyResponse)) { + if (not match(json_pdu.emptyResponse.header, ts_responseHeader)) { + wrapped_resp.err := json_pdu.emptyResponse.header.functionExecutionStatus.statusCodeData; + } else { + /* Success case for empty response - initialize optional fields */ + wrapped_resp.asn1_pdu := omit; + wrapped_resp.err := omit; + } + } else { + setverdict(fail, "decoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +/* Converter function to encode an ASN.1 ESipa response record to its JSON formatted ESipa representation */ +function enc_EsipaMessageFromEimToIpa_to_JSON(in EsipaMessageFromEimToIpa asn1_pdu_dec, out charstring json_pdu_enc) { + var JSON_ESipa_EsipaMessageFromEimToIpa json_pdu; + + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa)) { + json_pdu.initiateAuthenticationResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.transactionId)) { + json_pdu.initiateAuthenticationResponse.transactionId := + oct2str(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.transactionId); + } + json_pdu.initiateAuthenticationResponse.serverSigned1 := + encode_base64(enc_ServerSigned1(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverSigned1)); + json_pdu.initiateAuthenticationResponse.serverSignature1 := + encode_base64(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverSignature1); + json_pdu.initiateAuthenticationResponse.euiccCiPKIdentifierToBeUsed := + encode_base64(enc_SubjectKeyIdentifier(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.euiccCiPKIdentifierToBeUsed)); + json_pdu.initiateAuthenticationResponse.serverCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverCertificate)); + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.matchingId)) { + json_pdu.initiateAuthenticationResponse.matchingId := + asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.matchingId; + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.ctxParams1)) { + json_pdu.initiateAuthenticationResponse.ctxParams1 := + encode_base64(enc_CtxParams1(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.ctxParams1)); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa)) { + json_pdu.authenticateClientResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.transactionId)) { + json_pdu.authenticateClientResponse.transactionId := + oct2str(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.transactionId); + } + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.profileMetaData)) { + json_pdu.authenticateClientResponse.profileMetadata := + encode_base64(enc_SGP32_StoreMetadataRequest(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.profileMetaData)); + } + json_pdu.authenticateClientResponse.smdpSigned2 := + encode_base64(enc_SmdpSigned2(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpSigned2)); + json_pdu.authenticateClientResponse.smdpSignature2 := + encode_base64(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpSignature2); + json_pdu.authenticateClientResponse.smdpCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpCertificate)); + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.hashCc)) { + json_pdu.authenticateClientResponse.hashCc := + encode_base64(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.hashCc); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getBoundProfilePackageResponseEsipa)) { + json_pdu.getBoundProfilePackageResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.transactionId)) { + json_pdu.getBoundProfilePackageResponse.transactionId := + oct2str(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.transactionId); + } + json_pdu.getBoundProfilePackageResponse.boundProfilePackage := + encode_base64(enc_BoundProfilePackage(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.boundProfilePackage)); + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse)) { + if (ispresent(asn1_pdu_dec.getEimPackageResponse.euiccPackageRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.euiccPackageRequest := + encode_base64(enc_EuiccPackageRequest(asn1_pdu_dec.getEimPackageResponse.euiccPackageRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.ipaEuiccDataRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.ipaEuiccDataRequest := + encode_base64(enc_IpaEuiccDataRequest(asn1_pdu_dec.getEimPackageResponse.ipaEuiccDataRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.profileDownloadTriggerRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.profileDownloadTriggerRequest := + encode_base64(enc_ProfileDownloadTriggerRequest(asn1_pdu_dec.getEimPackageResponse.profileDownloadTriggerRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.eimPackageError)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.eimPackageError := + asn1_pdu_dec.getEimPackageResponse.eimPackageError; + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.provideEimPackageResultResponse)) { + json_pdu.provideEimPackageResultResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.provideEimPackageResultResponse.eimAcknowledgements)) { + json_pdu.provideEimPackageResultResponse.eimAcknowledgements := + encode_base64(enc_EimAcknowledgements(asn1_pdu_dec.provideEimPackageResultResponse.eimAcknowledgements)); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.cancelSessionResponseEsipa)) { + /* This message has no JSON body, see also GSMA SGP.32, section 6.4.1.8 */ + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else { + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } +} with { extension "prototype(fast)" } + +} with { + encode "JSON"; +} -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43144?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: I8b6a87f39ca23658d980d19cf257b8994ea1cecb Gerrit-Change-Number: 43144 Gerrit-PatchSet: 13 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> 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/euicc: add ESipa JSON encoder/decoder module
by dexter 07 Sep '26

07 Sep '26
Attention is currently required from: jolly, pespin. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43144?usp=email ) Change subject: library/euicc: add ESipa JSON encoder/decoder module ...................................................................... Patch Set 12: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43144?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: I8b6a87f39ca23658d980d19cf257b8994ea1cecb Gerrit-Change-Number: 43144 Gerrit-PatchSet: 12 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 07 Sep 2026 11:17:02 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[L] Change in onomondo-eim[master]: esipa_json_handler: Add ESipa JSON bindings
by dexter 07 Sep '26

07 Sep '26
dexter has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43175?usp=email ) Change subject: esipa_json_handler: Add ESipa JSON bindings ...................................................................... esipa_json_handler: Add ESipa JSON bindings Since SGP.32, version 1.2, the JSON ESipa bindings are mandatory for the eIM (for the IPAd they are still optional). With this patch we add support for the JSON ESipa bindings. Change-Id: Id73ae78a976608fe6f367f8c3b92d8b7b4e195d4 Related: SYS#8100 --- M src/esipa_asn1_http_handler.erl M src/esipa_json_handler.erl A src/esipa_json_http_handler.erl M src/onomondo_eim_app.erl 4 files changed, 479 insertions(+), 41 deletions(-) Approvals: dexter: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/esipa_asn1_http_handler.erl b/src/esipa_asn1_http_handler.erl index 5f6ff9d..3b03826 100644 --- a/src/esipa_asn1_http_handler.erl +++ b/src/esipa_asn1_http_handler.erl @@ -25,7 +25,7 @@ {ok, IpaToEim} = esipa_asn1_codec:decode_ipa_to_eim(Data), {EsipaMsgType, _} = IpaToEim, logger:info( - "Handling incoming IPAd request: ~p,~nPeer=~p, Pid=~p~n", + "Handling incoming IPAd request (ASN.1): ~p,~nPeer=~p, Pid=~p~n", [EsipaMsgType, maps:get(peer, Req0), maps:get(pid, Req0)] ), logger:debug( @@ -64,7 +64,7 @@ maps:get(pid, Req0), [{[{procedureError, abortedOrder}]}], Reason ), logger:info( - "Handling of IPAd request terminated unexpectedly, Reason=~p Pid=~p~n", + "Handling of IPAd request (ASN.1) terminated unexpectedly, Reason=~p Pid=~p~n", [Reason, maps:get(pid, Req0)] ), cowboy_req:reply(500, ?RESPONSE_HEADERS, <<"Internal Server Error">>, Req0) diff --git a/src/esipa_json_handler.erl b/src/esipa_json_handler.erl index 62b4396..c5d8368 100644 --- a/src/esipa_json_handler.erl +++ b/src/esipa_json_handler.erl @@ -2,47 +2,419 @@ % % SPDX-License-Identifier: AGPL-3.0-only % +% Author: Philipp Maier <pmaier(a)sysmocom.de> / sysmocom - s.f.m.c. GmbH + -module(esipa_json_handler). --behavior(cowboy_handler). --export([init/2]). +-export([handle_json/2]). -init(Req0, State) -> - Path = cowboy_req:path(Req0), - Req = - case is_esipa_endpoint(Path) of +% Decode hex-string to binary +to_binary(absent) -> + absent; +to_binary(HexStr) -> + utils:hex_to_binary(HexStr). + +% Encode binary to hex-string +to_hex(absent) -> + absent; +to_hex(Binary) -> + utils:binary_to_hex(Binary). + +% Decode binary from base64 +from_base64(absent) -> + absent; +from_base64(ValueBase64) -> + base64:decode(ValueBase64). + +% Encode binary to base64 +to_base64(absent) -> + absent; +to_base64(ValueBinary) -> + base64:encode(ValueBinary). + +% Decode base64 encoded string to map (ASN.1) +from_base64asn1(_, _, absent) -> + absent; +from_base64asn1(Asn1SpecName, Asn1TypeName, Asn1ValueBase64) -> + Asn1ValueBin = base64:decode(Asn1ValueBase64), + {ok, Asn1ValueMap} = Asn1SpecName:decode(Asn1TypeName, Asn1ValueBin), + Asn1ValueMap. + +% Encode map (ASN.1) to base64 encoded string +to_base64asn1(_, _, absent) -> + absent; +to_base64asn1(Asn1SpecName, Asn1TypeName, Asn1ValueMap) -> + {ok, Asn1ValueBin} = Asn1SpecName:encode(Asn1TypeName, Asn1ValueMap), + base64:encode(Asn1ValueBin). + +% Join a list of tuples into a map +join_loop(Map, []) -> + Map; +join_loop(Map, [TuplesHead | TuplesTail]) -> + {Key, Value} = TuplesHead, + case Value of + absent -> + join_loop(Map, TuplesTail); + _ -> + join_loop(maps:merge(Map, #{Key => Value}), TuplesTail) + end. +join(Tuples) -> + join_loop(#{}, Tuples). + +% Chose the first (there should only be exactly one) non-absent member from the given tuple list +choose([]) -> + throw("missing required JSON element (choice, oneOf)"); +choose([TuplesHead | TuplesTail]) -> + {_, Value} = TuplesHead, + case Value of + absent -> + choose(TuplesTail); + _ -> + TuplesHead + end. + +%GSMA SGP.32, section 6.4.1.1 +handle_json(Pid, {<<"/gsma/rsp2/esipa/initiateAuthentication">>, EsipaReq}) -> + Req = join([ + {euiccChallenge, from_base64(maps:get(<<"euiccChallenge">>, EsipaReq, absent))}, + {euiccInfo1, + from_base64asn1( + 'RSPDefinitions', 'EUICCInfo1', maps:get(<<"euiccInfo1">>, EsipaReq, absent) + )}, + {smdpAddress, maps:get(<<"smdpAddress">>, EsipaReq, absent)}, + {eimTransactionId, to_binary(maps:get(<<"eimTransactionId">>, EsipaReq, absent))} + ]), + EsipaReqAsn = {initiateAuthenticationRequestEsipa, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {initiateAuthenticationResponseEsipa, + {initiateAuthenticationOkEsipa, InitiateAuthenticationOkEsipa}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {transactionId, + to_hex(maps:get(transactionId, InitiateAuthenticationOkEsipa, absent))}, + {serverSigned1, + to_base64asn1( + 'RSPDefinitions', + 'ServerSigned1', + maps:get(serverSigned1, InitiateAuthenticationOkEsipa) + )}, + {serverSignature1, + to_base64(maps:get(serverSignature1, InitiateAuthenticationOkEsipa))}, + {euiccCiPKIdentifierToBeUsed, + to_base64( + maps:get(euiccCiPKIdentifierToBeUsed, InitiateAuthenticationOkEsipa) + )}, + {serverCertificate, + to_base64asn1( + 'PKIX1Explicit88', + 'Certificate', + maps:get(serverCertificate, InitiateAuthenticationOkEsipa) + )}, + {matchingId, maps:get(matchingId, InitiateAuthenticationOkEsipa, absent)}, + {ctxParams1, + to_base64asn1( + 'RSPDefinitions', + 'CtxParams1', + maps:get(ctxParams1, InitiateAuthenticationOkEsipa, absent) + )} + ]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.2 +handle_json(Pid, {<<"/gsma/rsp2/esipa/authenticateClient">>, EsipaReq}) -> + Req = join([ + {transactionId, to_binary(maps:get(<<"transactionId">>, EsipaReq))}, + {authenticateServerResponse, + from_base64asn1( + 'SGP32Definitions', + 'SGP32-AuthenticateServerResponse', + maps:get(<<"authenticateServerResponse">>, EsipaReq) + )} + ]), + EsipaReqAsn = {authenticateClientRequestEsipa, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {authenticateClientResponseEsipa, + {authenticateClientOkDPEsipa, AuthenticateClientOkDPEsipa}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {transactionId, + to_hex(maps:get(transactionId, AuthenticateClientOkDPEsipa, absent))}, + % (The profileMetadata field has different spellings, JSON:"profileMetadata", ASN.1:"profileMetaData") + {profileMetadata, + to_base64asn1( + 'SGP32Definitions', + 'SGP32-StoreMetadataRequest', + maps:get(profileMetaData, AuthenticateClientOkDPEsipa, absent) + )}, + {smdpSigned2, + to_base64asn1( + 'RSPDefinitions', + 'SmdpSigned2', + maps:get(smdpSigned2, AuthenticateClientOkDPEsipa) + )}, + {smdpSignature2, + to_base64( + maps:get(smdpSignature2, AuthenticateClientOkDPEsipa) + )}, + {smdpCertificate, + to_base64asn1( + 'PKIX1Explicit88', + 'Certificate', + maps:get(smdpCertificate, AuthenticateClientOkDPEsipa) + )}, + {hashCc, + to_base64( + maps:get(hashCc, AuthenticateClientOkDPEsipa, absent) + )} + ]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.3 +handle_json(Pid, {<<"/gsma/rsp2/esipa/getBoundProfilePackage">>, EsipaReq}) -> + Req = join([ + {transactionId, to_binary(maps:get(<<"transactionId">>, EsipaReq))}, + {prepareDownloadResponse, + from_base64asn1( + 'SGP32Definitions', + 'SGP32-PrepareDownloadResponse', + maps:get(<<"prepareDownloadResponse">>, EsipaReq) + )} + ]), + EsipaReqAsn = {getBoundProfilePackageRequestEsipa, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {getBoundProfilePackageResponseEsipa, + {getBoundProfilePackageOkEsipa, GetBoundProfilePackageOkEsipa}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {transactionId, + to_hex(maps:get(transactionId, GetBoundProfilePackageOkEsipa, absent))}, + {boundProfilePackage, + to_base64asn1( + 'RSPDefinitions', + 'BoundProfilePackage', + maps:get(boundProfilePackage, GetBoundProfilePackageOkEsipa) + )} + ]); + {getBoundProfilePackageResponseEsipa, + {getBoundProfilePackageErrorEsipa, _GetBoundProfilePackageErrorEsipa}} -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.5 +handle_json(Pid, {<<"/gsma/rsp2/esipa/getEimPackage">>, EsipaReq}) -> + NotifyStateChange = + case maps:get(<<"notifyStateChange">>, EsipaReq, false) of true -> - cowboy_req:reply( - 501, - #{ - <<"content-type">> => <<"application/json">> - }, - <<"{}">>, - Req0 - ); - false -> - cowboy_req:reply( - 404, - #{ - <<"content-type">> => <<"text/plain">> - }, - <<"Not Found">>, - Req0 - ) + {notifyStateChange, 'NULL'}; + _ -> + {notifyStateChange, absent} end, - {ok, Req, State}. + StateChangeCause = + case maps:get(<<"stateChangeCause">>, EsipaReq, absent) of + absent -> + {stateChangeCause, absent}; + 0 -> + {stateChangeCause, otherEim}; + 1 -> + {stateChangeCause, fallback}; + 2 -> + {stateChangeCause, emergencyProfile}; + 3 -> + {stateChangeCause, local}; + 4 -> + {stateChangeCause, reset}; + 5 -> + {stateChangeCause, immediateEnableProfile}; + 6 -> + {stateChangeCause, deviceChange}; + 7 -> + {stateChangeCause, undefined}; + StateChangeCauseInt -> + % TODO: print warning + {stateChangeCause, StateChangeCauseInt} + end, + Req = join([ + {eidValue, to_binary(maps:get(<<"eidValue">>, EsipaReq))}, + NotifyStateChange, + StateChangeCause, + {rPLMN, to_binary(maps:get(<<"rPlmn">>, EsipaReq, absent))} + ]), + EsipaReqAsn = {getEimPackageRequest, Req}, -is_esipa_endpoint(Path) -> - lists:member( - Path, - [ - <<"/gsma/rsp2/esipa/initiateAuthentication">>, - <<"/gsma/rsp2/esipa/authenticateClient">>, - <<"/gsma/rsp2/esipa/getBoundProfilePackage">>, - <<"/gsma/rsp2/esipa/transferEimPackage">>, - <<"/gsma/rsp2/esipa/getEimPackage">>, - <<"/gsma/rsp2/esipa/provideEimPackageResult">>, - <<"/gsma/rsp2/esipa/handleNotification">>, - <<"/gsma/rsp2/esipa/cancelSession">> - ] - ). + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {getEimPackageResponse, {euiccPackageRequest, EuiccPackageRequest}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {euiccPackageRequest, + to_base64asn1( + 'SGP32Definitions', 'EuiccPackageRequest', EuiccPackageRequest + )} + ]); + {getEimPackageResponse, {ipaEuiccDataRequest, IpaEuiccDataRequest}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {ipaEuiccDataRequest, + to_base64asn1( + 'SGP32Definitions', 'IpaEuiccDataRequest', IpaEuiccDataRequest + )} + ]); + {getEimPackageResponse, {profileDownloadTriggerRequest, ProfileDownloadTriggerRequest}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {profileDownloadTriggerRequest, + to_base64asn1( + 'SGP32Definitions', + 'ProfileDownloadTriggerRequest', + ProfileDownloadTriggerRequest + )} + ]); + {getEimPackageResponse, {eimPackageError, EimPackageError}} -> + EimPackageErrorInt = + case EimPackageError of + noEimPackageAvailable -> + 1; + eidNotFound -> + 2; + invalidEid -> + 3; + missingEid -> + 4; + _ -> + 127 + end, + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {eimPackageError, EimPackageErrorInt} + ]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.6 +handle_json(Pid, {<<"/gsma/rsp2/esipa/provideEimPackageResult">>, EsipaReq}) -> + Req = join([ + {eidValue, to_binary(maps:get(<<"eidValue">>, EsipaReq, absent))}, + {eimPackageResult, + from_base64asn1( + 'SGP32Definitions', 'EimPackageResult', maps:get(<<"eimPackageResult">>, EsipaReq) + )} + ]), + EsipaReqAsn = {provideEimPackageResult, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {provideEimPackageResultResponse, {eimAcknowledgements, EimAcknowledgements}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }}, + {eimAcknowledgements, + to_base64asn1( + 'SGP32Definitions', 'EimAcknowledgements', EimAcknowledgements + )} + ]); + {provideEimPackageResultResponse, {emptyResponse, #{}}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }} + ]); + {provideEimPackageResultError, + {provideEimPackageResultError, _ProvideEimPackageResultError}} -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.7 +handle_json(Pid, {<<"/gsma/rsp2/esipa/handleNotification">>, EsipaReq}) -> + Req = choose([ + {pendingNotification, + from_base64asn1( + 'SGP32Definitions', + 'SGP32-PendingNotification', + maps:get(<<"pendingNotification">>, EsipaReq, absent) + )}, + {provideEimPackageResult, + from_base64asn1( + 'SGP32Definitions', + 'ProvideEimPackageResult', + maps:get(<<"provideEimPackageResult">>, EsipaReq, absent) + )} + ]), + EsipaReqAsn = {handleNotificationEsipa, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + emptyResponse -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }} + ]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%GSMA SGP.32, section 6.4.1.8 +handle_json(Pid, {<<"/gsma/rsp2/esipa/cancelSession">>, EsipaReq}) -> + Req = join([ + {transactionId, to_binary(maps:get(<<"transactionId">>, EsipaReq))}, + {cancelSessionResponse, + from_base64asn1( + 'SGP32Definitions', + 'SGP32-CancelSessionResponse', + maps:get(<<"cancelSessionResponse">>, EsipaReq) + )} + ]), + EsipaReqAsn = {cancelSessionRequestEsipa, Req}, + + EimToIpaAsn = esipa_asn1_handler:handle_asn1(Pid, EsipaReqAsn), + + case EimToIpaAsn of + {cancelSessionResponseEsipa, {cancelSessionOk, _CancelSessionOk}} -> + join([ + {header, #{ + <<"functionExecutionStatus">> => #{<<"status">> => <<"Executed-Success">>} + }} + ]); + {cancelSessionResponseEsipa, {cancelSessionError, _CancelSessionError}} -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]); + _ -> + join([{header, #{<<"functionExecutionStatus">> => #{<<"status">> => <<"Failed">>}}}]) + end; +%Unsupported request +handle_json(Pid, Request) -> + mnesia_db_work:finish(Pid, [{[{procedureError, abortedOrder}]}], unsupported), + logger:info( + "Handling of IPAd request failed, the request type is unsupported,~nRequest=~p,~nPid=~p~n", + [Request, Pid] + ), + {error, unsupported_request}. diff --git a/src/esipa_json_http_handler.erl b/src/esipa_json_http_handler.erl new file mode 100644 index 0000000..7d2de97 --- /dev/null +++ b/src/esipa_json_http_handler.erl @@ -0,0 +1,66 @@ +% Copyright (c) 2025 Onomondo ApS & sysmocom - s.f.m.c. GmbH. All rights reserved. +% +% SPDX-License-Identifier: AGPL-3.0-only +% +-module(esipa_json_http_handler). +-behavior(cowboy_handler). + +-define(RESPONSE_HEADERS, #{ + <<"content-type">> => <<"application/json;charset=UTF-8">>, + <<"x-admin-protocol">> => <<"gsma/rsp/v2.1.0">> +}). + +-export([init/2, terminate/3]). + +init(Req0, State) -> + Req = + case cowboy_req:header(<<"content-type">>, Req0) of + <<"application/json;charset=UTF-8">> -> + {ok, Data, _Req1} = cowboy_req:read_body(Req0), + IpaToEim = jiffy:decode(Data, [return_maps]), + Path = cowboy_req:path(Req0), + logger:info( + "Handling incoming IPAd request (JSON): ~p,~nPeer=~p, Pid=~p~n", + [Path, maps:get(peer, Req0), maps:get(pid, Req0)] + ), + logger:debug( + "Rx ESipa JSON,~nPeer=~p, Pid=~p,~nIpaToEim=~p~n", + [maps:get(peer, Req0), maps:get(pid, Req0), IpaToEim] + ), + EimToIpa = esipa_json_handler:handle_json(maps:get(pid, Req0), {Path, IpaToEim}), + logger:debug( + "Tx ESipa JSON,~nPeer=~p,Pid=~p,~nEimToIpa=~p~n", + [maps:get(peer, Req0), maps:get(pid, Req0), EimToIpa] + ), + case EimToIpa of + {error, unsupported_request} -> + cowboy_req:reply( + 400, + ?RESPONSE_HEADERS, + <<"Unsupported Request">>, + Req0 + ); + _ -> + EncodedRespBody = jiffy:encode(EimToIpa, [force_utf8]), + cowboy_req:reply(200, ?RESPONSE_HEADERS, EncodedRespBody, Req0) + end; + _ -> + cowboy_req:reply(415, ?RESPONSE_HEADERS, <<"Unsupported content-type">>, Req0) + end, + {ok, Req, State}. + +% Handle termination of HTTP requests +terminate(Reason, Req0, _State) -> + case Reason of + normal -> + ok; + _ -> + mnesia_db_work:finish( + maps:get(pid, Req0), [{[{procedureError, abortedOrder}]}], Reason + ), + logger:info( + "Handling of IPAd request (JSON) terminated unexpectedly, Reason=~p Pid=~p~n", + [Reason, maps:get(pid, Req0)] + ), + cowboy_req:reply(500, ?RESPONSE_HEADERS, <<"Internal Server Error">>, Req0) + end. diff --git a/src/onomondo_eim_app.erl b/src/onomondo_eim_app.erl index c5ea149..1d8c73f 100644 --- a/src/onomondo_eim_app.erl +++ b/src/onomondo_eim_app.erl @@ -54,7 +54,7 @@ cowboy_router:compile([ {'_', [ % SGP.32 Section 6.4.1 - {"/gsma/rsp2/esipa/[...]", esipa_json_handler, []}, + {"/gsma/rsp2/esipa/[...]", esipa_json_http_handler, []}, % SGP.32 Section 6.1.1: Any function execution request using ASN.1 binding SHALL be sent to the generic % HTTP path 'gsma/rsp2/asn1' {"/gsma/rsp2/asn1", esipa_asn1_http_handler, []}, -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43175?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: Id73ae78a976608fe6f367f8c3b92d8b7b4e195d4 Gerrit-Change-Number: 43175 Gerrit-PatchSet: 6 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> 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 onomondo-eim[master]: esipa_json_handler: Add ESipa JSON bindings
by dexter 07 Sep '26

07 Sep '26
Attention is currently required from: fixeria, pespin. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43175?usp=email ) Change subject: esipa_json_handler: Add ESipa JSON bindings ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43175?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: Id73ae78a976608fe6f367f8c3b92d8b7b4e195d4 Gerrit-Change-Number: 43175 Gerrit-PatchSet: 6 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 07 Sep 2026 11:13:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in simtrace2[master]: build: do distcheck for the host tools
by fixeria 07 Sep '26

07 Sep '26
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/43530?usp=email ) Change subject: build: do distcheck for the host tools ...................................................................... build: do distcheck for the host tools This allows to detect missing files in the release tarballs. Change-Id: I2352d99a91079e027ca9827c10663212a3f6292f --- M contrib/jenkins.sh 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/30/43530/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index deaeea5..fdb61ea 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -87,7 +87,7 @@ autoreconf --install --force ./configure --enable-sanitize --enable-werror $MAKE $PARALLEL_MAKE -#$MAKE distcheck || cat-testlogs.sh +$MAKE distcheck || cat-testlogs.sh make dist #if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43530?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I2352d99a91079e027ca9827c10663212a3f6292f Gerrit-Change-Number: 43530 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[XS] Change in simtrace2[master]: build: include version.h.tpl in the release tarballs
by fixeria 07 Sep '26

07 Sep '26
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/43529?usp=email ) Change subject: build: include version.h.tpl in the release tarballs ...................................................................... build: include version.h.tpl in the release tarballs simtrace2-host-0.9.1.tar.bz2 does not compile because this file is missing. Add it to EXTRA_DIST. make all-recursive make[1]: Entering directory '/build/simtrace2/src/simtrace2-0.9.1' Making all in include make[2]: Entering directory '/build/simtrace2/src/simtrace2-0.9.1/include' make[2]: *** No rule to make target 'osmocom/simtrace2/version.h.tpl', needed by 'osmocom/simtrace2/version.h'. Stop. make[2]: Leaving directory '/build/simtrace2/src/simtrace2-0.9.1/include' make[1]: *** [Makefile:452: all-recursive] Error 1 make[1]: Leaving directory '/build/simtrace2/src/simtrace2-0.9.1' make: *** [Makefile:376: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... Change-Id: I8c50c8df012b2b7eb5ee6046f14ccc4d2c07194e Fixes: d0ad985e ("Generate a version.h file") --- M host/include/Makefile.am 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/29/43529/1 diff --git a/host/include/Makefile.am b/host/include/Makefile.am index 3a9722c..eba4978 100644 --- a/host/include/Makefile.am +++ b/host/include/Makefile.am @@ -16,3 +16,5 @@ osmocom/simtrace2/gsmtap.h \ osmocom/simtrace2/version.h \ $(NULL) + +EXTRA_DIST = osmocom/simtrace2/version.h.tpl -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43529?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I8c50c8df012b2b7eb5ee6046f14ccc4d2c07194e Gerrit-Change-Number: 43529 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ci[master]: jobs/gerrit,master: osmo-trx arm builds: use lx2
by osmith 07 Sep '26

07 Sep '26
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/43528?usp=email ) Change subject: jobs/gerrit,master: osmo-trx arm builds: use lx2 ...................................................................... jobs/gerrit,master: osmo-trx arm builds: use lx2 Use the raspbian container on lx2 instead of the raspberry pi builders for osmo-trx, as the rpis have less memory and building osmo-trx on them frequently leads to aborted builds because of this. Fixes: OS#7083 Change-Id: Ie4f2975ab8d819fc778dc76dcd3d728a3ad27ae2 --- M jobs/gerrit-verifications.yml M jobs/master-builds.yml 2 files changed, 8 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index 9398fbf..27bd888 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -448,7 +448,8 @@ - osmo-sip-connector - osmo-trx: - slave_axis: !!python/tuple [osmocom-gerrit,raspbian] + # OS#7083: use lx2 for arm builds because it has enough memory + slave_axis: !!python/tuple [osmocom-gerrit,lx2-raspbian13build-ansible] a1_name: INSTR a1: !!python/tuple [--with-sse, --without-sse, --with-neon, --with-neon-vfpv4] a2_name: WITH_MANUALS @@ -456,8 +457,8 @@ combination_filter: > (INSTR == "--without-sse" && WITH_MANUALS == "1" && label == "osmocom-gerrit") || (INSTR == "--with-sse" && WITH_MANUALS == "0" && label == "osmocom-gerrit") || - (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "raspbian") || - (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "raspbian") + (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "lx2-raspbian13build-ansible") || + (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "lx2-raspbian13build-ansible") cmd: | DOCKER_IMG="{docker_img}" case "$(arch)" in diff --git a/jobs/master-builds.yml b/jobs/master-builds.yml index 3b8cd47..d915ccb 100644 --- a/jobs/master-builds.yml +++ b/jobs/master-builds.yml @@ -548,7 +548,8 @@ email: jenkins-notifications(a)lists.osmocom.org laforge(a)gnumonks.org 246tnt(a)gmail.com - osmo-trx: - slave_axis: !!python/tuple [osmocom-master,raspbian] + # OS#7083: use lx2 for arm builds because it has enough memory + slave_axis: !!python/tuple [osmocom-master,lx2-raspbian13build-ansible] a1_name: INSTR a1: !!python/tuple [--with-sse, --without-sse, --with-neon, --with-neon-vfpv4] a2_name: WITH_MANUALS @@ -556,8 +557,8 @@ combination_filter: > (INSTR == "--without-sse" && WITH_MANUALS == "1" && label == "osmocom-master") || (INSTR == "--with-sse" && WITH_MANUALS == "0" && label == "osmocom-master") || - (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "raspbian") || - (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "raspbian") + (INSTR == "--with-neon" && WITH_MANUALS == "0" && label == "lx2-raspbian13build-ansible") || + (INSTR == "--with-neon-vfpv4" && WITH_MANUALS == "0" && label == "lx2-raspbian13build-ansible") cmd: | DOCKER_IMG="{docker_img}" case "$(arch)" in -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43528?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: Ie4f2975ab8d819fc778dc76dcd3d728a3ad27ae2 Gerrit-Change-Number: 43528 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ci[master]: jobs/gerrit,master: osmo-trx arm builds: use lx2
by pespin 07 Sep '26

07 Sep '26
Attention is currently required from: osmith. pespin has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ci/+/43528?usp=email ) Change subject: jobs/gerrit,master: osmo-trx arm builds: use lx2 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43528?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: Ie4f2975ab8d819fc778dc76dcd3d728a3ad27ae2 Gerrit-Change-Number: 43528 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Mon, 07 Sep 2026 09:55:10 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[L] Change in pysim[master]: GP: LOAD/STORE DATA chunk size from SCP overhead
by dexter 07 Sep '26

07 Sep '26
Attention is currently required from: Hoernchen. dexter has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/43172?usp=email ) Change subject: GP: LOAD/STORE DATA chunk size from SCP overhead ...................................................................... Patch Set 7: (1 comment) File tests/unittests/test_globalplatform.py: https://gerrit.osmocom.org/c/pysim/+/43172/comment/abe704f0_0a4e00da?usp=em… : PS7, Line 385: # GP CardSpec v2.3.1 Section 11.8.2.3.1: all lengths ofPUT KEY are always BER TLV coded > missing space ("...length ofPUT KEY... […] I would recommend to fix this typo, re-add +2 and then to merge this patch. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/43172?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: Ic208f3959a38896f64fb6ccefb24cc360a3ac3a2 Gerrit-Change-Number: 43172 Gerrit-PatchSet: 7 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Comment-Date: Mon, 07 Sep 2026 09:35:26 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.